CMD:makeadmin(playerid, params[])
{
new level;
if(PlayerInfo[playerid][pAdmin] >= 1337)
{
if(sscanf(params, "ud", receiverid, level) == 0)
{
if(IsPlayerConnected(receiverid))
{
PlayerInfo[receiverid][pAdmin] = level;
GetPlayerName(receiverid, ReceiverName);
format(str, sizeof(str), "You have set %s's Admin Level to %d", ReceiverName, PlayerInfo[receiverid][pAdmin]);
SendClientMessage(playerid, COLOR_YELLOW, str);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is not connected.");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /makeadmin [PlayerID/PartOfName] [Level (1 - 9999)]");
return 1;
}
}
return 1;
}
COMMAND:makeadmin(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 1337)
{
new level;
new Target;
if(!sscanf(params, "ui", Target, level))
{
if(IsPlayerConnected(Target))
{
PlayerInfo[Target][pAdmin] = level;
GetPlayerName(Target, ReceiverName);
format(str, sizeof(str), "You have set %s's Admin Level to %d", ReceiverName, PlayerInfo[Target][pAdmin]);
SendClientMessage(playerid, COLOR_YELLOW, str);
return 1;
}
else SendClientMessage(playerid, COLOR_GREY, " That player is not connected.");
}
else SendClientMessage(playerid, COLOR_GREY, "USAGE: /makeadmin [PlayerID/PartOfName] [Level (1 - 9999)]");
}
return 1;
}
CMD:makeadmin(playerid, params[])
{
new level;
if(PlayerInfo[playerid][pAdmin] >= 1337)
{
if(sscanf(params, "ud", receiverid, level)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /makeadmin [PlayerID/PartOfName] [Level (1 - 9999)]");
if(IsPlayerConnected(receiverid))
{
PlayerInfo[receiverid][pAdmin] = level;
GetPlayerName(receiverid, ReceiverName);
format(str, sizeof(str), "You have set %s's Admin Level to %d", ReceiverName, PlayerInfo[receiverid][pAdmin]);
SendClientMessage(playerid, COLOR_YELLOW, str);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is not connected.");
return 1;
}
}
return 1;
}
Originally Posted by SA-MP SSCANF Wiki Page
c - A character.
d, i - An integer. h, x - A hex number (e.g. a colour). f - A float. s - A string. z - An optional string. pX - An additional delimiter where X is another character. '' - Encloses a litteral string to locate. u - User, takes a name, part of a name or an id and returns the id if they're connected. |
#define COMMAND:%1(%2) \
forward cmd_%1(%2); \
public cmd_%1(%2)
#define CMD:%1(%2) \
COMMAND:%1(%2)
#define command(%1,%2,%3) \
COMMAND:%1(%2, %3)
#define cmd(%1,%2,%3) \
COMMAND:%1(%2, %3)
pawn Код:
|