PaulDK Posted April 15, 2014 Share Posted April 15, 2014 Hey Dude's i Need Help Can You Help me i want if i type /suicide then i move it will cancel but if i not move it will not cancel thanks in Advance Here's the Script function commitSuicide (sourcePlayer) local moveState = getPedMoveState(sourcePlayer) local seconds = 10 if moveState then outputChatBox("#FFFF00[ADMIN BOT] You Has Move Attempting Suicide Failed", sourcePlayer ,0, 0, 0, true) cancelEvent() end if not moveState then outputChatBox("#FFFF00[ADMIN BOT]Wait 10 seconds You Has Been Frozen", sourcePlayer,255,255,255,true) setTimer(function() seconds = seconds-1 if seconds<=0 then killPed(sourcePlayer, sourcePlayer) end end,1000,seconds) end end addCommandHandler("suicide", commitSuicide) Link to comment
Gtagasje Posted April 15, 2014 Share Posted April 15, 2014 function commitSuicide(thePlayer, cmd) if not getElementData(thePlayer, "suicide") then setElementData(thePlayer, "suicide", true) seconds = 10 suicideTimer = setTimer(function(thePlayer) if seconds > 1 then seconds = seconds-1 else killPed(thePlayer) killTimer(suicideTimer) setElementData(thePlayer, "suicide", false) end end, 1000, 0, thePlayer) else outputChatBox("#FFFF00[ADMIN BOT]You are already attempting to suicide! Please wait!", thePlayer, 255, 0, 0, true) end end addCommandHandler("suicide", commitSuicide) setTimer(function() for i,v in ipairs(getElementsByType("player")) do if getElementData(v, "suicide") then if getPedMoveState(thePlayer) ~= "stand" and getPedMoveState(thePlayer) ~= "crouch" then if isTimer(suicideTimer) then killTimer(suicideTimer) setElementData(v, "suicide", false) outputChatBox("#FF0000[ADMIN BOT]You attempted to move! Suicide cancelled!", v, 255, 0, 0, true) end end end end end, 50, 0) Try that Link to comment
Moderators IIYAMA Posted April 15, 2014 Moderators Share Posted April 15, 2014 getPedMoveState is clientside. You can't use that at serverside. Just simply replace: local moveState = getPedMoveState(sourcePlayer) local moveState = getDistanceBetweenPoints3D ( 0, 0, 0, getElementVelocity ( sourcePlayer ) ) > 1 Link to comment
Gtagasje Posted April 15, 2014 Share Posted April 15, 2014 Wops, totally overlooked that, never used that function, ignore my script. ._. Link to comment
Moderators IIYAMA Posted April 15, 2014 Moderators Share Posted April 15, 2014 Wops, totally overlooked that, never used that function, ignore my script. ._. If you checked debugscript, you would have known. Link to comment
PaulDK Posted April 15, 2014 Author Share Posted April 15, 2014 Dude Script Doesn't Work... Anyone Give Me The Right Script Link to comment
Vinctus Posted April 15, 2014 Share Posted April 15, 2014 try this, haven't tested function commitSuicide(src) if src then if getElementData(src, "suicide") == false then -- message when player writes the command if he is not already suiciding toggleAllControls(src, false) setElementData(src, "suicide", true) sec = 10 local suicideTimer = setTimer(function(plr) if sec <= 0 then killPed(plr) killTimer(suicideTimer) setElementData(plr, "suicide", false) toggleAllControls(src, true) -- message when suicided else sec = sec - 1 end end, 1000, 0, src) else -- message if player is already committing suicide but tries to enter the command end end end addCommandHandler("suicide", commitSuicide) Link to comment
Moderators IIYAMA Posted April 15, 2014 Moderators Share Posted April 15, 2014 Dude Script Doesn't Work... Anyone Give Me The Right Script Don't call me dude and good luck with your infinity timers. I am not here to script for you, I only give help to the ones that deserve it. Link to comment
PaulDK Posted April 15, 2014 Author Share Posted April 15, 2014 try this, haven't tested function commitSuicide(src) if src then if getElementData(src, "suicide") == false then -- message when player writes the command if he is not already suiciding toggleAllControls(src, false) setElementData(src, "suicide", true) sec = 10 local suicideTimer = setTimer(function(plr) if sec <= 0 then killPed(plr) killTimer(suicideTimer) setElementData(plr, "suicide", false) toggleAllControls(src, true) -- message when suicided else sec = sec - 1 end end, 1000, 0, src) else -- message if player is already committing suicide but tries to enter the command end end end addCommandHandler("suicide", commitSuicide) bro thank you very much i fix it 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