30.10.2014, 12:01
hope this will give you some ideas
pawn Код:
new VehKeys[MAX_PLAYERS]; // we will have a player variable vehkeys which is based on the vehicle id
CMD:buyveh(playerid,params[])
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
VehKeys[playerid]=CreateVehicle(520, X, Y, Z, 82.2873, 0, 1, 60);// storing the vehicle id to the player variable
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(VehKeys[playerid]!=vehicleid)// this checks if the player have the keys to the vehicle hes about to enter
{
ClearAnimations(playerid);// this stops the player from entering the vehicle if he dont have the keys for the vehicle
SendClientMessage(playerid,-1,"you cant enter this car because you dont have the key to this vehicle");
}
else
{
SendClientMessage(playerid,-1,"You are the owner of this vehicle");
}
return 1;
}