donate points

В този раздел можете да подавате всякакви заявки за намиране, изработка или преработка на плъгини/модове.
Аватар
BloodyPro
Извън линия
Foreigner
Foreigner
Мнения: 26
Регистриран на: 26 Юли 2020, 16:28
Местоположение: Palestine
Се отблагодари: 1 път
Обратна връзка:

donate points

Мнение от BloodyPro » 30 Юли 2020, 23:26

hey ,
im using OciXCrom Shop System
im asking if its possible to add "amx_donate , say /donate" commands to the system (to donate points) from non admin player to another player
thank you,

Аватар
OciXCrom
Извън линия
Администратор
Администратор
Мнения: 7206
Регистриран на: 06 Окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 117 пъти
Получена благодарност: 1295 пъти
Обратна връзка:

donate points

Мнение от OciXCrom » 30 Юли 2020, 23:49


Аватар
BloodyPro
Извън линия
Foreigner
Foreigner
Мнения: 26
Регистриран на: 26 Юли 2020, 16:28
Местоположение: Palestine
Се отблагодари: 1 път
Обратна връзка:

donate points

Мнение от BloodyPro » 31 Юли 2020, 10:19

OciXCrom написа: 30 Юли 2020, 23:49 I made one here a while ago - https://forums.alliedmods.net/showthrea ... 03&page=22
ty , its working , is it possible to make it for all players ? not only for the team ur in ?

Аватар
OciXCrom
Извън линия
Администратор
Администратор
Мнения: 7206
Регистриран на: 06 Окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 117 пъти
Получена благодарност: 1295 пъти
Обратна връзка:

donate points

Мнение от OciXCrom » 31 Юли 2020, 13:23

Which of the 2 are you using? The 1.8.2 or 1.9 version?

Аватар
BloodyPro
Извън линия
Foreigner
Foreigner
Мнения: 26
Регистриран на: 26 Юли 2020, 16:28
Местоположение: Palestine
Се отблагодари: 1 път
Обратна връзка:

donate points

Мнение от BloodyPro » 31 Юли 2020, 13:46

OciXCrom написа: 31 Юли 2020, 13:23 Which of the 2 are you using? The 1.8.2 or 1.9 version?

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <amxmisc>
#include <cromchat>
#include <cstrike>
#include <customshop>

#define PLUGIN "Points Donate"
#define VERSION "1.0"
#define AUTOR "iceeedR"

#if defined client_disconnected
    #define client_disconnect client_disconnected
#endif

#if !defined MAX_PLAYERS
const MAX_PLAYERS = 32
#endif

/* Edit by OciXCrom: made the plugin donate points from Custom Shop instead of money */

new const Prefix[] = "[Deathrun Shop]"
new DonateTarget[MAX_PLAYERS +1]

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTOR);
    register_clcmd("say /donate", "DonateCmd")
    register_clcmd("plugin_donate", "DonateHandler")
}

public client_disconnect(id)
{
    DonateTarget[id] = 0 // just for secure
}

public DonateCmd(id)
{
    new szItem[64]
    formatex(szItem, charsmax(szItem), "\y[\w%s\d - \rDonate Menu \y ]", Prefix)

    new iMenu = menu_create(szItem, "donate_handler")

    new iPlayers[MAX_PLAYERS], iNum
    get_players(iPlayers, iNum, "e", (cs_get_user_team(id) == CS_TEAM_T) ? "TERRORIST" : "CT")
    for(new i, szTempid[10], iPlayer;i < iNum;i++)
    {
        iPlayer = iPlayers[i]

        if(iPlayer != id)
        {
            num_to_str(iPlayer, szTempid, charsmax(szTempid))
            get_user_name(iPlayer, szItem, charsmax(szItem))
            menu_additem(iMenu, szItem, szTempid)
        }
    }

    menu_display(id, iMenu)
    return PLUGIN_HANDLED
}

public donate_handler(id, iMenu, iItem)
{
    if(iItem == MENU_EXIT)
    {
        menu_destroy(iMenu)
        return PLUGIN_HANDLED
    }
    new iData[6], szItemName[MAX_PLAYERS * 2], iAccess, iCallback
    menu_item_getinfo(iMenu, iItem, iAccess, iData, charsmax(iData), szItemName, charsmax(szItemName), iCallback)

    DonateTarget[id] = str_to_num(iData)

    if(!DonateTarget[id])
    {
        client_print_color(id, print_team_default, "^x04%s%s ^x01This player does not exist.", Prefix)
        menu_display(id, iMenu)
        DonateTarget[id] = 0
        return PLUGIN_HANDLED
    }

    client_cmd(id, "messagemode plugin_donate")

    client_print_color(id, print_team_default, "^x04%s ^x01Type how much you want to give.", Prefix)
    return PLUGIN_HANDLED
}

