Raised This Month: $ Target: $400
 0% 

script to more easily donate money


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
wizzar
Member
Join Date: Dec 2009
Old 01-13-2025 , 10:26   script to more easily donate money
Reply With Quote #1

Hello

I'm trying to make a script to allow money donation during freeze time that works like this: if a player is aiming at another player, a center message appears saying "press E to donate". Upon pressing E, a menu shows with predefined values (1: 500, 2: 1000, 3: 1500, etc). I saw this on a server and I could only find scripts that allow donation with "/donate", but it takes too much time do it this way.

If anyone could just give me pointers as to which functions I should hook, a barebone general idea of the API, I could do it myself. I'm just now getting familiar with the amx api and thought maybe someone could help me speed things up.

Thanks.

What I got so far:

Quote:
#include <amxmodx>
#include <engine>
#include <hamsandwich>

#pragma semicolon 1
new const PLUGIN[] = "Aim Notify";
new const VERSION[] = "1.0";
new const AUTHOR[] = "YourName";
new g_iSyncObj;

public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR);

//looking at a player
register_event("StatusValue", "EvStatusValueShowPlayerInfo", "b", "1=2", "2>0" );

//stoped looking
register_event("StatusValue", "EvStatusValueHide", "be", "1=1", "2=0");

g_iSyncObj = CreateHudSyncObj();

// Not working!
RegisterHam(Ham_Use, "player", "OnPlayerUse");
}

public EvStatusValueShowPlayerInfo(id)
{
new iPlayer = read_data( 2 );
set_hudmessage(255, 170, 0, -1.0, -1.0, 0, 0.0, 15.0, 0.0, 0.0, -1);
ShowSyncHudMsg(id, g_iSyncObj, "PRESS E TO DONATE");

//return PLUGIN_HANDLED; // Not sure yet if should return this or not...
}

public EvStatusValueHide(id)
{
ClearSyncHud(id, g_iSyncObj);
//return PLUGIN_HANDLED;
}

public OnPlayerUse(ent, id) {
client_print(id, print_center, "test - test");
return HAM_HANDLED;
}
What works: aiming at a plyer I get the message, and it disappears when I aim somewhere else.

Last edited by wizzar; 01-13-2025 at 12:11.
wizzar is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-13-2025 , 13:15   Re: script to more easily donate money
Reply With Quote #2

PHP Code:

#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <hamsandwich>

#pragma semicolon 1

new const PLUGIN[] = "Aim Notify";
new const 
VERSION[] = "1.0";
new const 
AUTHOR[] = "YourName";

new 
g_iSyncObj;
new 
g_IsLookingAtPlayer;

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
//looking at a player
    
register_event("StatusValue""EvStatusValueShowPlayerInfo""b""1=2""2>0" );
    
    
//stoped looking
    
register_event("StatusValue""EvStatusValueHide""be""1=1""2=0");
    
    
register_forwardFM_CmdStart "CmdStart" );
    
    
g_iSyncObj CreateHudSyncObj();
}

public 
EvStatusValueShowPlayerInfo(id)
{
    new 
iPlayer read_data);
    
set_hudmessage(2551700, -1.0, -1.000.015.00.00.0, -1);
    
ShowSyncHudMsg(idg_iSyncObj"PRESS E TO DONATE");
    
g_IsLookingAtPlayer |= (<< ( id 31 ) );
}

public 
EvStatusValueHide(id)
{
    
ClearSyncHud(idg_iSyncObj);
    
g_IsLookingAtPlayer &= ~(<< ( id 31 ) );
}

public 
CmdStartid uc_handle seed 
{
    static 
Buttons OldButtons;
    
    
Buttons get_ucuc_handle UC_Buttons );
    
OldButtons pevid pev_oldbuttons );
    
    if ( ( !( 
OldButtons IN_USE ) && ( Buttons IN_USE ) ) && ( g_IsLookingAtPlayer & ( << ( id 31 ) ) ) )
    {
        
client_printid print_chat "use pressed" );
    }

__________________

Last edited by Bugsy; 01-13-2025 at 17:09.
Bugsy is online now
wizzar
Member
Join Date: Dec 2009
Old 01-13-2025 , 18:13   Re: script to more easily donate money
Reply With Quote #3

Thanks. I spent the day going through this, and this is what I came up with:

