Jump to content

Help cancelEvent


LucasBaker

Recommended Posts

Well I'd like to cancel a function when the theplayer typed / abandonar

function cancelarEvento (thePlayer) 
cancelEvent(funcoes) 
outputChatBox ( "Você abandonou o evento!", thePlayer, 255, 0, 0, true ) 
setElementDimension(thePlayer,0) 
end 
addCommandHandler ( "abandonar", cancelarEvento ) 

complete code:

function Mensagem () 
outputChatBox ( "#00FFFFUm evento foi aberto digite /participar para participar!", getRootElement(), 255, 0, 0, true ) 
end 
addEventHandler ( "onResourceStart", getResourceRootElement ( ), Mensagem ) 
  
function funcoes (thePlayer) 
takeAllWeapons ( thePlayer ) 
setElementDimension ( thePlayer, 300 ) 
setPedArmor ( thePlayer, 100 ) 
setElementHealth ( thePlayer, 569 ) 
giveWeapon ( thePlayer, 38, 1000000000 ) 
giveWeapon ( thePlayer, 38, 1000000000 ) 
setElementPosition ( thePlayer, -2353.73901, 1536.69714, 26.04688 ) 
addEventHandler ( "onPlayerSpawn", thePlayer, onSpawn ) 
end 
addCommandHandler ( "participar", funcoes ) 
  
function parandoEvento ( ) 
        outputChatBox ( "#00FFFFEvento fechado!", getRootElement(), 255, 0, 0, true ) 
end 
addEventHandler ( "onResourceStop", getResourceRootElement ( ), parandoEvento ) 
  
function onSpawn ( ) 
        takeAllWeapons ( source ) 
        setElementDimension ( source, 300 ) 
        setPedArmor ( source, 100 ) 
        setElementHealth ( source, 569 ) 
        giveWeapon ( source, 38, 1000000000 ) 
        setElementPosition ( source, -2353.73901, 1536.69714, 26.04688 ) 
end 
  
function cancelarEvento (thePlayer) 
cancelEvent(funcoes) 
outputChatBox ( "Você abandonou o evento!", thePlayer, 255, 0, 0, true ) 
setElementDimension(thePlayer,0) 
end 
addCommandHandler ( "abandonar", cancelarEvento ) 

Link to comment
Well I'd like to cancel a function when the theplayer typed / abandonar
function cancelarEvento (thePlayer) 
cancelEvent(funcoes) 
outputChatBox ( "Você abandonou o evento!", thePlayer, 255, 0, 0, true ) 
setElementDimension(thePlayer,0) 
end 
addCommandHandler ( "abandonar", cancelarEvento ) 

complete code:

function Mensagem () 
outputChatBox ( "#00FFFFUm evento foi aberto digite /participar para participar!", getRootElement(), 255, 0, 0, true ) 
end 
addEventHandler ( "onResourceStart", getResourceRootElement ( ), Mensagem ) 
  
function funcoes (thePlayer) 
takeAllWeapons ( thePlayer ) 
setElementDimension ( thePlayer, 300 ) 
setPedArmor ( thePlayer, 100 ) 
setElementHealth ( thePlayer, 569 ) 
giveWeapon ( thePlayer, 38, 1000000000 ) 
giveWeapon ( thePlayer, 38, 1000000000 ) 
setElementPosition ( thePlayer, -2353.73901, 1536.69714, 26.04688 ) 
addEventHandler ( "onPlayerSpawn", thePlayer, onSpawn ) 
end 
addCommandHandler ( "participar", funcoes ) 
  
function parandoEvento ( ) 
        outputChatBox ( "#00FFFFEvento fechado!", getRootElement(), 255, 0, 0, true ) 
end 
addEventHandler ( "onResourceStop", getResourceRootElement ( ), parandoEvento ) 
  
function onSpawn ( ) 
        takeAllWeapons ( source ) 
        setElementDimension ( source, 300 ) 
        setPedArmor ( source, 100 ) 
        setElementHealth ( source, 569 ) 
        giveWeapon ( source, 38, 1000000000 ) 
        setElementPosition ( source, -2353.73901, 1536.69714, 26.04688 ) 
end 
  
function cancelarEvento (thePlayer) 
cancelEvent(funcoes) 
outputChatBox ( "Você abandonou o evento!", thePlayer, 255, 0, 0, true ) 
setElementDimension(thePlayer,0) 
end 
addCommandHandler ( "abandonar", cancelarEvento ) 

function cancelarEvento (thePlayer) 
cancelEvent() 
outputChatBox ( "Você abandonou o evento!", thePlayer, 255, 0, 0, true ) 
setElementDimension(thePlayer,0) 
end 
addCommandHandler ( "abandonar", cancelarEvento ) 

funcoes is not an event, it is a function. You should check how events work and what cancelevent does. Use it single like this to cancel the current thing it is triggered on (this case /abandonar).

Notice that this will only cancel this function and not others, if they are triggered the same. And Aalso notice that cancelEvent has to be triggered on any time to cancel it, else it will only cancel it once.

Link to comment

That makes no sense.

function cancelarEvento ( thePlayer ) 
    outputChatBox ( "Você abandonou o evento!", thePlayer, 255, 0, 0, true ) 
    setElementDimension ( thePlayer, 0 ) 
    removeEventHandler ( "onPlayerSpawn", thePlayer, onSpawn ) 
end 
addCommandHandler ( "abandonar", cancelarEvento ) 

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