SA-MP Forums Archive
Enter the car when it locked? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Enter the car when it locked? (/showthread.php?tid=273108)



Enter the car when it locked? - whitedragon - 31.07.2011

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?


Re: Enter the car when it locked? - Calgon - 31.07.2011

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;
}



Re: Enter the car when it locked? - whitedragon - 31.07.2011

Not helping... i use 0.3c vehicle system.


Re: Enter the car when it locked? - Calgon - 31.07.2011

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


Re: Enter the car when it locked? - whitedragon - 31.07.2011

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



Re: Enter the car when it locked? - Calgon - 31.07.2011

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


Re: Enter the car when it locked? - TouR - 31.07.2011

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?


Re: Enter the car when it locked? - whitedragon - 31.07.2011

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