SA-MP Forums Archive
New way o payout - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: New way o payout (/showthread.php?tid=251544)



New way o payout - Panormitis - 27.04.2011

Hello world, here Is my Idea: I want to make a player for my server to get pay from a command, here is an excable, I have a command /lvtele ,when someone type this command, the player "Mathias" will take 200$ ( if he is online) , how make this? I have the command for the teleport, all I need is to make the player "Mathias" (excable) take money when someone type the command! Please help me with tha code! Thans!


Re: New way o payout - Sinner - 27.04.2011

I assume you want this for any player that uses the command? Not just players with the name "Mathias", right?

Here:
PHP Code:
OnPlayerCommandText(playeridcmdtext[])
{
    if(
strcmp(cmdtext"/lvtele"true)==0)
    {
        
//Teleport the player
        
GivePlayerMoney(playerid200);
        return 
1;
    }
    return 
0;

If not, here:

PHP Code:
OnPlayerCommandText(playeridcmdtext[])
{
    if(
strcmp(cmdtext"/lvtele"true)==0)
    {
        
//Teleport the player
        
        
new playername[24];
        for(new 
i=0i<MAX_PLAYERSi++)
        {
            if(
IsPlayerConnected(i))
            {
                
GetPlayerName(iplayernamesizeof(playername));
                if(
strcmp(playername"Mathias"true)==0)
                {
                     
GivePlayerMoney(i200);
                }
            }
        }
        return 
1;
    }
    return 
0;