Jump to content

cancelEvent


Sasu

Recommended Posts

Why it isn't cancel event?

function chatNil(message, messageType) 
if messageType == 0 then 
local playerAcc = getPlayerAccount(source) 
if (not playerAcc) then 
cancelEvent() 
end 
end 
end 
addEventHandler("onPlayerChat", root, chatNil) 

Link to comment

Becuase there is always an account ( a guest account )

function chatNil(message, messageType) 
    if messageType == 0 then 
        local playerAcc = getPlayerAccount(source) 
        if ( playerAcc and isGuestAccount(playerAcc)) then 
            cancelEvent() 
        end 
    end 
end 
addEventHandler("onPlayerChat", root, chatNil) 

Link to comment

playerAcc is not defined. OFF: o.O another sasuke xD

EDIT:

function chatNil(message, messageType) 
    if messageType == 0 then 
        if ( getPlayerAccount(source) and isGuestAccount(playerAcc)) then 
            cancelEvent() 
        end 
    end 
end 
addEventHandler("onPlayerChat", root, chatNil) 
  

I changed and it works. Thanks you and Pain.

function chatNil(message, messageType) 
    if messageType == 0 then 
        if ( isGuestAccount(getPlayerAccount(source))) then 
            cancelEvent() 
        end 
    end 
end 
addEventHandler("onPlayerChat", root, chatNil) 

Edited by Guest
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...