PHP Code:
#include <amxmodx>
#include <fakemeta>

#pragma semicolon 1
#define OFFSET_MONEY        115
#define cs_get_user_money(%1)    get_pdata_int(%1,OFFSET_MONEY)

new const PLUGIN[] = "Aim Notify";
new const 
VERSION[] = "1.0";
new const 
AUTHOR[] = "YourName";
new 
giSyncObj;
new 
gMsgMoney;
new 
gCurrentDntReceiverId;
new 
gCurrentDntReceiverName[32];
new 
menu 0;
new 
donateEnabled false;

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);

    
//looking at a player
    
register_event("StatusValue""EvStatusValueShowPlayerInfo""b""1=2""2>0");
    
    
//stoped looking
    
register_event("StatusValue""EvStatusValueHide""be""1=1""2=0");

    
giSyncObj CreateHudSyncObj();

    
register_forward(FM_CmdStart "OnUseKeyPress");

    
gMsgMoney get_user_msgid("Money");

    
register_event("HLTV""EventNewRound""a""1=0""2=0");
    
register_logevent("EventRoundStart"2"1=Round_Start");
}

public 
EvStatusValueShowPlayerInfo(id)
{
    if (
donateEnabled) {    
        
set_hudmessage(2551700, -1.0, -1.000.015.00.00.0, -1);
        
ShowSyncHudMsg(idgiSyncObj"PRESS E TO DONATE");
    }
}

public 
EvStatusValueHide(id)
{
    if (
donateEnabled)
        
ClearSyncHud(idgiSyncObj);
}

public 
OnUseKeyPress(id handle)
{
    if (!
donateEnabled)
        return 
FMRES_IGNORED;

    static 
buttonoldbuttonstargetbodyPart;

    
button pev(idpev_button); // buttons in current frame
    
oldbuttons pev(idpev_oldbuttons); // buttons in previous frame

    
if(oldbuttons IN_USE && !(button IN_USE))
    {
        
// is_user_connected -> to check whether target id is a player.
        
if (get_user_aiming(idtargetbodyPart) != && is_user_connected(target)) {
            
gCurrentDntReceiverId target;
            
ShowDonateMenu(id);
        }
    }

    return 
FMRES_IGNORED;
}

public 
ShowDonateMenu(id)
{        
        new 
donorMoney cs_get_user_money(id);
        if (
donorMoney 100) {
            
client_print_col(id"^x04not enough money");
            return 
PLUGIN_HANDLED;
        }

        
get_user_name(gCurrentDntReceiverIdgCurrentDntReceiverName31);
        
strtoupper(gCurrentDntReceiverName);
        new 
menuTitle[73];
        
formatex(menuTitle72"[MENU]^ndonate to \r%s"gCurrentDntReceiverName);
    
        if (
menu != 0) {
            
menu_destroy(menu);
        }
        
        
menu menu_create(menuTitle"donateMenu");

        
menu_additem(menu"100");

        new 
menuCount donorMoney 500;
        for (new 
1<= menuCount && 6i++) {
            new 
menuItemText[5];
            
num_to_str(500 imenuItemText4);
            
menu_additem(menumenuItemText);
        }
        
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
        
menu_setprop(menuMPROP_EXITNAME"Exit");
    
menu_setprop(menuMPROP_NOCOLORS1);

    
menu_display(idmenu0);

    return 
PLUGIN_HANDLED;
}

public 
donateMenu(idmenuitem)
{
        if(
item == MENU_EXIT)
    {
        
menu_cancel(id);
        return 
PLUGIN_HANDLED;
    }

        
//new strr[30];
        //num_to_str(gCurrentDntReceiverId, strr, 29);
        //client_print(id, print_chat, strr);

    
static accessinfo[1], callback;
    
menu_item_getinfo(menuitemaccessinfo0__callback);

        new 
valToDonate item 500 item 100;
        new 
donorMoney cs_get_user_money(id);

        if (
valToDonate donorMoney) {
            
client_print_col(id"^x04not enough money");
        }
        else {

            new 
recvrMoney cs_get_user_money(gCurrentDntReceiverId);

            if (
recvrMoney valToDonate 16000) {
                
valToDonate 16000 recvrMoney;
            }
            
            if (
valToDonate 0) {
               
cs_set_user_money(iddonorMoney valToDonate);
               
cs_set_user_money(gCurrentDntReceiverIdrecvrMoney valToDonate);
               new 
szMessage[195];
               
formatex(szMessage194"%d were donated to %s!"valToDonategCurrentDntReceiverName);
               
client_print_col(idszMessage);
            }
            else {
                
client_print_col(id"^x04he has already got 16.000!");
            }
        }

    
menu_destroy(menu);
        
menu 0;
    return 
PLUGIN_HANDLED;
}

