Jump to content

wasEventCancelled returns false - always


Ch3ck3r

Recommended Posts

The function wasEventCancelled seems to always return false.

I found this in the bug tragger but it was resolved in dp2 already.

Nevertheless, the following example code reproduces the error on my machine always.

function testEvt()
outputChatBox(tostring(wasEventCancelled()))
if wasEventCancelled() then
outputChatBox("evt was cancelled for reason :"..tostring(getCancelReason()))
return nil
end
outputChatBox("cancelling evt")
x = cancelEvent(true, "test cancelling")
outputChatBox("evt cancelled: "..(x and "yes" or "no"))
end
 
function testEvt2()
outputChatBox(tostring(wasEventCancelled()))
if wasEventCancelled() then
outputChatBox("evt was cancelled for reason :"..tostring(getCancelReason()))
return nil
end
outputChatBox("cancelling evt")
x = cancelEvent(true, "test cancelling")
outputChatBox("evt cancelled: "..(x and "yes" or "no"))
end
 
addEventHandler("onPlayerChat", getRootElement(), testEvt)
addEventHandler("onPlayerChat", getRootElement(), testEvt2)

This is the only resource running on my server for test purpose.

If a player writes something it doesn't show up ingame but in the logs.

My script produces the following output:

false
cancelling evt
evt cancelled: yes
false
cancelling evt
evt cancelled: yes

Glad for any help.

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...