07.11.2014, 15:18
How would I make this command only usable by a rcon admin? Using it at the moment just gives me the message "You are not an admin!"
pawn Код:
CMD:createfaction(playerid, params[])
{
new id, number, string[100];
if(IsPlayerAdmin(playerid))
{
if(sscanf(params, "ui", id, number)) return SendClientMessage(playerid, -1, " USAGE: /createfaction [playerid] [Faction-Slot]");
if(FacInfo[number][fOwned]) return SendClientMessage(playerid, -1, "Faction slot ID is already taken!");
if(number == 0) return SendClientMessage(playerid, COLOR_GREY, "That faction number is invalid - Slots: 1-20.");
if(PlayerInfo[playerid][pOwner])
FacInfo[number][fMembers]++;
FacInfo[number][DAccess] = 0;
FacInfo[number][GovAccess] = 0;
FacInfo[number][NewsAccess] = 0;
PlayerInfo[id][pFacLeader] = 1;
PlayerInfo[id][pFacRank] = 10;
PlayerInfo[id][pFac] = number;
format(string, sizeof(string), "Admin %s has given you leadership of faction id %d. (/fhelp)", GetName(playerid), number);
SendClientMessage(id, -1, string);
format(string, sizeof(string), "You have given %s leadership of faction id %d.", GetName(id), number);
SendClientMessage(playerid, -1, string);
}
else
{
SendClientMessage(playerid, -1, "You are not an admin!");
return 1;
}
return 1;
}