Jump to content

cancelevent


HUNGRY:3

Recommended Posts

ok I tried but idk

here's code something wrong?

function test(theButton, theState, thePlayer) 
if getElementData( thePlayer,"omg") == false then 
if theButton == "u" and theState == "down" then 
cancelEvent() 
end 
end 
addEventHandler( "onElementClicked", getRootElement(), test ) 

Link to comment
ok I tried but idk

here's code something wrong?

function test(theButton, theState, thePlayer) 
if getElementData( thePlayer,"omg") == false then 
if theButton == "u" and theState == "down" then 
cancelEvent() 
end 
end 
addEventHandler( "onElementClicked", getRootElement(), test ) 

what event are you trying to cancel? You can only cancel the events that are handled originally by gta

Link to comment

Try this. Hope that I'm not wrong.

addEventHandler( "onClientKey", root, function(button,press)  
    if button == "u" then 
        if getElementData( source,"omg") == false then 
            cancelEvent() 
        end 
    end 
end ) 

Link to comment
Try this. Hope that I'm not wrong.
addEventHandler( "onClientKey", root, function(button,press)  
    if button == "u" then 
        if getElementData( source,"omg") == false then 
            cancelEvent() 
        end 
    end 
end ) 

Actully this wont do what he want to do

Link to comment
Try this. Hope that I'm not wrong.
addEventHandler( "onClientKey", root, function(button,press)  
    if button == "u" then 
        if getElementData( source,"omg") == false then 
            cancelEvent() 
        end 
    end 
end ) 

Actully this wont do what he want to do

Oh now I got what actually he wanted to do. Well he should put that check (for the "omg") in the function where he bound the key to open/close the panel.

Link to comment

another code

addEventHandler("onClientKey", root, 
function ( Button ) 
    if Button then 
        if Button == "F1" then 
        cancelEvent() 
        outputChatBox("You can't press that key now !",255,0,0) 
        end 
    end 
end ) 

Link to comment
another code
addEventHandler("onClientKey", root, 
function ( Button ) 
    if Button then 
        if Button == "F1" then 
        cancelEvent() 
        outputChatBox("You can't press that key now !",255,0,0) 
        end 
    end 
end ) 

if Button then ???

why you are checking the button if this event triggered when button clicked

Link to comment

Lel ... as ALw7sH said why the hell you need to check if there is any button when actually you click a button. And all you did is added a message *facepalm* . I'm sure that the topic maker knows how to do this if he wants ...

Anyway, You are welcome!

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...