SA-MP Forums Archive
Little Help +Rep - 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: Little Help +Rep (/showthread.php?tid=378126)



Little Help +Rep - Nirzor - 16.09.2012

can some-one give me the codes

Код:
#define SOLDIER 1
#define SNIPER 2
#define AGENT 3
#define MECHANIC 4
#define MEDIC 5
#define SPECIAL_AGENT 6
these are my 6 classes now i want AGENT to drive hydra and sea sparrow only and Mechanic tank only

and Special_Agent will have access to all tank and hydra and sea sparrow can some-one give me the codes

to make that system plz


Re: Little Help +Rep - AtItsMax - 16.09.2012

pawn Код:
new PickedClass[MAX_PLAYERS];
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(PickedClass != AGENT && GetVehicleModel(vehicleid) == hydra id here)
    {
        ClearAnimations(playerid);
        SendClientMessage(playerid, -1, "[*]: You should be Agent in order to drive hydra!");
    }
return 1;
}
This is an example, you can do other's this way.


Re: Little Help +Rep - Nirzor - 16.09.2012

i can't do like this some-one has to show me whole code so i can learn from it so next time i can do myself


Re: Little Help +Rep - diego_p11 - 16.09.2012

Ok, i will use atltsmax' script as an example.

new PickedClass[MAX_PLAYERS]; (here, it checks if its in a class)
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) (here it makes the server check that the player has entered a vehicle)
{
* * if(PickedClass != AGENT && GetVehicleModel(vehicleid) == hydra id here) (here it checks if the player is with the correct class to use the vehicle (on where is says "hydra id here" you place the id of the vehicle the player is supposed to use))
* * {
* * * * ClearAnimations(playerid); (and here if the player dont completes with the requirements to use the vehicles, gets ejected from it)
* * * * SendClientMessage(playerid, -1, "[*]: You should be Agent in order to drive hydra!"); (and finally here, sends a message to the player saying him which class he has to be to use that vehicle)
* * }
return 1; (at the end, it shows to the server that is a valid action, and to make it work on your server)
}

Hopw i helped you, if I did give me rep