SA-MP Forums Archive
Scripting help. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Scripting help. (/showthread.php?tid=368606)



Scripting help. - Tamara - 13.08.2012

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.


Re: Scripting help. - Kindred - 14.08.2012

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].


Re : Scripting help. - Sandiel - 14.08.2012

Or you can use Enumations.

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

new PlayerInfo[MAX_PLAYERS][pInfo];



Re: Scripting help. - Kindred - 14.08.2012

^ 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
    }
}



Re: Scripting help. - StrangeLove - 14.08.2012

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


Re : Scripting help. - Sandiel - 14.08.2012

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



Re: Scripting help. - Kindred - 14.08.2012

I made this specifically because of your question:

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


Re: Scripting help. - Tamara - 14.08.2012

Thanks all for your help. !