[Urgent] Dialog Help
#2

The OnPlayerEnterVehicle is called when a player presses Enter near a vehicle. If you use GetPlayerVehicleID in this callback it will return 0, because the player is not in a vehicle yet.

Solutions:

1) Instead of using OnPlayerEnterVehicle, use OnPlayerStateChange with newstate == PLAYER_STATE_DRIVER

2) Keep using OnPlayerEnterVehicle, but just use the "vehicleid" variable which is already defined in the callback

I would suggest 1, because it's better if the dialog shows up upon entering the vehicle. Also OnPlayerEnterVehicle could cause problems if the player cancels the entry.

And btw for future reference:
pawn Код:
new vehicle;
GetPlayerVehicleID(playerid);
This does not make any sense, since the result of GetPlayerVehicleID is not stored in "vehicle". Use this:

pawn Код:
new vehicle = GetPlayerVehicleID(playerid);
Reply


Messages In This Thread
[Urgent] Dialog Help - by zDevon - 19.01.2012, 22:49
AW: [Urgent] Dialog Help - by Rimeau - 19.01.2012, 22:57
Re: [Urgent] Dialog Help - by Vince - 19.01.2012, 23:09
Re: AW: [Urgent] Dialog Help - by zDevon - 19.01.2012, 23:13
AW: [Urgent] Dialog Help - by Rimeau - 19.01.2012, 23:22
Re: AW: [Urgent] Dialog Help - by zDevon - 19.01.2012, 23:32
AW: [Urgent] Dialog Help - by Rimeau - 19.01.2012, 23:42
Re: AW: [Urgent] Dialog Help - by zDevon - 19.01.2012, 23:49
Re: [Urgent] Dialog Help - by 2KY - 20.01.2012, 03:10

Forum Jump:


Users browsing this thread: 2 Guest(s)