View Single Post
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-12-2017 , 15:19   Re: [CSGO] Hi,there "get"/decrement/increment of m_iAccount
Reply With Quote #4

You can find money code samples by looking others plugin source code (*.sp)



I made this quick
PHP Code:


public void OnPluginStart()
{
    
RegConsoleCmd("sm_mycommand"command_callback);
}

public 
Action command_callback(int clientint arg)
{
    
// no arguments passed through command
    
if(arg 1)
    {
        
ReplyToCommand(client"[SM] Usage: sm_mycommand <value>");
        return 
Plugin_Handled;
    }

    
// client index 0 = command used from server console
    
if(client == 0)
    {
        
ReplyToCommand(client"[SM] Use this command in-game");
        return 
Plugin_Handled;
    }


    
// get command first argument
    
char text[20];
    
GetCmdArg(1textsizeof(text));

    
int value StringToInt(text// convert text to integer

    
int m_iAccount GetEntProp(clientProp_Send"m_iAccount"); // player money

    
PrintToChat(client"Your money %i, your first argument %i, final ammount %i"m_iAccountvaluem_iAccount+value);

    
SetEntProp(clientProp_Send"m_iAccount"m_iAccount+value);



    return 
Plugin_Handled// Prevent "unknow command" error in console

__________________
Do not Private Message @me

Last edited by Bacardi; 10-12-2017 at 15:20.
Bacardi is offline