GetPlayerVehicleID(playerid); not working.
#1

I'm creating a menu, so when people get in certain cars, a menu pops up saying the car is avalible to buy.
Thing is when it enter the car, no menu pops up.
Heres my code:

THIS IS MY CAR // VEHICLE ID 45.
Код:
AddStaticVehicle(562,1979.7543,2059.4924,10.4803,180.4118,92,1); // ELEGY_CARSHOP   45
THIS IS MY MENU // new Menu:Elegy; is at the top of my script, yes.
Код:
Elegy = CreateMenu("Elegy", 2, 200.0, 100.0, 300.0, 300.0);
AddMenuItem(Elegy, 0, "Buy Car");
AddMenuItem(Elegy, 1, "$85000");
AddMenuItem(Elegy, 0, "Exit");
THIS IS 'OnPlayerEnterVehicle'
Код:
if (GetPlayerVehicleID(playerid) == 45)
{
TogglePlayerControllable(playerid, 0);
ShowMenuForPlayer(Elegy, playerid);
SetCameraBehindPlayer(playerid);
}
This doesn't seem to work, and i am out of idea's why this isnt working.
Hopefully someone could point me in the correct place where i must be going wrong.
Reply
#2

shoow the whole function that its in
Reply
#3

if you mean the OnPlayerEnterVehicle here it is :

Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	if (!ispassenger)
	{
		if (GetPlayerVehicleID(playerid) == 45)
		{
		  TogglePlayerControllable(playerid, 0);
		  ShowMenuForPlayer(Elegy, playerid);
		  SetCameraBehindPlayer(playerid);
		}
	}
	return 0;
}
Reply
#4

well put
new menu:Elegy;
at the top of the script cuz if there none menu nutin can be opened
but i guess u added new Elegy;
then just add the menu: to it
Reply
#5

Quote:
Originally Posted by Anwix
THIS IS MY MENU // new Menu:Elegy; is at the top of my script, yes.
This was my first post.
Reply
#6

hmm sry didn't see cuz u didn't post it in the pawncode
but i can't seem why it's not workin...
Reply
#7

i'll also add its not just the menu whats not working, its not freezing the player, or setting the camera behind him.
im really confused,
Reply
#8

Try this
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if (!ispassenger)
    {
        if (vehicleid==45){
          TogglePlayerControllable(playerid, 0);
          ShowMenuForPlayer(Elegy, playerid);
          SetCameraBehindPlayer(playerid);
          return 1;
        }
    }
    return 0;
}
Reply
#9

Quote:
Originally Posted by ۞●•λвнiиаv•●۞
Try this
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if (!ispassenger)
    {
        if (vehicleid==45){
          TogglePlayerControllable(playerid, 0);
          ShowMenuForPlayer(Elegy, playerid);
          SetCameraBehindPlayer(playerid);
          return 1;
        }
    }
    return 0;
}
thanks, but that didn't work unfortunatly.
Reply
#10

Now try this
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if (GetPlayerState(playerid)==PLAYER_STATE_DRIVER)
{
if (vehicleid==45){
  TogglePlayerControllable(playerid, 0);
  ShowMenuForPlayer(Elegy, playerid);
  SetCameraBehindPlayer(playerid);
  return 1;
}
}
return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)