17.12.2014, 12:29
simple use zcmd and sscanf for that
not tested
not tested
pawn Код:
CMD:setrank(playerid, params[])
{
new str[128], rank, lookupid;
if(PlayerInfo[playerid][pRank] == 6) // this command is for admins level 6 only
{
if(sscanf(params, "ui", lookupid, rank)) return SendClientMessage(playerid, -1, "Usage: /setrank <PlayerID/PlayerName> <Rank>");
format(str, sizeof(str), "Admin %s (ID:%d) has setted %s (ID:%d) Rank to (%d)",GetName(playerid), playerid, GetName(lookupid), lookupid, rank);
SendClientMessageToAll(-1, str);
pInfo[lookupid][pRank] = rank;
}
else
{
SendClientMessage(playerid, -1, "Sorry , you are not admin");
}
return 1;
}
CMD:sethealth(playerid, params[])
{
new str[128], Float:health, lookupid;
if(PlayerInfo[playerid][pRank] == 6) // this command is for admins level 6 only
{
if(sscanf(params, "uf", lookupid, health)) return SendClientMessage(playerid, -1, "Usage: /sethealth <PlayerID/PlayerName> <health>");
format(str, sizeof(str), "Admin %s (ID:%d) has setted %s (ID:%d) health to (%f)",GetName(playerid), playerid, GetName(lookupid), lookupid, health);
SendClientMessageToAll(-1, str);
SetPlayerHealth(lookupid, health);
}
else
{
SendClientMessage(playerid, -1, "Sorry , you are not admin");
}
return 1;
}
stock GetName(playerid) // use this stock
{
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
return PlayerName;
}