Cannot enter a vehicle need level...
#1

How can i do if a player isn't level 2 he couldn't enter car id 451 A.k.a turismo?
Reply
#2

Did you have a variable for level?
Reply
#3

what do you mean?

i got em defined like this:

Код:
enum Level
{
 Lygis // this is level
 Patirtis... and so on
}
and then i got
Код:
new pLevel[MAX_PLAYERS][Level];
i tryed to do this car thingy but i made it somehow for every car
Reply
#4

in the public OnPlayerEnterVehicle:
pawn Код:
new Float:px, Float:py, Float:pz;
GetPlayerPos(playerid,px,py,pz);
if(TheWayYouGetThePlayerLevelGoesHere < 2) return SetPlayerPos(playerid,px,py,pz);
return 1;
replace TheWayYouGetThePlayerLevelGoesHere in the way you get the player's level.

Reply
#5

pawn Код:
//OnPlayerEnterVehicle
if(GetVehicleModel(vehicleid) == 451)
{
if(pLevel[playerid][Level] < 2) RemovePlayerFromVehicle(playerid)
}
Reply
#6

Код:
pLevel[playerid][Level] < 2)
lolz now thats wrong

it should be

pLevel[playerid][Lygis]

kk..
is it possible to lock a car for him instead of setting his pos?

btw i think ur code weirdo won't work i tryed it few mins ago. i enterd a car it displayed me a msg, but i still entered it lol.
Reply
#7

setting his pos will get him out of the car.
but if you want locking you can do AddVehicleParametersForPlayer one of the ID's is locked...
https://sampwiki.blast.hk/wiki/SetVehicleParamsForPlayer
to lock:
SetVehicleParamsForPlayer(GetPlayerVehicleID(playe rid),playerid,0,1);
Reply
#8

setting his pos only deletes the key enter when you pressed so it's like i press enter he runs for the car and then stops, p.s u didn't define the vehicles id :P
Reply
#9

public OnPlayerEnterVehicle:

Код:
if(GetPlayerVehicleID(playerid) == 451)
   {
      if(pLevel[playerid] == 2)
        {
           return 1;
        }
     else 
     SendClientMessage(playerid, COLOR_WHITE, "You have been removed from the vehicle, you need to be level 2."   RemovePlayerFromVehicle(playerid);
   }
OBS: Created from my head.
Reply
#10

I would like to say this one more time.
RemovePlayerFromVehicle, doesn't work in the "OnPlayerEnterVehicle" callback.
Because his not in the vehicle.
You would have to delay the "RemovePlayerFromVehicle(playerid);" with a timer.
Or use another callback.

*Hint: OnPlayerStateChange
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)