24.09.2016, 15:53
PHP код:
CMD:invite(playerid, params[])
{
new id, giveplayerid, splayer[25];
if(gLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_ERROR, "Tu nu esti logat si nu poti sa folosesti aceasta comanda!");
if(PlayerInfo[playerid][pLeader] == 0) return SendClientMessage(playerid, COLOR_ERROR, "You don't have leader.");
if(sscanf(params,"s[25]", splayer)) return SendClientMessage(playerid, COLOR_SYN, "Sintaxa:{FFFFFF} /invite <Player ID/Name>");
new membrii = GetFactionMembers(PlayerInfo[playerid][pMember]);
printf("membrii = %d and fMaxMembers = %d", membrii, DynamicFactions[PlayerInfo[playerid][pMember]][fMaxMembers]);
if(membrii >= DynamicFactions[PlayerInfo[playerid][pMember]][fMaxMembers]) return SendClientMessage(playerid, COLOR_LIGHTRED, "You have reached maximum faction members.");
if(PlayerInfo[id][pLevel] < DynamicFactions[PlayerInfo[playerid][pMember]][fMinLevel])
{
format(gString,sizeof(gString),"Pentru a invita un membru in aceasta factiune acesta trebuie sa aiba minim level %d.",DynamicFactions[PlayerInfo[playerid][pMember]][fMinLevel]);
SendClientMessage(playerid, COLOR_LIGHTRED, gString);
return 1;
}
if(GetPlayers(splayer) == INVALID_PLAYER_ID) return InvalidPlayer(playerid);
else if(GetPlayers(splayer) == 1000) return ToManyResults(playerid);
else if(GetPlayers(splayer) == 1001) return ShowResults(playerid, splayer);
else giveplayerid = GetPlayers(splayer);
if(giveplayerid == playerid) return SendClientMessage(playerid, COLOR_ERROR, "You cannot invite yourself.");
if(PlayerInfo[giveplayerid][pMember] + PlayerInfo[giveplayerid][pLeader] != 0 || PlayerInfo[giveplayerid][pFPunish] > 0) return SendClientMessage(playerid, COLOR_ERROR, "Player is already in a faction/has faction punish.");
InviteOffer[giveplayerid][playerid] = PlayerInfo[playerid][pLeader];
format(gString, sizeof(gString), "L-ai invitat pe %s sa se alature factiunii tale.",GetName(giveplayerid));
SendClientMessage(playerid, COLOR_SYN2, gString);
format(gString, sizeof(gString), "Liderul %s te-a invitat sa te alaturi %s, scrie (/accept invite %d) ca sa accepti.",GetName(playerid),FactionName[PlayerInfo[playerid][pLeader]],playerid);
SendClientMessage(giveplayerid, COLOR_SYN2, gString);
return 1;
}