What to add?
#1

Hello, I'm using this clan system by COD. But I want to add the command /removeplayer [id] to take someone out of a clan if you are the person who created it but I don't know how to do it. Can someone show me how? Thank you!
Reply
#2

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;
}
Reply
#3

Quote:
Originally Posted by Jefff
Посмотреть сообщение
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;
}
And where do I place all that bro? +rep already
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)