SA-MP Forums Archive
Help please - 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)
+--- Thread: Help please (/showthread.php?tid=578208)



Help please - Montenegrian - 17.06.2015

How do i make an admin command with zcmd and sscanf to give player money


Re: Help please - GloomY - 17.06.2015

This is an example.

PHP код:
CMD:givemoney(playeridparams[]) { // zcmd
    
if(PlayerInfo[playerid][pAdmin] > 1337) { // edit admin level
        
new toplayerid,
              
amount;
        if (!
sscanf(params"ui"toplayeridamount)) // sscanf
         
{
              if(
toplayerid != INVALID_PLAYER_ID && Bit1_Get(g_PlayerLoggedtoplayerid) != 0) {
                
SafeGivePlayerMoney(toplayeridamount);
                
format(globalstringsizeof(globalstring), "AdmCmd: %s has spawned %s %d$ (/givemoney)",PlayerInfo[playerid][pDisplayName] ,PlayerInfo[toplayerid][pDisplayName], amount);
                
ABroadCast(COLOR_LIGHTRED,globalstring,1);
            }
              else 
SendClientMessage(playeridCOLOR_RED"The player is not connected!");
        }
        else 
SendClientMessage(playeridCOLOR_WHITE"Usage: /givemoney <playerid> <amount>");
    }
    else 
SendClientMessage(playeridCOLOR_RED"You don't have permission to use this command!");
    return 
1;