public 
EventNewRound()
{
    
donateEnabled true;
}

public 
EventRoundStart()
{
    
donateEnabled false;


cs_set_user_money(idiMoneyiFlash 1)
{
    
set_pdata_int(idOFFSET_MONEYiMoney);

    
engfunc(EngFunc_MessageBeginMSG_ONE_UNRELIABLEgMsgMoney, {000}, id);
    
write_long(iMoney);
    
write_byte(iFlash 0);    // Flash (difference between new and old money)
    
message_end();
}

client_print_col(id,msg[]) { 
    
message_begin(MSG_ONEget_user_msgid("SayText"), _id);
    
write_byte(id);
    
write_string(msg);
    
message_end();

Your code was very on point, I must say.

Last edited by wizzar; 01-13-2025 at 18:17.
wizzar is offline
Tote
Senior Member
Join Date: Jul 2023
Old 01-13-2025 , 18:39   Re: script to more easily donate money
Reply With Quote #4

Quote:
Originally Posted by wizzar View Post
Thanks. I spent the day going through this, and this is what I came up with:

PHP Code:
#include <amxmodx>
#include <fakemeta>

#pragma semicolon 1
#define OFFSET_MONEY        115
#define cs_get_user_money(%1)    get_pdata_int(%1,OFFSET_MONEY)

new const PLUGIN[] = "Aim Notify";
new const 
VERSION[] = "1.0";
new const 
AUTHOR[] = "YourName";
new 
giSyncObj;
new 
gMsgMoney;
new 
gCurrentDntReceiverId;
new 
gCurrentDntReceiverName[32];
new 
menu 0;
new 
donateEnabled false;

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);

    
//looking at a player
    
register_event("StatusValue""EvStatusValueShowPlayerInfo""b""1=2""2>0");
    
    
//stoped looking
    
register_event("StatusValue""EvStatusValueHide""be""1=1""2=0");

    
giSyncObj CreateHudSyncObj();

    
register_forward(FM_CmdStart "OnUseKeyPress");

    
gMsgMoney get_user_msgid("Money");

    
register_event("HLTV""EventNewRound""a""1=0""2=0");
    
register_logevent("EventRoundStart"2"1=Round_Start");
}

public 
EvStatusValueShowPlayerInfo(id)
{
    if (
donateEnabled) {    
        
set_hudmessage(2551700, -1.0, -1.000.015.00.00.0, -1);
        
ShowSyncHudMsg(idgiSyncObj"PRESS E TO DONATE");
    }
}

public 
EvStatusValueHide(id)
{
    if (
donateEnabled)
        
ClearSyncHud(idgiSyncObj);
}

public 
OnUseKeyPress(id handle)
{
    if (!
donateEnabled)
        return 
FMRES_IGNORED;

    static 
buttonoldbuttonstargetbodyPart;

    
button pev(idpev_button); // buttons in current frame
    
oldbuttons pev(idpev_oldbuttons); // buttons in previous frame

    
if(oldbuttons IN_USE && !(button IN_USE))
    {
        
// is_user_connected -> to check whether target id is a player.
        
if (get_user_aiming(idtargetbodyPart) != && is_user_connected(target)) {
            
gCurrentDntReceiverId target;
            
ShowDonateMenu(id);
        }
    }

    return 
FMRES_IGNORED;
}

