02.09.2012, 06:29
PHP код:
CMD:removefromfaction(playerid, params[]) //Format to create a command
{ //Open bracket
new targetid, targetname[24], playername[24], string[128]; //Create the variables
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "Usage: /removefromfaction [playerid/partofname]"); //Sends message if they do not type something in for the targetid/name
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "Invalid playerid!"); //Sends a message if the player isn't connected
if(!IsPlayerAdmin(playerid) && pData[playerid][Rank] != 6) return SendClientMessage(playerid, -1, "You are not a high enough admin or you aren't the leader!"); //Sends a message if they aren't the leader of the faction and if they aren't admin
GetPlayerName(targetid, targetname, sizeof(targetname)); //Stores the targetid's name in the targetname variable
GetPlayerName(playerid, playername, sizeof(playername)); //Stores the playerid's name in the playername variable
format(string, sizeof(string), "You removed %s from his (now) previous faction!", targetname);//Formats the message that will be sent to you (the player)
SendClientMessage(playerid, -1, string);//Sends the message that is formatted above to the playerid in a random color
format(string, sizeof(string), "You were removed from your faction by %s!", playername);//Formats the message that will be sent to the targetid
SendClientMessage(targetid, -1, string);//Sends the message that is formatted above to the targetid in a random color
pData[targetid][Faction] = 0; //Sets their faction variable to 0 (civilian)
pData[targetid][Rank] = 0; //Sets their rank variable to 0 (no rank)
return 1; //Returns a value
}
PHP код:
pData[playerid][Faction] = factionid;
pData[playerid][Rank] = 6;