SA-MP Forums Archive
[Tutorial] Snap on Auto ID 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)
+---- Forum: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] Snap on Auto ID faction (/showthread.php?tid=560606)



Snap on Auto ID faction - SnoopDy - 29.01.2015

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


Re: Snap on Auto ID faction - SnoopDy - 29.01.2015

No comments


Re: Snap on Auto ID faction - Sime30 - 29.01.2015

Uhm, good? I g-guess?