Jump to content

setPedOnFire and isPedOnFire


Tails

Recommended Posts

Woops. Guess what...problems...

I'm getting bad arguments @ setPedOnFire and isPedOnFire but I don't really understand why?

Any bit of help is appreciated.

function playerfire ( thePlayer ) 
thePlayer = isElement ( thePlayer ) 
    setPedOnFire ( thePlayer, true ) 
        if ( isPedOnFire ( thePlayer ) ) then 
        setTimer ( 
            function ( thePlayer ) 
                    setElementHealth ( thePlayer, getElementHealth ( thePlayer ) + 5 ) 
            end 
            , 2000, 0, source 
        ) 
    end 
end 
addCommandHandler("fire", playerfire) 

Link to comment
function playerfire(player) 
     setPedOnFire(player, true) 
     if isPedOnFire(player) then 
          setTimer(function(player) 
               setElementHealth(player, getElementHealth(player) + 5) 
          end, 2000, 0, player) 
     end 
end 
addCommandHandler("fire", playerfire) 

Link to comment
Woops. Guess what...problems...

I'm getting bad arguments @ setPedOnFire and isPedOnFire but I don't really understand why?

Any bit of help is appreciated.

function playerfire ( thePlayer ) 
thePlayer = isElement ( thePlayer ) 
    setPedOnFire ( thePlayer, true ) 
        if ( isPedOnFire ( thePlayer ) ) then 
        setTimer ( 
            function ( thePlayer ) 
                    setElementHealth ( thePlayer, getElementHealth ( thePlayer ) + 5 ) 
            end 
            , 2000, 0, source 
        ) 
    end 
end 
addCommandHandler("fire", playerfire) 

Your code is wrong here

  thePlayer = isElement(thePlayer)  

Variable thePlayer now is boolean but you should use userdata in other functions like setElementHealth and etc. So this line in your code is not needed. Also

setTimer ( 
            function ( thePlayer ) 
                    setElementHealth ( thePlayer, getElementHealth ( thePlayer ) + 5 ) 
            end 
            , 2000, 0, source 
        ) 

source is not defined in your code. Source is nil. You should use thePlayer variable.

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