PDA

View Full Version : Little Help +Rep


Nirzor
16/09/2012, 03:40 PM
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 ??? :D plz :D

AtItsMax
16/09/2012, 03:45 PM
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.

Nirzor
16/09/2012, 03:46 PM
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 :D

diego_p11
16/09/2012, 04:15 PM
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 :)