Errors i dont know how to fix
#5

Quote:
Originally Posted by PotH3Ad
Посмотреть сообщение
Give this a try, I made it a bit shorter, should be easier to add stuff now.
pawn Код:
if(!strcmp(cmd, "/invite", true))
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /invite [playerid/PartOfName]");

            giveplayerid = ReturnUser(tmp);
            if(PlayerInfo[playerid][pLeader] < 1 || PlayerInfo[playerid][pMember] < 1) return SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use that command (leaders only) !");
            if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "   This player is not connected!");
            if(PlayerInfo[giveplayerid][pMember] == 0 && PlayerInfo[giveplayerid][pLeader] == 0 && PlayerInfo[giveplayerid][pFMember] == 255 && PlayerInfo[giveplayerid][pFactionBanned] == 0)
            {
                new ftext[20];
                GetPlayerName(playerid, sendername, sizeof(sendername));
                GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                switch(PlayerInfo[playerid][pLeader])
                {
                    case 1: ftext = "Police Force";
                    case 2: ftext = "FBI";
                    case 3: ftext = "SASD";
                    case 4: ftext = "Firemen/Ambulance";
                    case 5: ftext = "National Guards";
                    case 6: ftext = "President";
                    case 7: ftext = "CIA";
                    case 8: ftext = "Hitman Agency";
                    case 9: ftext = "News Agency";
                    case 10: ftext = "Taxi Cab Company";
                    case 12: ftext = "Bounty Hunter";
                }
                format(string, sizeof(string), "* You have Invited %s to join the %s.", giveplayer, ftext);
                SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                format(string, sizeof(string), "* %s has invited you to join the %s, (type /accept faction) to accept.",sendername, ftext);
                SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
                FactionOffer[giveplayerid] = playerid;
            }
            else return SendClientMessage(playerid, COLOR_GREY, "That player is already in a Faction / Family, or is faction banned !");
        }
        return 1;
    }
Thanks it worked

but one qeustion

if(PlayerInfo[playerid][pLeader] < 1 || PlayerInfo[playerid][pMember] < 1) return SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use that command (leaders only) !");

does < 1 mean if you are higer then leader 1 ?
Reply


Messages In This Thread
Errors i dont know how to fix - by Dennis_Sanchez - 09.06.2011, 19:02
AW: Errors i dont know how to fix - by Julian12345 - 09.06.2011, 19:16
Re: Errors i dont know how to fix - by Dennis_Sanchez - 09.06.2011, 19:45
Re: Errors i dont know how to fix - by PotH3Ad - 09.06.2011, 19:48
Re: Errors i dont know how to fix - by Dennis_Sanchez - 10.06.2011, 08:52

Forum Jump:


Users browsing this thread: 3 Guest(s)