Spice Posted April 9, 2015 Share Posted April 9, 2015 why when i type /kill the timer don't wait 5 seconds and kills me once i type it ? function ok() setElementHealth ( localPlayer, 0 ) end function kill() addCommandHandler ( "kill", ok, false, false ) end setTimer ( kill, 5000, 1 ) Link to comment
HUNGRY:3 Posted April 9, 2015 Share Posted April 9, 2015 dunno function ok() setElementHealth ( localPlayer, 0 ) end function kill() addCommandHandler ( "kill", ok, false, false ) end setTimer ( ok, 5000, 1 ) Link to comment
pa3ck Posted April 9, 2015 Share Posted April 9, 2015 function ok() setElementHealth ( localPlayer, 0 ) end function kill() setTimer ( ok, 5000, 1 ) end addCommandHandler ( "kill", kill, false, false ) Link to comment
Spice Posted April 9, 2015 Author Share Posted April 9, 2015 function ok() setElementHealth ( localPlayer, 0 ) end function kill() setTimer ( ok, 5000, 1 ) end addCommandHandler ( "kill", kill, false, false ) Not working still once i type the command i get killed Link to comment
Tekken Posted April 9, 2015 Share Posted April 9, 2015 Try this: function killCommand(thePlayer) setTimer(killPed(thePlayer, thePlayer), 5000, 1) end addCommandHandler("kill", killCommand) Link to comment
Spice Posted April 9, 2015 Author Share Posted April 9, 2015 Try this: function killCommand(thePlayer) setTimer(killPed(thePlayer, thePlayer), 5000, 1) end addCommandHandler("kill", killCommand) Still the same but debug says attempt to call global "killPed"(a nil value) when i tried it as server script Debug says : Bad argument @ 'setTimer' [ expected function at argument 1, got boolean ] Link to comment
Banex Posted April 9, 2015 Share Posted April 9, 2015 function killCommand(thePlayer) setTimer(killPed, 5000, 1,thePlayer) end addCommandHandler("kill", killCommand) Link to comment
WhoAmI Posted April 9, 2015 Share Posted April 9, 2015 Remember to put it server-side. Link to comment
Spice Posted April 9, 2015 Author Share Posted April 9, 2015 function killCommand(thePlayer) setTimer(killPed, 5000, 1,thePlayer) end addCommandHandler("kill", killCommand) it kills me twice 1 time once i type the command and the other after 5 secs. ( when i get respawned ) Link to comment
pa3ck Posted April 9, 2015 Share Posted April 9, 2015 (edited) You are probably using freeroam and I'm pretty sure it has a /kill command. There's no way that piece of code kills you twice... Edited April 9, 2015 by Guest Link to comment
Mr.unpredictable. Posted April 9, 2015 Share Posted April 9, 2015 (edited) DELETE Edited April 9, 2015 by Guest Link to comment
Spice Posted April 9, 2015 Author Share Posted April 9, 2015 You are probably using freeroam and I'm pretty sure it has a /kill command. There's no way the piece of code kills you twice... That's right it's working now Thanks ! 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