Help please
#1

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

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;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)