Galton Posted May 21, 2015 Share Posted May 21, 2015 edit: I can get it to work with addCommandHandler now. I still don't know how it works with events though. I'd greatly appreciate it if you could explain. fixed code with addEventHandler: function delayedKill (player) setTimer ( function () killPed(player) end, 1500, 1) end addCommandHandler ("test1", delayedKill) Link to comment
Guest Posted May 21, 2015 Share Posted May 21, 2015 function asd(Player, Command) setTimer(killPed,2000,1,Player) end addCommandHandler("test1",asd) Link to comment
Galton Posted May 21, 2015 Author Share Posted May 21, 2015 function asd(Player, Command) setTimer(killPed,2000,1,Player) end addCommandHandler("test1",asd) thanks for the answer. it's shorter than mine and it works. your example is a much better way to do it. Link to comment
Enargy, Posted May 21, 2015 Share Posted May 21, 2015 function delayedKill (player) setTimer ( function () killPed(player) end, 1500, 1) end addCommandHandler ("test1", delayedKill) function asd(Player, Command) setTimer(killPed,2000,1,Player) end addCommandHandler("test1",asd) Is the same practically. Link to comment
Moderators IIYAMA Posted May 21, 2015 Moderators Share Posted May 21, 2015 I recommend this: function delayedKill (player,command) -- player = you, command = "test1" setTimer (function () if isElement(player) then -- Players can leave during the timer, which will give you warning if this happens. killPed(player) end end,1500, 1) end addCommandHandler ("test1", delayedKill) As scripter you don't want warnings during execute your code. Warnings = lagg and fill up your server logs. Link to comment
Galton Posted May 21, 2015 Author Share Posted May 21, 2015 thank you both. I really appreciate your help. 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