Tails Posted August 9, 2012 Share Posted August 9, 2012 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
sockz Posted August 9, 2012 Share Posted August 9, 2012 (edited) function g(player) if (isPedOnFire(player)) then setPedOnFire(player, false) else setPedOnFire(player, true) end end addCommandHandler("firemeup", g) do the rest Edited August 9, 2012 by Guest Link to comment
TAPL Posted August 9, 2012 Share Posted August 9, 2012 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
Kenix Posted August 9, 2012 Share Posted August 9, 2012 (edited) 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 August 9, 2012 by Guest Link to comment
Tails Posted August 9, 2012 Author Share Posted August 9, 2012 Thanks you very much guys. Very helpful. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now