Enter the car when it locked?
#1

Hi i'm making new car system but when i lock car and i want to be driver it won't call OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) but why?
Reply
#2

OnPlayerEnterVehicle is called when a player is preparing to enter a vehicle, so for example: when a player hits the 'F' key near-by a car.

You can use OnPlayerStateChange, this might be a more appropriate callback if you're forcing a player in to a car, or if you want it to call when they directly enter the vehicle instead of before.

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate) {
    if(newstate == 2 && oldstate != 2) {
        /* your code here */
        return 0;
    }
   
    return 0;
}
Reply
#3

Not helping... i use 0.3c vehicle system.
Reply
#4

That doesn't change anything. Try avoiding from returning anything other than 0 in OnPlayerStateChange for your other GMs/FSs.
Reply
#5

i use:
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(DoorsS[vehicleid])
    {
        return Error(playerid,"Car is Locked"),0;
    }
    return 1;
}
Reply
#6

oh I give up, you didn't even read what I posted.
Reply
#7

Quote:
Originally Posted by whitedragon
Посмотреть сообщение
i use:
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(DoorsS[vehicleid])
    {
        return Error(playerid,"Car is Locked"),0;
    }
    return 1;
}
I hope you just joking... Calgone try to help you why dont you read the stuff he wrote above? I think you wanted some help? He was clear OnPlayerEnterVehicle is called when the player opens the door of the car, whats so difficult to understand?
Reply
#8

I try what he write but i get same result. F key is not working...
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)