Posts: 2,593
Threads: 34
Joined: Dec 2007
CMD:
pawn Код:
if(!(0 < playerclan[playerid] < MAX_CLANS)) // you're not in clan
else if(clanMembers[playerclan[playerid]][0] != playerid) // you're not clan leader
else if(playerclan[playerid] != playerclan[giveplayerid]) // that player is not in your clan
else{
PlayerLeaveClan(giveplayerid,playerid);
}
+ replace old function PlayerLeaveClan to
pawn Код:
stock PlayerLeaveClan(playerid,kickerid = INVALID_PLAYER_ID)
{
new string[256];
new playername[MAX_PLAYER_NAME];
new kickername[MAX_PLAYER_NAME];
new clannum = playerclan[playerid];
if(clannum > 0)
{
for(new i = 0; i < clanInfo[clannum][1]; i++)
if(clanMembers[clannum][i] == playerid)
{
clanInfo[clannum][1]--;
for(new j = i; j < clanInfo[clannum][1]; j++)
clanMembers[clannum][j] = clanMembers[clannum][j+1];
if(clanInfo[clannum][1] < 1)
clanInfo[clannum][0] = clanInfo[clannum][1] = 0;
for(new j = 0; j < clanInfo[clannum][1]; j++)
{
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
if(kickerid == INVALID_PLAYER_ID)
format(string, sizeof(string),"%s has quit your clan.", playername);
else{
GetPlayerName(kickerid, kickername, MAX_PLAYER_NAME);
format(string, sizeof(string),"%s kicks from gang %s", kickername, playername);
}
SendClientMessage(clanMembers[clannum][j], COLOR_ORANGE, string);
}
if(kickerid == INVALID_PLAYER_ID)
format(string, sizeof(string),"You have quit the clan '%s' (id: %d)", clanNames[clannum], clannum);
else{
GetPlayerName(kickerid, kickername, MAX_PLAYER_NAME);
format(string, sizeof(string),"Clan leader %s kicks you from the gang", kickername);
}
SendClientMessage(playerid, COLOR_ORANGE, string);
playerclan[playerid] = 0;
SetPlayerColor(playerid,playerColors[playerid]);
return;
}
}else SendClientMessage(playerid, COLOR_RED, "You are not in a clan.");
return;
}