17.06.2015, 16:06
How do i make an admin command with zcmd and sscanf to give player money
CMD:givemoney(playerid, params[]) { // zcmd
if(PlayerInfo[playerid][pAdmin] > 1337) { // edit admin level
new toplayerid,
amount;
if (!sscanf(params, "ui", toplayerid, amount)) // sscanf
{
if(toplayerid != INVALID_PLAYER_ID && Bit1_Get(g_PlayerLogged, toplayerid) != 0) {
SafeGivePlayerMoney(toplayerid, amount);
format(globalstring, sizeof(globalstring), "AdmCmd: %s has spawned %s %d$ (/givemoney)",PlayerInfo[playerid][pDisplayName] ,PlayerInfo[toplayerid][pDisplayName], amount);
ABroadCast(COLOR_LIGHTRED,globalstring,1);
}
else SendClientMessage(playerid, COLOR_RED, "The player is not connected!");
}
else SendClientMessage(playerid, COLOR_WHITE, "Usage: /givemoney <playerid> <amount>");
}
else SendClientMessage(playerid, COLOR_RED, "You don't have permission to use this command!");
return 1;
}