Storm-Hanma Posted October 2, 2017 Posted October 2, 2017 hello all i need a help a help i want o disable minigun kills , for ex ;1 fire with minigun to 2,if 2 has enable minigun mode then 2 cant be killed & if 2 has disable minigun mode then he can get killed by 1 !! i scripted cilent.lua but not working instead there is no errors too, help me if you can client code; addCommandHandler("minigun", function () if ( getElementData(localPlayer, "Anti-minigun") ) then setElementData(localPlayer, "Anti-minigun", false) outputChatBox("Anti-minigun Disabled") else setElementData(localPlayer, "Anti-minigun", true) outputChatBox("Anti-minigun Enabled") end end ) function stopMinigunDamage ( attacker, weapon, bodypart ) if ( weapon == 38 ) then if (getElementData(localPlayer, "Anti-minigun")) then cancelEvent() end end end addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), stopMinigunDamage )
itHyperoX Posted October 3, 2017 Posted October 3, 2017 Quote The source of this event is the player that got damaged. (Streamed in players only) addCommandHandler("minigun", function () enabled = not enabled if enabled then setElementData(localPlayer, "Anti-minigun", false) outputChatBox("Anti-minigun Disabled") else setElementData(localPlayer, "Anti-minigun", true) outputChatBox("Anti-minigun Enabled") end end) addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), function ( attacker, weapon, bodypart ) if ( weapon == 38 ) then if (getElementData(source, "Anti-minigun")) then cancelEvent() end end end) You should add a timer for using the command because off abuse. 1
Storm-Hanma Posted October 3, 2017 Author Posted October 3, 2017 26 minutes ago, TheMOG said: addCommandHandler("minigun", function () enabled = not enabled if enabled then setElementData(localPlayer, "Anti-minigun", false) outputChatBox("Anti-minigun Disabled") else setElementData(localPlayer, "Anti-minigun", true) outputChatBox("Anti-minigun Enabled") end end) addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), function ( attacker, weapon, bodypart ) if ( weapon == 38 ) then if (getElementData(source, "Anti-minigun")) then cancelEvent() end end end) You should add a timer for using the command because off abuse. iam not giving it for vips its for all players who join server,if they enalble minigun mode they will not get killed by minigun that was my plan bro @TheMOG i didnt remove heavy weapons in my server so if i make this script work then player will enable mod and be protected by minuguns and rpg
Storm-Hanma Posted October 3, 2017 Author Posted October 3, 2017 (edited) 11 minutes ago, TheMOG said: That is what you wanted. one more doubt is should i add in cilent side or server side?or i need to add both files?? and what type of timer? Edited October 3, 2017 by Khadeer143
itHyperoX Posted October 3, 2017 Posted October 3, 2017 addCommandHandler("minigun", function () if isTimer(commandTimer) then return outputChatBox("You have to wait "..math.ceil(getTimerDetails(commandTimer)/1000).." more second to use the command again.",255,255,255,true) end if getElementData(localPlayer,"Anti-minigun") == true then commandTimer = setTimer(function() end, 1000*5, 1) setElementData(localPlayer, "Anti-minigun", false) outputChatBox("Anti-minigun Disabled") else commandTimer = setTimer(function() end, 1000*5, 1) setElementData(localPlayer, "Anti-minigun", true) outputChatBox("Anti-minigun Enabled") end end) 1
Storm-Hanma Posted October 3, 2017 Author Posted October 3, 2017 it will work without timer too ?? right let me test not wokring bro both codes !i will add serverside code too see: function onClientPlayerWeaponFire(targetPlayer) if (getElementData(targetPlayer, "Anti-minigun")) then cancelEvent(true) end end addEventHandler ( "onClientPlayerWeaponFire", getLocalPlayer(), onClientPlayerWeaponFireFunc )
Storm-Hanma Posted October 3, 2017 Author Posted October 3, 2017 2 minutes ago, TheMOG said: client side... check pm please
Recommended Posts