I was going to find a tutorial on how to make a faction, and there are none. Let's get started.
If I wanted to add factions to my game mode, I would start by defining a variable:
pawn Код:
new Faction[MAX_PLAYERS];
What this will do is make room for each player to have this variable. Adding a player to the faction is easy:
So our player is now in Faction 1. What is Faction 1? Well, since you wanted a Mechanic, let's make him a Mechanic:
pawn Код:
new FactionName[32];
if(Faction[playerid] == 1)
{
FactionName = "Mechanic";
}
Here we simply defined a string variable and gave it some text. What we do with that text is up to you. Detecting if the player is in a certain faction (IE if Faction is something other than 0) is the simplest concept behind factions.
You also stated you were looking for a /badge command. That will be another variable like above, only we're going to be using a boolean:
pawn Код:
//Example
new bool:Badge[MAX_PLAYERS];
A boolean is either true or false. So if their badge is already off (set to false):
pawn Код:
if(Badge[playerid] == false)
{
SetPlayerColor(playerid, COLOR_BLUE);
return 1;
}
else
{
SetPlayerColor(playerid, COLOR_WHITE);
return 1;
}
Otherwise, set their player color to White, since they are no longer on duty.
The above scripts are incomplete and are only for examples.
Source: Personal Knowledge.