Jump to content

minigun disable


Storm-Hanma

Recommended Posts

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 )

 

Link to comment
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.

  • Thanks 1
Link to comment
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

Link to comment
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)

 

  • Thanks 1
Link to comment

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 )

 

Link to comment
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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