SA-MP Forums Archive
How to create a simple faction? - 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: How to create a simple faction? (/showthread.php?tid=345268)



How to create a simple faction? - Sting. - 24.05.2012

Now can someone show me how to create a faction? I searched and found some tutorials, but they don't make sense. Another one, a script which you just add your info, I don't want. I want to know how to create my very own faction from top to bottom! Can anyone help?


Re: How to create a simple faction? - Sting. - 25.05.2012

Anyone?


Re: How to create a simple faction? - iFederal - 25.05.2012

Tell me what commands do you prolly need in your faction?


Re: How to create a simple faction? - Faisal_khan - 25.05.2012

Step 1:
Define your teams and give them colours, like:
pawn Код:
#define RUSSIA          1
#define USA             2
.
.
.
so on
#define COLOR_RUSSIA        COLOR_BRIGHTRED
#define COLOR_USA           COLOR_LIGHTBLUE
.
.
.
so on
Step 2:
Add this :
pawn Код:
new gTeam[MAX_PLAYERS];
Step 3:
Add their skins under OnGameModeInit:
pawn Код:
AddPlayerClass(285,-334.5023,1535.5310,75.5625,181.2829,0,0,0,0,0,0); // Russian
    AddPlayerClass(287,213.3519,1867.2781,18.3741,359.5766,0,0,0,0,0,0); // United States
Step 4:
The under OnPlayerRequestClass do this:
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 268.4988,1884.0615,-30.0938);
    SetPlayerFacingAngle(playerid, 184.2539);
    SetPlayerCameraPos(playerid, 268.5090,1880.9513,-30.3906);
    SetPlayerCameraLookAt(playerid, 268.4988,1884.0615,-30.0938);
    SetPlayerTeamFromClass(playerid, classid);
    switch(classid)
    {
    case 0: GameTextForPlayer(playerid, "~r~RUSSIA", 5000, 3);
    case 1: GameTextForPlayer(playerid, "~b~USA", 5000, 3);
    }
    return 1;
}
This will show the name of the team when you are selecting skins.

Step 5:
The under OnPlayerRequestSpawn do this:
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    {
         SetPlayerToTeamColor(playerid);
    }
    return 1;
}

SetPlayerTeamFromClass(playerid, classid)
{
    if(classid == 0)
    {
        gTeam[playerid] = RUSSIA;
        GameTextForPlayer(playerid,"~r~Russia",6,1);
    }
    if(classid == 1)
    {
        gTeam[playerid] = USA;
        GameTextForPlayer(playerid,"~b~United States",13,1);
    }
}

SetPlayerToTeamColor(playerid)
{
    if(gTeam[playerid] == RUSSIA)
    {
        SetPlayerColor(playerid,COLOR_RUSSIA);
    }
    if(gTeam[playerid] == USA)
    {
        SetPlayerColor(playerid,COLOR_USA);
    }
}
This will Set the players colour to the team.

Hope you understand this.


Re: How to create a simple faction? - Sting. - 27.05.2012

@Faisal, I didn't ask "HOW TO CREATE GANGS/TEAMS", I asked how to create a simple faction.
The important commands and stuff I need are:
Making a leader, Saved in scriptfiles
How to create a simple command for a certain rank, etc.Member, Leader, Vice Leader.... (Ex. /heal can only be used by leader...)

That's what I need mostly.


Re: How to create a simple faction? - ReneG - 27.05.2012

This can ALL be done with y_ini, a shit ton of variables, and if statements. With all due respect, no one is going to sit here and spoon feed you such a large system. Go download some code and learn from it, or search for tutorials. I'm not being rude at all, just honest.