public 
ShowDonateMenu(id)
{        
        new 
donorMoney cs_get_user_money(id);
        if (
donorMoney 100) {
            
client_print_col(id"^x04not enough money");
            return 
PLUGIN_HANDLED;
        }

        
get_user_name(gCurrentDntReceiverIdgCurrentDntReceiverName31);
        
strtoupper(gCurrentDntReceiverName);
        new 
menuTitle[73];
        
formatex(menuTitle72"[MENU]^ndonate to \r%s"gCurrentDntReceiverName);
    
        if (
menu != 0) {
            
menu_destroy(menu);
        }
        
        
menu menu_create(menuTitle"donateMenu");

        
menu_additem(menu"100");

        new 
menuCount donorMoney 500;
        for (new 
1<= menuCount && 6i++) {
            new 
menuItemText[5];
            
num_to_str(500 imenuItemText4);
            
menu_additem(menumenuItemText);
        }
        
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
        
menu_setprop(menuMPROP_EXITNAME"Exit");
    
menu_setprop(menuMPROP_NOCOLORS1);

    
menu_display(idmenu0);

    return 
PLUGIN_HANDLED;
}

public 
donateMenu(idmenuitem)
{
        if(
item == MENU_EXIT)
    {
        
menu_cancel(id);
        return 
PLUGIN_HANDLED;
    }

        
//new strr[30];
        //num_to_str(gCurrentDntReceiverId, strr, 29);
        //client_print(id, print_chat, strr);

    
static accessinfo[1], callback;
    
menu_item_getinfo(menuitemaccessinfo0__callback);

        new 
valToDonate item 500 item 100;
        new 
donorMoney cs_get_user_money(id);

        if (
valToDonate donorMoney) {
            
client_print_col(id"^x04not enough money");
        }
        else {

            new 
recvrMoney cs_get_user_money(gCurrentDntReceiverId);

            if (
recvrMoney valToDonate 16000) {
                
valToDonate 16000 recvrMoney;
            }
            
            if (
valToDonate 0) {
               
cs_set_user_money(iddonorMoney valToDonate);
               
cs_set_user_money(gCurrentDntReceiverIdrecvrMoney valToDonate);
               new 
szMessage[195];
               
formatex(szMessage194"%d were donated to %s!"valToDonategCurrentDntReceiverName);
               
client_print_col(idszMessage);
            }
            else {
                
client_print_col(id"^x04he has already got 16.000!");
            }
        }

    
menu_destroy(menu);
        
menu 0;
    return 
PLUGIN_HANDLED;
}

public 
EventNewRound()
{
    
donateEnabled true;
}

