AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Solved [CSGO] Hi,there "get"/decrement/increment of m_iAccount (https://forums.alliedmods.net/showthread.php?t=301979)

Surprised 10-12-2017 13:40

[CSGO] Hi,there "get"/decrement/increment of m_iAccount
 
Hi, I am new to sourcepawn how can i:
-decrement/increment m_iAccount
-"get" int of m_iAccount

I want to make paid gravity for my deathrun server

Sorry for my english

Thanks -Surpised

Bobakanoosh 10-12-2017 14:31

Re: [CSGO] Hi,there "get"/decrement/increment of m_iAccount
 
What are you trying to use m_iAccount for?

Surprised 10-12-2017 14:40

Re: [CSGO] Hi,there "get"/decrement/increment of m_iAccount
 
For getting/decrementing/incrementing money.

Thanks for replaying to noob :D

Bacardi 10-12-2017 15:19

Re: [CSGO] Hi,there "get"/decrement/increment of m_iAccount
 
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



Surprised 10-12-2017 16:34

Re: [CSGO] Hi,there "get"/decrement/increment of m_iAccount
 
Thank you Bacardi, Its working!!
You learnt me a lot, again thank You :D


//topic to close///


All times are GMT -4. The time now is 10:49.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.