Command /invite
#2

pawn Код:
CMD:invite(playerid, params[])
{
    if (PlayerInfo[playerid][pLeader] >= 1)
    {
        new string[128], ftext[50], giveplayerid;
        if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /invite [playerid]");

        if(IsPlayerConnected(giveplayerid))
        {
            if (PlayerInfo[giveplayerid][pLeader] == 0 && PlayerInfo[giveplayerid][pMember] == 0 && PlayerInfo[giveplayerid][pFMember] == 255)
            {
                if(PlayerInfo[playerid][pLeader] == 1) { ftext = "Police"; }
                else if(PlayerInfo[playerid][pLeader] == 2) { ftext = "Medic"; }
                else if(PlayerInfo[playerid][pLeader] == 3) { ftext = "SANews"; }
                else { return 1; }
                InviteOffer[giveplayerid] = playerid;
                InviteFamily[giveplayerid] = 255;
                InviteFaction[giveplayerid] = PlayerInfo[playerid][pLeader];
                format(string, sizeof(string), "You have been invited to join the %s by %s - type /accept faction.", ftext, GetPlayerNameEx(playerid));
                SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
                format(string, sizeof(string), "You have invited %s to join the %s.", GetPlayerNameEx(giveplayerid),ftext);
                SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
            }
            else
            {
                SendClientMessageEx(playerid, COLOR_GREY, "The player you're trying to invite is already in another faction or family.");
                return 1;
            }

        }
    }
    else
    {
        SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command - only leaders can do this.");
    }
    return 1;
}
Reply


Messages In This Thread
Command /invite - by Andriuks52 - 04.07.2014, 08:56
Re: Command /invite - by Max5 - 04.07.2014, 10:35
Re: Command /invite - by Andriuks52 - 04.07.2014, 12:49
Re: Command /invite - by Andriuks52 - 04.07.2014, 13:03
Re: Command /invite - by Andriuks52 - 04.07.2014, 18:48
Re: Command /invite - by SHE790 - 04.07.2014, 18:59
Re: Command /invite - by Andriuks52 - 04.07.2014, 19:43
Re: Command /invite - by Andriuks52 - 05.07.2014, 12:24
Re: Command /invite - by Max5 - 05.07.2014, 12:29

Forum Jump:


Users browsing this thread: 1 Guest(s)