Perfect Posted December 29, 2013 Share Posted December 29, 2013 Hi, I was making a script and I have came to a Problem, when i want to Disable/Reverse/Off cancelEvent(). Here is My Script:- function stopKnifeKill ( attacker, weapon, bodypart ) if ( weapon == 4 ) then cancelEvent() outputChatBox('#00ff0Server: Knife Godmode On!',source,0,255,0) else outputChatBox('#00ff00Server: Knife Godmode Off!',source,255,0,0,true) return false -- What should i do here to Disable cancelEvent ? end end addEventHandler ( "onClientPlayerDamage", root, stopKnifeKill ) addCommandHandler("kinfe",stopKnifeKill) Link to comment
50p Posted December 29, 2013 Share Posted December 29, 2013 What do you mean by disable cancelEvent()? Link to comment
TAPL Posted December 29, 2013 Share Posted December 29, 2013 If i understand correctly, this is what you looking for: -- Client Side -- addCommandHandler("kinfe", function() if not kinfeKill then outputChatBox("#00ff0Server: Knife Godmode On!", 0, 255, 0, true) else outputChatBox("#00ff00Server: Knife Godmode Off!", 255, 0, 0, true) end kinfeKill = not kinfeKill end) function stopKnifeKill() if kinfeKill then cancelEvent() end end addEventHandler("onClientPlayerStealthKill", localPlayer, stopKnifeKill) Link to comment
Perfect Posted December 29, 2013 Author Share Posted December 29, 2013 Sorry as i didn't describe correctly what i want to do. Ok, I want to disable/enable knife kills by command /knife. By knife kills i mean player killing each other with knife. When knife kill is disable player can't kill with knife (cancelEvent onplayerdamage), When knife kill is enable player can kill with knife.(get event back onplayerdamage). If i understand correctly, this is what you looking for: -- Client Side -- addCommandHandler("kinfe", function() if not kinfeKill then outputChatBox("#00ff0Server: Knife Godmode On!", 0, 255, 0, true) else outputChatBox("#00ff00Server: Knife Godmode Off!", 255, 0, 0, true) end kinfeKill = not kinfeKill end) function stopKnifeKill() if kinfeKill then cancelEvent() end end addEventHandler("onClientPlayerStealthKill", localPlayer, stopKnifeKill) Sorry, can you please define stealth kill ? And as i can't see knife id there, i think it will not disable players killing with knife with 1 click(backside-neck) Link to comment
TAPL Posted December 29, 2013 Share Posted December 29, 2013 stealth kill = kill with knife, Link to comment
Perfect Posted December 29, 2013 Author Share Posted December 29, 2013 stealth kill = kill with knife, Ah, Thank you!! Link to comment
Perfect Posted December 29, 2013 Author Share Posted December 29, 2013 can you please solve this one ? function fire() setPedOnFire(source,true) setElementHealth(source,true) end function fireme() local stimer = setTimer(fire,1000,0) end function unfire() if isTimer ( stimer ) then killTimer ( stimer ) end end addCommandHandler("fireme",fireme) addCommandHandler("unfireme",unfire) errors at setPedOnFire and setPedHealth Link to comment
TAPL Posted December 29, 2013 Share Posted December 29, 2013 -- Client Side -- function fire() setPedOnFire(localPlayer,true) setElementHealth(localPlayer,Here-Must-Be-Number) -- only number no bool. end function fireme() local stimer = setTimer(fire,1000,0) end function unfire() if isTimer ( stimer ) then killTimer ( stimer ) end end addCommandHandler("fireme",fireme) addCommandHandler("unfireme",unfire) Link to comment
Storm-Hanma Posted October 25, 2016 Share Posted October 25, 2016 On 12/29/2013 at 8:49 PM, TAPL said: If i understand correctly, this is what you looking for: -- Client Side -- addCommandHandler("kinfe", function() if not kinfeKill then outputChatBox("#00ff0Server: Knife Godmode On!", 0, 255, 0, true) else outputChatBox("#00ff00Server: Knife Godmode Off!", 255, 0, 0, true) end kinfeKill = not kinfeKill end) function stopKnifeKill() if kinfeKill then cancelEvent() end end addEventHandler("onClientPlayerStealthKill", localPlayer, stopKnifeKill) It good works but how can i add this mode of disableknife in f1 panel? Can u suggest me For example like this- jetpack option in freeroam same likethat disableknife-on or off Link to comment
Captain Cody Posted October 25, 2016 Share Posted October 25, 2016 3 years man THREE YEARS. 3 Link to comment
Storm-Hanma Posted October 25, 2016 Share Posted October 25, 2016 (edited) Sorry bruh but now i need this for my server thats y i comment here! Above script is working? But idk how to add a option of disableknife in f1 panel like jetpack and fall of bike Edited October 25, 2016 by Khadeer143 Link to comment
Swagy Posted October 25, 2016 Share Posted October 25, 2016 Try using "if guiRadioBoxGetSelected (radiobox) == true then.." and add you code Try using wiki so you get the right function. Link to comment
Storm-Hanma Posted October 26, 2016 Share Posted October 26, 2016 Can u suggest were is it? Can u show me Link to comment
Swagy Posted October 26, 2016 Share Posted October 26, 2016 https://wiki.multitheftauto.com/wiki/GuiRadioButtonGetSelected use this Quote if guiRadioButtonGetSelected (theRadioButton) then function stopKnifeKilling () cancelEvent() else ...etc It's like this try it. Link to comment
Storm-Hanma Posted October 26, 2016 Share Posted October 26, 2016 19 minutes ago, Blid-BoY said: https://wiki.multitheftauto.com/wiki/GuiRadioButtonGetSelected use this It's like this try it. 19 minutes ago, Blid-BoY said: https://wiki.multitheftauto.com/wiki/GuiRadioButtonGetSelected use this It's like this try it. Not working link above u droped! What is serverside and cilent side explain plz? Link to comment
iPrestege Posted October 26, 2016 Share Posted October 26, 2016 13 minutes ago, Blid-BoY said: https://wiki.multitheftauto.com/wiki/GuiRadioButtonGetSelected use this It's like this try it. Actually it's not a radio button it's a check-box use : guiCheckBoxGetSelected Instead of guiRadioButtonGetSelected Link to comment
Storm-Hanma Posted October 26, 2016 Share Posted October 26, 2016 2 minutes ago, FaHaD said: Actually it's not a radio button it's a check-box use : guiCheckBoxGetSelected Instead of guiRadioButtonGetSelected Yea bro its guicheck but i need to know what is cilent and server side ? Wt it mean can u tell me 4 minutes ago, FaHaD said: Actually it's not a radio button it's a check-box use : guiCheckBoxGetSelected Instead of guiRadioButtonGetSelected GUI create button or checkbox? Link to comment
iPrestege Posted October 26, 2016 Share Posted October 26, 2016 Just now, Khadeer143 said: Yea bro its guicheck but i need to know what is cilent and server side ? Wt it mean can u tell me Go to the freeroam resource open fr_client.lua go to line 1522 and add this under fall of bike : { 'chk',id = 'StealthKill',text = 'Disable Knifing',onclick = toggleStealthKill }, { 'br' }, And in the last of the file the same file fr_client.lua use this function to toggleStealthKill : --------------------------- -- Knifing toggle --------------------------- function toggleStealthKill ( ) if guiCheckBoxGetSelected ( getControl ( wndMain,'StealthKill' ) ) and not kinfeKill then outputChatBox ( 'Server: Knife Godmode On!', 0,255,0 ) else outputChatBox ( 'Server: Knife Godmode Off!',255,0,0 ) end kinfeKill = not kinfeKill end addEventHandler ( 'onClientPlayerStealthKill',localPlayer, function ( ) if kinfeKill then cancelEvent ( ) end end ) Try this. 1 Link to comment
Storm-Hanma Posted October 26, 2016 Share Posted October 26, 2016 On 12/30/2013 at 2:40 AM, TAPL said: -- Client Side -- function fire() setPedOnFire(localPlayer,true) setElementHealth(localPlayer,Here-Must-Be-Number) -- only number no bool. end function fireme() local stimer = setTimer(fire,1000,0) end function unfire() if isTimer ( stimer ) then killTimer ( stimer ) end end addCommandHandler("fireme",fireme) addCommandHandler("unfireme",unfire) Wet is this fireme? Script Link to comment
Storm-Hanma Posted September 10, 2017 Share Posted September 10, 2017 On 10/26/2016 at 04:02, iPrestege said: Go to the freeroam resource open fr_client.lua go to line 1522 and add this under fall of bike : { 'chk',id = 'StealthKill',text = 'Disable Knifing',onclick = toggleStealthKill }, { 'br' }, And in the last of the file the same file fr_client.lua use this function to toggleStealthKill : --------------------------- -- Knifing toggle --------------------------- function toggleStealthKill ( ) if guiCheckBoxGetSelected ( getControl ( wndMain,'StealthKill' ) ) and not kinfeKill then outputChatBox ( 'Server: Knife Godmode On!', 0,255,0 ) else outputChatBox ( 'Server: Knife Godmode Off!',255,0,0 ) end kinfeKill = not kinfeKill end addEventHandler ( 'onClientPlayerStealthKill',localPlayer, function ( ) if kinfeKill then cancelEvent ( ) end end ) Try this. i added on cilent side but nothing happen no errors and no freeroam panel i cant spawn freeroam panel Link to comment
1337.Ibrahim Posted September 10, 2017 Share Posted September 10, 2017 next time 8 years 3 Link to comment
Storm-Hanma Posted September 11, 2017 Share Posted September 11, 2017 Yea 1 year even its not solved for me instead of commenting 1year or 2year etc.. Try to help loll 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