Problem with TogglePlayerControllable...
#1

I need some help with this

pawn Код:
new Menu:current;
    current = GetPlayerMenu(playerid);
    if(current == wepmenu)
    {
        if (PRESSED(KEY_SECONDARY_ATTACK))
        {
            TogglePlayerControllable(playerid, 1);
        }
    }
I dont know if its just being a bitch or what, but as you can see i defined when it should happen,
now when ever i press the enter/exit key which i ment to make the menu to hide and give me
movemoment back it doest cares if the menu is showen or not, its just executes the function
which brings lots of troubles like you cant enter a single car because it autoaticly resets your
animations and stuff, if anyone could help me to solve this...
Thanks, best regards.
Reply
#2

I can't quite fully understand what you mean, but from what I can see, you mean either:
1) When a player hits the 'secondary attack' key, he can walk again but the menu doesn't gets closed?
OR
2) The code gets executed each time the player presses the 'secondary attack' key.
Reply
#3

Quote:
Originally Posted by Hiddos
Посмотреть сообщение
2) The code gets executed each time the player presses the 'secondary attack' key.
Yes, thats it, but only after the code has been used, if not everything is normal.
Reply
#4

Go to

OnPlayerExitMenu....
{
//add
TogglePlayerControllable(playerid, 1);
return 1;
}
Reply
#5

Quote:
Originally Posted by SuperS82
Посмотреть сообщение
Go to

OnPlayerExitMenu....
{
//add
TogglePlayerControllable(playerid, 1);
return 1;
}
this works only for 1 menu, but i have 2 more submenus and i tried that way already.
ive tried like
pawn Код:
public OnPlayerExitedMenu(playerid)
{
    new Menu:current;
    current = GetPlayerMenu(playerid);
    if(current == wepmenu)
    {
        TogglePlayerControllable(playerid, 1);
    }
}
but dont know why, it didnt worked..
Reply
#6

Did you try just this?
Код:
public OnPlayerExitedMenu(playerid)
{
TogglePlayerControllable(playerid,1);
return 1;
}
Im pretty sure this will work on all menus
Reply
#7

Yes i did. But let me explain a better, i have a menu, when i select a
row from it it brings me to a anoter in which i can select a row again
what brings me to a anoter menu so thats like 1 main menu + 2 more submenus.
Reply
#8

Maybe try this:

When you're showing other menu available from other:
pawn Код:
SetPVarInt(playerid, "OnPlayerExitedMenu_Not", 1);
pawn Код:
public OnPlayerExitedMenu(playerid)
{
    if(GetPVarInt(playerid, "OnPlayerExitedMenu_Not") != 1)
    {
        TogglePlayerControllable(playerid,1);
    }
    return 1;
}
Reply
#9

Wait, where did you add the thing in the first post?
Reply
#10

Quote:
Originally Posted by ikarus
Посмотреть сообщение
Wait, where did you add the thing in the first post?
At OnPlayerKeyStateChange.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)