public 
EventRoundStart()
{
    
donateEnabled false;


cs_set_user_money(idiMoneyiFlash 1)
{
    
set_pdata_int(idOFFSET_MONEYiMoney);

    
engfunc(EngFunc_MessageBeginMSG_ONE_UNRELIABLEgMsgMoney, {000}, id);
    
write_long(iMoney);
    
write_byte(iFlash 0);    // Flash (difference between new and old money)
    
message_end();
}

client_print_col(id,msg[]) { 
    
message_begin(MSG_ONEget_user_msgid("SayText"), _id);
    
write_byte(id);
    
write_string(msg);
    
message_end();

Your code was very on point, I must say.
After spending the day the thing you came up with, is very on point, I must say.
Tote is offline
wizzar
Member
Join Date: Dec 2009
Old 01-13-2025 , 19:34   Re: script to more easily donate money
Reply With Quote #5

I can't find a definitive answer on whether I should be using register_forward(FM_CmdStart , "CmdStart") or client_PreThink to capture the IN_USE. Which one do you think performs better?
wizzar is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 01-13-2025 , 21:07   Re: script to more easily donate money
Reply With Quote #6

Hello, I've been using this method in my own PUG System, you probably saw it in the server you mentioned and I've decided to cut it for you to use. The method to detect USE button is up to you to decide. I also didn't test.

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN             "Donation System"
#define VERSION             "1.0"
#define AUTHOR             "author"

#define isOnTeam(%1)         (1 <= get_user_team(%1) <= 2)

#define TASK_BUYTIME_END    31331

new const g_iDonateOptions[] =
{
    
500,
    
1000,
    
1500,
    
2000,
    
3000
}

new const 
g_szChatPrefix[] = "^x04[Donation]^x01"

new g_iDonateTarget[MAX_PLAYERS 1]
new 
g_iDonationAmmount[MAX_PLAYERS 1]
new 
g_iCustomDonateValue[MAX_PLAYERS 1]

new 
bool:g_bBuytimeEnded

new pCvarMaxDonations

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
pCvarMaxDonations register_cvar("max_donate""5000")

    
register_clcmd("donate_money""cmdDonation")
    
    
register_logevent("logEvent_StartRound"2"1=Round_Start")
    
    
register_event("HLTV""event_NewRound""a""1=0""2=0")
    
    
register_forward(FM_EmitSound"forward_EmitSound")
    
    
RegisterHam(Ham_Spawn"player""ham_playerSpawn_post"1)
}

public 
event_NewRound()
{    
    
remove_task(TASK_BUYTIME_END)
    
g_bBuytimeEnded false
}

public 
logEvent_StartRound()
{        
    
set_task((get_pcvar_float(get_cvar_pointer("mp_buytime")) * 10.0) + get_pcvar_float(get_cvar_pointer("mp_freezetime")), "buytimeEnd"TASK_BUYTIME_END)
}

public 
buytimeEnd() g_bBuytimeEnded true

public ham_playerSpawn_post(id)
{
    
g_iDonationAmmount[id] = 0
}

public 
forward_EmitSound(iEntchannel, const szSample[])
{
    if(!
equal(szSample"common/wpn_denyselect.wav") || !is_user_alive(iEnt)) 
        return 
FMRES_IGNORED
    
    
new iTargetiBody
    get_user_aiming
(iEntiTargetiBody)
    if(
is_user_alive(iTarget) && (get_user_team(iEnt) == get_user_team(iTarget)))
    {
        
openDonateMenu(iEntiTarget)
        return 
FMRES_SUPERCEDE
    
}
    return 
FMRES_IGNORED
}

openDonateMenu(idiTarget)
{
    
g_iDonateTarget[id] = iTarget
    g_iCustomDonateValue
[id] = 0
    
    
new iMenu menu_create("Donation Menu""player_donate_handler")
    for(new 
i;sizeof g_iDonateOptions;i++)
    {
        
menu_additem(iMenufmt("%d"g_iDonateOptions[i]))
    }
    
menu_additem(iMenu"\yChoose value")
    
menu_display(idiMenu)
}

public 
player_donate_handler(idiMenuiItem)
{
    if((
iItem == MENU_EXIT) || !isOnTeam(id))
    {
        
menu_destroy(iMenu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
iTarget g_iDonateTarget[id]
    if(!
is_user_connected(iTarget) || !isOnTeam(iTarget))
    {
        
client_print_color(idid"%s Invalid player"g_szChatPrefix)
        
menu_display(idiMenu)
        return 
PLUGIN_HANDLED
    
}
    
    if(
iItem <= charsmax(g_iDonateOptions))
    {
        
g_iCustomDonateValue[id] = g_iDonateOptions[iItem]
        
cmdDonation(id)
    }
    else
    {
        
client_cmd(id"messagemode donate_money")
    }
    return 
PLUGIN_HANDLED
}

public 
cmdDonation(id)
{
    new 
szMessage[50]
    
read_args(szMessagecharsmax(szMessage))
    
remove_quotes(szMessage)
    
trim(szMessage)

    if(
g_bBuytimeEnded)
    {
        
client_print_color(idid"%s Buytime ended, wait for a new round to start."g_szChatPrefix)
        return 
PLUGIN_HANDLED
    
}
    
    new 
iPlayer g_iDonateTarget[id]
    if(!
is_user_connected(iPlayer))
    {
        
client_print_color(idid"%s Invalid player"g_szChatPrefix)
        return 
PLUGIN_HANDLED
    
}
    
    if(
g_iDonationAmmount[iPlayer] >= get_pcvar_num(pCvarMaxDonations))
    {
        
client_print_color(idid"%s Max donation per round reached."g_szChatPrefix)
        return 
PLUGIN_HANDLED
    
}
    
    new 
iValue g_iCustomDonateValue[id] ? g_iCustomDonateValue[id] : str_to_num(szMessage)
    if((
iValue <= 0) | (cs_get_user_money(id) < iValue))
    {
        
client_print_color(idid"%s Invalid ammount."g_szChatPrefix)
        return 
PLUGIN_HANDLED
    
}
    
    if((
g_iDonationAmmount[iPlayer] + iValue) > get_pcvar_num(pCvarMaxDonations))
    {
        
client_print_color(idid"%s Invalid ammount, this user can only receive more^x04 %d$"g_szChatPrefix, (get_pcvar_num(pCvarMaxDonations) - g_iDonationAmmount[iPlayer]))
        return 
PLUGIN_HANDLED
    
}
    
    
g_iCustomDonateValue[id] = 0
    g_iDonationAmmount
[iPlayer] += iValue
    
    cs_set_user_money
(id, (cs_get_user_money(id) - iValue))
    
cs_set_user_money(iPlayer, (cs_get_user_money(iPlayer) + iValue))
    
    new 
iPlayers[MAX_PLAYERS], iNum
    get_players
(iPlayersiNum"eh", (get_user_team(id) == 1) ? "TERRORIST" "CT")
    for(new 
i;iNum;i++)
    {
        
client_print_color(idid"%s Player %n donated %d$ to %n"g_szChatPrefixidiValueiPlayer)
    }
    return 
PLUGIN_HANDLED

You may also apply rules like blocking this donation to work in first rounds, otherwise it would be possible for people to buy rifles by receiving donations.
__________________
• AutoMix 5vs5 System + Web Stats
• 5vs5 [AUTO-MIX/PUG] servers
• Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 01-13-2025 at 21:11.
EFFx is offline
wizzar
Member
Join Date: Dec 2009
Old 01-13-2025 , 23:08   Re: script to more easily donate money
Reply With Quote #7

Thanks EFFx, I will take a look.

For some reason, in my server (AMX 1.10) the line
PHP Code:
oldbuttons IN_USE && !(button IN_USE
does not work (never enters de if, always false), the condition is never satisfied. However, it does work locally. Any ideas?

Last edited by wizzar; 01-13-2025 at 23:08.
wizzar is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-14-2025 , 00:30   Re: script to more easily donate money
Reply With Quote #8

Avoid any of the "think" functions if at all possible. The think functions are called way more often than is relevant to key presses. Using FM_CmdStart, is much better than using any of the think functions because this is only called when a command is sent by the player (effectively).

EDIT: I just installed the latest version of 1.10.0 and the button press works fine on my standalone HLDS that I run on my computer. What do you mean by "my server" and "locally"? Are you using a standalone HLDS, the Steam Dedicated Server, or a listen server (pressing "New Game")?

To do my test, I created a simple plugin to test just the +use key:

PHP Code:
#include <amxmodx>
#include <fakemeta>

public plugin_init() 
{
    
register_plugin("Test +use""0.1""me");
    
register_forwardFM_CmdStart "CmdStart" );
}

public 
CmdStartid uc_handle seed 
{
    static 
Buttons OldButtons;
    
    
Buttons get_ucuc_handle UC_Buttons );
    
OldButtons pevid pev_oldbuttons );
    
    if( ( !( 
OldButtons IN_USE ) && ( Buttons IN_USE ) ) )
    {
        
client_printid print_chat "use pressed" );
    }
    else if( 
OldButtons IN_USE && !(Buttons IN_USE) )
    {
        
client_print(idprint_chat"use released");
    }

__________________

Last edited by fysiks; 01-14-2025 at 01:38.
fysiks is offline
wizzar
Member
Join Date: Dec 2009
Old 01-14-2025 , 11:07   Re: script to more easily donate money
Reply With Quote #9

Thanks fysiks.
I mean it works if I test it on a "new game" server, but it doesn't work when I upload it to my online server.

I noticed you and Bugsy used a slightly (albeit important) different code to read the buttons present state:

Me:
PHP Code:
button pev(idpev_button); 
You:
PHP Code:
button get_uc(handleUC_Buttons); 
I changed it, and it is working now. I tried to figure out why, but I couldn't.
I noticed that the menu is entirely red too on my online server, but on my local server only the numbers are red and the option text is white, as it should. I really am not experienced with amxx to figure out why, but I can say I would go insane if I had to work with a language that had this behavior haha.

Anyway, thanks a bunch.

Edit: my local server runs on windows without hlds, while my online server runs on linux with hlds. Mybe that's why.

Last edited by wizzar; 01-14-2025 at 11:39.
wizzar is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-14-2025 , 22:09   Re: script to more easily donate money
Reply With Quote #10

If you’re using FM_CmdStart then it makes no sense to not use the uc handle for buttons..why did you bother changing it to pev_buttons? It’s likely that when CmdStart fires, the players buttons have not yet been set in pev_buttons.
__________________

Last edited by Bugsy; 01-14-2025 at 22:18.
Bugsy is online now
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:18.


Powered by vBulletin®
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Theme made by Freecode