Jump to content

How to fix it?


Sami_~>

Recommended Posts

in this script timer is not working and weapon fire is not getting stop.

SERVER~~

    function disableWeaponOnGodMod
      setTimer ( function()
    		outputChatBox ( "15 seconds to sop death match" )
    	end, 15000, 1 )
        if getElementData(localPlayer, "invincible") then
                toggleControl( source,'fire',false )
                setPedWeaponSlot(localPlayer, 0)
                setVehicleDamageProof ( root, true ) 	
        end 
    end 
    addEventHandler ( "onClientRender", root, disableWeaponOnGodMod )

CLIENT~~

    GUIEditor = {
        checkbox = {},
        label = {}
    }
    addEventHandler("onClientResourceStart", resourceRoot,
        function()
            GUIEditor.label[1] = guiCreateLabel(614, 118, 130, 14, "Disable Death", false)


            GUIEditor.checkbox[1] = guiCreateCheckBox(593, 117, 17, 15, "", false, false)    
    		addEventHandler("onClientGUIClick",GUIEditor.checkbox[1], checkBox, false)
        end
    )  
     

    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 ( "onClientPlayerDamage",localPlayer, 
        function () 
            if getElementData(source,"invincible") then 
                cancelEvent() 
            end 
    end) 

    addEventHandler("onClientPlayerStealthKill",localPlayer,
    function ()
        if getElementData(source,"invencible") then
            cancelEvent()
        end
    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, y, x, y, tocolor (255,0,0), 0.5, "bankgothic", "center")
    						end
    					end
    				end
    			end
    		end
    	end
    end
    addEventHandler ("onClientRender", root, renderDeathmatchTag)

 

Edited by Sami_~>
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...