swcell Posted September 2, 2019 Share Posted September 2, 2019 client something is wrong with him the player can shoot after some time and + you can shoot from a hydra hunter rhino, etc. I want to ban it all local l_controls = { "fire", "action", "previous_weapon", "next_weapon", "aim_weapon", "vehicle_fire", "vehicle_secondary_fire" } addEventHandler("onClientPlayerStealthKill",localPlayer, function (targetPlayer) if getElementData(targetPlayer,"invincible") then cancelEvent() end end) function onClientPlayerStealthKill() print("No dm disabled!") end setTimer(onClientPlayerStealthKill, 10000, 1) GUIEditor = { checkbox = {}, label = {} } function checkBox() if ( guiCheckBoxGetSelected(GUIEditor.checkbox[1])) then setElementData(localPlayer, "invincible", true) setVehicleDamageProof(getPedOccupiedVehicle(localPlayer),true) else setElementData(localPlayer, "invincible", false) setVehicleDamageProof(getPedOccupiedVehicle(localPlayer),false) end end addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.label[1] = guiCreateLabel(464, 27, 130, 14, "Disable deathmatch", false) GUIEditor.checkbox[1] = guiCreateCheckBox(447, 27, 17, 15, "", false, false) addEventHandler("onClientGUIClick",GUIEditor.checkbox[1], checkBox, false) end ) function renderDeathmatchTag() local streamedPlayers = getElementsByType ("player", root, true) if streamedPlayers and #streamedPlayers ~= 0 then local lpos = {getElementPosition(localPlayer)} for _,p in ipairs (streamedPlayers) do if p and isElement (p) then if getElementData (p, "invincible") then local ppos = {getElementPosition(p)} if getDistanceBetweenPoints3D (lpos[1], lpos[2], lpos[3], ppos[1], ppos[2], ppos[3]) <= 20 then local x, y = getScreenFromWorldPosition (ppos[1], ppos[2], ppos[3]+1.2) if x and y then dxDrawText ("Disabled deathmatch ! (Can't die)", x +52, y +52, x -30, y, tocolor (255,0,0), 0.5, "bankgothic", "center") end end end end end end end addEventHandler ("onClientRender", root, renderDeathmatchTag) addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.label[1] = guiCreateLabel(464, 27, 130, 14, "Disable deathmatch", false) GUIEditor.checkbox[1] = guiCreateCheckBox(447, 27, 17, 15, "", false, false) addEventHandler("onClientGUIClick",GUIEditor.checkbox[1], function() if( guiCheckBoxGetSelected(source) ) then outputChatBox("Dead match enabled.") setElementData(localPlayer, "invincible", true) triggerServerEvent("OnSetControlsServer", localPlayer, false) local vehicle = getPedOccupiedVehicle(localPlayer) if(vehicle) then setVehicleDamageProof(vehicle,true) end else outputChatBox("Dead match disabled.") setElementData(localPlayer, "invincible", false) if not getElementData(localPlayer, "greenzone") then triggerServerEvent("OnSetControlsServer", localPlayer, true) end local vehicle = getPedOccupiedVehicle(localPlayer) if(vehicle) then setVehicleDamageProof(vehicle,false) end end end, false) end) addEventHandler ( "onClientPlayerDamage", localPlayer, function () if getElementData(source,"invincible") then cancelEvent() end end) addEventHandler("onClientPlayerStealthKill",localPlayer, function () if getElementData(source,"invencible") then cancelEvent() end end) function onPSKill(target) if getElementData(target,"invincible") then cancelEvent() end end addEventHandler("onClientPlayerStealthKill",localPlayer,onPSKill) function stopDamage(attacker,weapon,bodypart,loss) if isElement(attacker) then if attacker ~= source then if getElementData(source,"invincible") then cancelEvent() end end end end addEventHandler("onClientPlayerDamage",localPlayer,stopDamage) function stopVehicleDamage(attacker, weapon, loss, x, y, z, tire) local controller = getVehicleController(source) if isElement(attacker) and isElement(controller) then if attacker ~= controller then if getElementData(controller,"invincible") then cancelEvent() end end end end server function disableWeaponOnGodMod (prev,new) if getElementData(localPlayer, "invincible") then setPedWeaponSlot(localPlayer, 0) setVehicleDamageProof ( root, true ) end end addEventHandler ( "onClientRender", root, disableWeaponOnGodMod ) addEvent("OnSetControlsServer", true) addEventHandler("OnSetControlsServer", root, function(state) for _, v in ipairs(l_controls) do toggleControl(client, v, state) end end) 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