25.11.2018, 20:37
I think that i've fixed your errors, but from what I can see, you aren't inviting the player but setting his faction and rank right away.
PHP Code:
ReturnFactionName(playerid)
{
new string[64];
switch(PlayerInfo[playerid][pFaction])
{
case 1: string = "State Police";
case 2: string = "Federal Security Directorate";
default: string = "Undentified";
}
return string;
}
CMD:invite(playerid, params[])
{
new id;
if(PlayerInfo[playerid][pFaction] < 1) return SendClientMessage(playerid, COLOR_RED, "You are not in a faction");
if(sscanf(params,"u", id)) return SendClientMessage(playerid, -1,"USAGE: /invite [ID]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not connected!");
PlayerInfo[id][pFaction] = PlayerInfo[playerid][pFaction]; // This should be done after player accept the invite
PlayerInfo[id][pFacRanks] = 1; // As well as this
SendClientMessageEx(targetid, COLOR_AQUA, "%s has invited you to join the %s", ReturnName(playerid), ReturnFactionName(playerid));
SendClientMessageEx(playerid, COLOR_AQUA, "You have invited %s to %s", ReturnName(id), ReturnFactionName(playerid));
return 1;
}