OnPlayerPickUpPickup wants to Pickup every 5 seconds :S
#1

Hy Guys,
i have a problem when i enter the pickup from my housesystem it opens a menu. Now the menu all 5 seconds refresh because OnPlayerPickUpPickup sends every 5 seconds the message ShowMenuForPlayer...

Here the code:

Code:
public OnPlayerPickUpPickup(playerid, pickupid)
{
  if(GetHouseID(playerid) != -255)
  {
     TogglePlayerControllable(playerid, 0);
	ShowMenuForPlayer(EnterHousePickup, playerid);
	return 1;
  }
  return 1;
}
Reply
#2

do something like

pawn Code:
if (GetPlayerMenu(playerid) != EnterHousePickup)
  {
    TogglePlayerControllable(playerid, 0);
    ShowMenuForPlayer(EnterHousePickup, playerid);
    return 1;
  }
Reply
#3

i dont understand but i need the

if(GetHouseID(playerid) != -255)
{

Reply
#4

pawn Code:
public OnPlayerPickUpPickup(playerid, pickupid)
{
  if(GetHouseID(playerid) != -255)
  {
    if (GetPlayerMenu(playerid) != EnterHousePickup)
    {
      TogglePlayerControllable(playerid, 0);
      ShowMenuForPlayer(EnterHousePickup, playerid);
      return 1;
    }
  }
  return 1;
}
and please learn the basics of scripting, or at least try to figure out what I'm telling you in my first post..
Reply
#5

k thankx for your really fast help
Reply
#6

tested but it doesnt work the menu now refresh all 5 seconds like before :S

HELP"!!!
Reply
#7

http://forum.sa-mp.com/index.php?topic=82288.0
Reply
#8

use checkpoints or playertopoint for this, no other option since there is no OnPlayerLeavePickup
Reply
#9

pawn Code:
//top of script
new HMenuStarted[MAX_PLAYERS];
//OnPlayerConnect
HMenuStarted[playerid] = 0;

public OnPlayerPickUpPickup(playerid, pickupid)
{
  if(GetHouseID(playerid) != -255)
  {
    if(HMenuStarted[playerid] == 0)
    {
        TogglePlayerControllable(playerid, 0);
        ShowMenuForPlayer(EnterHousePickup, playerid);
        HMenuStarted[playerid] = 1;
        return 1;
    }
  }
  return 1;
}
Make sure to set HMenuStarted[playerid] to 0 when the player exits the menu.
Reply
#10

Quote:
Originally Posted by Norn
pawn Code:
//top of script
new HMenuStarted[MAX_PLAYERS];
//OnPlayerConnect
HMenuStarted[playerid] = 0;

public OnPlayerPickUpPickup(playerid, pickupid)
{
  if(GetHouseID(playerid) != -255)
  {
    if(HMenuStarted[playerid] == 0)
    {
        TogglePlayerControllable(playerid, 0);
        ShowMenuForPlayer(EnterHousePickup, playerid);
        HMenuStarted[playerid] = 1;
        return 1;
    }
  }
  return 1;
}
Make sure to set HMenuStarted[playerid] to 0 when the player exits the menu.
he can only enter the menu once now
that's why you'll need a 'OnPlayerLeavePickup', to set HMenuStarted[playerid] to 0 again when he leaves the pickup
Reply
#11

or use OnPlayerExitedMenu
Reply
#12

Quote:
Originally Posted by Rav
or use OnPlayerExitedMenu
Like i said, player will have 5 seconds to get the hell off the pickup. Seems like enough time for me.
Reply
#13

Quote:
Originally Posted by Norn
Quote:
Originally Posted by Rav
or use OnPlayerExitedMenu
Like i said, player will have 5 seconds to get the hell off the pickup. Seems like enough time for me.
that's a good idea, but i fixed it using checkpoints
Reply
#14

thx @ all first xD
@Fallout: I love your textdraw's xD
@Norn: THX to fix my problem
@Rav: Thanks to other help^^
Reply
#15

Quote:
Originally Posted by DarkSnow
thx @ all first xD
@Fallout: I love your textdraw's xD
@Norn: THX to fix my problem
@Rav: Thanks to other help^^
what textdraws?
Reply
#16

In Your scripts "Death Cam" "Speedo" xD
Reply
#17

oh yes thanks
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)