Scripting help.
#1

Hello SA-MP scripters,
I am here to ask you if someone could make a easy and detailed tutorial about scripting Factions and things such as gangs.

Regards.
Reply
#2

A faction is just a variable. Create variables and save/load them.
Such as Faction[MAX_PLAYERS] and Rank[MAX_PLAYERS], and maybe even Division[MAX_PLAYERS].
Reply
#3

Or you can use Enumations.

pawn Код:
enum pInfo
{
       pRank,
       pLeader
}

new PlayerInfo[MAX_PLAYERS][pInfo];
Reply
#4

^ Then you can use if statements or switches to determine whether they are or are not in a faction.

Like so:

pawn Код:
if(PlayerInfo[playerid][pFaction] == 1 && PlayerInfo[playerid][pRank] == 6) //Lets say faction 1 is LSPD and they are leader (rank 6)
{
    //What happens if they are in the LSPD
}
else return SendClientMessage(playerid, -1, "You are not in that faction!");

//Or

switch(PlayerInfo[playerid][pFaction])
{
    case 1: //LSPD
    {
        //Do something here if they are LSPD
    }
    case 2: //Faction 2
    {
        //Do something here if they are in faction 2
    }
}
Reply
#5

Or you can look here http://forum.sa-mp.com/forumdisplay.php?f=70
Reply
#6

^ And then you can set their ranks.
pawn Код:
PlayerInfo[playerid][pRank] = 1; // Change 1 to whatever rank you want.
Reply
#7

I made this specifically because of your question:

http://forum.sa-mp.com/showthread.ph...87#post2052587
Reply
#8

Thanks all for your help. !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)