my commands..
PHP Code:
CMD:invite(playerid, params[])
{
if(PlayerInfo[playerid][pFacleader] > 0 || PlayerInfo[playerid][pFacrank] >= 5)
{
new tarid, facid;//establishes a player in the server and a faction id for you to type in
if(sscanf(params, "u", tarid)) return SendClientMessage(playerid, COLOR_RED, "{0033cc}FACTION:Използвайте: /invite [playerid]");//if the command is not typed correctly, it will show you the correct way to use the command.
facid = PlayerInfo[playerid][pFaction];//sets the faction the player is being invited to, as the faction the player that is inviting is in.
SetPVarInt(tarid, "invitefac", facid);//saves the invite, to /accept it
SendClientMessage(tarid, COLOR_GREEN, "{0033cc}FACTION:Вие получихте покана за банда/мафия , използвайте /acceptinvite за да я приемете!");//tells you that you have been invited to a faction
}
else //if you're not the correct rank it will display the message below stating that the player is not the rank to invite
{
SendClientMessage(playerid, COLOR_RED, "{0033cc}FACTION:Вие трябва да сте 5 ранг за да може да инвийтвате");
}
return 1;
}
CMD:acceptfaction(playerid, params[])
{
new facid, string[128];//creates a faction id and some text on the players screen
facid = GetPVarInt(playerid, "invitefac");//calls the saved invite from the previous command
PlayerInfo[playerid][pFaction] = facid; //sets the players faction to that of the person inviting.
PlayerInfo[playerid][pFacrank] = 1;//sets the players faction rank to 1
format(string, sizeof(string), "FACTION:Вие приехте предложението за влизане в банда %d", facid);//tells the player they have accepted the faction invite
SendClientMessage(playerid, COLOR_CYAN, string);//shows the above message in the color of CYAN
DeletePVar(playerid, "invitefac");//deletes the saved invite
return 1;
}