public DonateHandler(id)
{
    new szValue[8]
    read_argv(1, szValue, charsmax(szValue))

    new iValue = str_to_num(szValue)

    new iPlayerMoney = cshop_get_points(id)

    if( iPlayerMoney < iValue || iValue <= 0)
    {
        client_print_color(id, print_team_default, "^x04%s ^x01You do not have enough points.", Prefix)
        return PLUGIN_CONTINUE
    }

    cshop_give_points( DonateTarget[id], iValue)
    cshop_give_points( id, iValue * -1)

    new szNameGiver[MAX_PLAYERS]
    get_user_name( id, szNameGiver, charsmax( szNameGiver))

    new szNameReceiver[MAX_PLAYERS]
    get_user_name(DonateTarget[id], szNameReceiver, charsmax(szNameReceiver))

    new iPlayers[MAX_PLAYERS], iNum
    get_players(iPlayers, iNum, "e", (cs_get_user_team(id) == CS_TEAM_T) ? "TERRORIST" : "CT")
    for(new i;i < iNum;i++)
    {
        client_print_color(iPlayers[i], print_team_default, "^x04%s^x04 %s^x01 donated^x04 %i points^x01 for^x04 %s.", Prefix, szNameGiver, iValue, szNameReceiver)
    }
    client_cmd(DonateTarget[id], "spk ^"items/9mmclip1.wav^"")

    DonateTarget[id] = 0
    return PLUGIN_HANDLED
} 
this

Аватар
OciXCrom
Извън линия
Администратор
Администратор
Мнения: 7206
Регистриран на: 06 Окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 117 пъти
Получена благодарност: 1295 пъти
Обратна връзка:

donate points

Мнение от OciXCrom » 31 Юли 2020, 14:20

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <amxmisc>
#include <cromchat>
#include <customshop>

#define PLUGIN "Points Donate"
#define VERSION "1.0"
#define AUTOR "iceeedR"

#if defined client_disconnected
    #define client_disconnect client_disconnected
#endif

#if !defined MAX_PLAYERS
const MAX_PLAYERS = 32
#endif

/* Edit by OciXCrom: made the plugin donate points from Custom Shop instead of money */

new const Prefix[] = "[Deathrun Shop]"
new DonateTarget[MAX_PLAYERS +1]

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTOR);
    register_clcmd("say /donate", "DonateCmd")
    register_clcmd("plugin_donate", "DonateHandler")
}

public client_disconnect(id)
{
    DonateTarget[id] = 0 // just for secure
}

public DonateCmd(id)
{
    new szItem[64]
    formatex(szItem, charsmax(szItem), "\y[\w%s\d - \rDonate Menu \y ]", Prefix)

    new iMenu = menu_create(szItem, "donate_handler")

    new iPlayers[MAX_PLAYERS], iNum
    get_players(iPlayers, iNum)
    for(new i, szTempid[10], iPlayer;i < iNum;i++)
    {
        iPlayer = iPlayers[i]

        if(iPlayer != id)
        {
            num_to_str(iPlayer, szTempid, charsmax(szTempid))
            get_user_name(iPlayer, szItem, charsmax(szItem))
            menu_additem(iMenu, szItem, szTempid)
        }
    }

    menu_display(id, iMenu)
    return PLUGIN_HANDLED
}

public donate_handler(id, iMenu, iItem)
{
    if(iItem == MENU_EXIT)
    {
        menu_destroy(iMenu)
        return PLUGIN_HANDLED
    }
    new iData[6], szItemName[MAX_PLAYERS * 2], iAccess, iCallback
    menu_item_getinfo(iMenu, iItem, iAccess, iData, charsmax(iData), szItemName, charsmax(szItemName), iCallback)

    DonateTarget[id] = str_to_num(iData)

    if(!DonateTarget[id])
    {
        client_print_color(id, print_team_default, "^x04%s%s ^x01This player does not exist.", Prefix)
        menu_display(id, iMenu)
        DonateTarget[id] = 0
        return PLUGIN_HANDLED
    }

    client_cmd(id, "messagemode plugin_donate")

    client_print_color(id, print_team_default, "^x04%s ^x01Type how much you want to give.", Prefix)
    return PLUGIN_HANDLED
}

public DonateHandler(id)
{
    new szValue[8]
    read_argv(1, szValue, charsmax(szValue))

    new iValue = str_to_num(szValue)

    new iPlayerMoney = cshop_get_points(id)

    if( iPlayerMoney < iValue || iValue <= 0)
    {
        client_print_color(id, print_team_default, "^x04%s ^x01You do not have enough points.", Prefix)
        return PLUGIN_CONTINUE
    }

    cshop_give_points( DonateTarget[id], iValue)
    cshop_give_points( id, iValue * -1)

    new szNameGiver[MAX_PLAYERS]
    get_user_name( id, szNameGiver, charsmax( szNameGiver))

    new szNameReceiver[MAX_PLAYERS]
    get_user_name(DonateTarget[id], szNameReceiver, charsmax(szNameReceiver))

    new iPlayers[MAX_PLAYERS], iNum
    get_players(iPlayers, iNum)
    for(new i;i < iNum;i++)
    {
        client_print_color(iPlayers[i], print_team_default, "^x04%s^x04 %s^x01 donated^x04 %i points^x01 for^x04 %s.", Prefix, szNameGiver, iValue, szNameReceiver)
    }
    client_cmd(DonateTarget[id], "spk ^"items/9mmclip1.wav^"")

    DonateTarget[id] = 0
    return PLUGIN_HANDLED
}

Публикувай отговор
  • Подобни теми
    Отговори
    Преглеждания
     Последно мнение

Обратно към “Заявки за плъгини”

Кой е на линия

Потребители разглеждащи този форум: Bing [Bot] и 17 госта