Jump to content

disable some guns


Recommended Posts

hey all 
this script is for disabel some skins and toggle control for minigun and weapon 0 
but i have a problem  when the player leave this area or some times some staff use warp and the script didn't work fine 
i want to add a timer for this fonction of toggle controll for the players in that area 
 

local skintable = {  [10] = true, [11] = true, [12] = true, [13] = true, [14] = true, [15] = true, [17] = true, [16] = true, [18] = true, [19] = true, [20] = true,
[21] = true, [22] = true, [24] = true}

zone1 = createColCuboid ( 1588.478515625, -1149.2705078125, 0, 95, 150, 255 )-- just the 3 numbers
safeZoneRadar = createRadarArea ( 1588.478515625, -1149.2705078125, 95, 150, 255, 0, 0, 0 )-- just 2 numbers
setElementData (safeZoneRadar, "zombieProof", true)
  function inZone(hitPlayer,thePlayer)
local skin = getElementModel (hitPlayer)
    if not skintable[getElementModel(hitPlayer)] then
    toggleControl (hitPlayer, "vehicle_fire", false)
    else
        killPed (hitPlayer)
    end
end
addEventHandler( "onColShapeHit", zone1, inZone )

function outZone(hitPlayer,thePlayer)
local skin = getElementModel (hitPlayer)

if skintable[getElementModel(hitPlayer)] then
  killPed (hitPlayer)
end
end
addEventHandler( "onColShapeLeave", zone1, outZone )


addEventHandler ( 'onPlayerWeaponSwitch',root,
    function ( _,aMyWeapon )
        if isElementWithinColShape( source, zone1 ) and aMyWeapon == 38 or aMyWeapon == 0
then
            toggleControl( source,'fire',false )
outputChatBox ( "You Can not use This Weapon in this Event", source, 255, 100, 0,true )
        else
            toggleControl( source,'fire',true )
        end
    end

)

sorry for my bad english

Link to comment
addEventHandler ( 'onPlayerWeaponSwitch',root,
	function ( _,aMyWeapon )
    	local curWeapon = getPedWeapon(source)
    	if isElementWithinColShape( source, zone1 ) and curWeapon == 38 then
            toggleControl( source,'fire',false )
			outputChatBox ( "You Can not use This Weapon in this Event", source, 255, 100, 0,true )
        else
            toggleControl( source,'fire',true )
        end
    end
)

Give this a try ;)

Link to comment
addEventHandler ( 'onPlayerWeaponSwitch',root,
    function ( _,aMyWeapon )
        local curWeapon = getPedWeapon(source)
        if (isElementWithinColShape( source, zone1 )) and ( curWeapon == 38 )
then
            toggleControl( source,'fire',false )
            outputChatBox ( "You Can not use This Weapon in this Event", source, 255, 255, 255,true )
        else
            toggleControl( source,'fire',true )
        end
    end
)

with this code i cant use all the guns and the minigun i can use it 
i want to disable it not the other guns

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...