[Tutorial] Snap on Auto ID faction
#1

1)Hello! Today I want to show you my first rabotu.Kak snap all machines go to the faction.
For example, I take a fraction Doctor
and any cars with ID 416,
Let's start

All new:
Код HTML:
new pFraction[MAX_PLAYERS];//Job Variable
In public OnPlayerConnect(playerid):
Код HTML:
pFraction[playerid] = 0;//None Job
All public:
Код HTML:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new newcar = GetPlayerVehicleID(playerid);
    if(newcar == 416) //
    {
        if(pFraction[playerid] == 0)//Doctor Job
        {
        
        }
        else
        {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, -1, "** You are not a doctor !");
        }
    }
    return 1;
}
2)Bind just the right car

All new:
Код HTML:
new car[2];//Your Massive Car
OnGameModeInit:
Код HTML:
car[0] = AddStaticVehicle(CARID, x, y, z, rotation, color1, color2);//Choose according to your settings
          car[1] = AddStaticVehicle(CARID, x, y, z, rotation, color1, color2);
And Sure Public:
Код HTML:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new newcar = GetPlayerVehicleID(playerid);
    if(newcar >= car[0] && newcar <= car[1]) //
    {
        if(Сondition)//True
        {
        //Code
        }
        else
        {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, -1, "** You can not go in the car !");
        }
    }
    return 1;
}
Thanks for watching,i made it.
P.S Sorry But English,i translate with ****** translater xDxD
Reply
#2

No comments
Reply
#3

Uhm, good? I g-guess?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)