Jump to content

(HELP)disable grenades in interior


lucascba

Recommended Posts

you can , use more than one way ..

First #

--ClientSide

addEventHandler ( 'onClientPlayerWeaponFire', resourceRoot, 
function (nWeapon) 
if ( getElementData ( localPlayer, 'NoGrenades'  == false ) and nWeapon == 16 ) then 
cancelEvent ( ) 
outputChatBox ( '* Using Grenades Are Not Allowed Here * ' , 255, 0, 0 ) 
  end 
end 
) 

if the intro - clientSide , then

setElementData ( localPlayer ,'NoGrenades', false ) 

if it was serverside use ,

setElementData ( source ,'NoGrenades', false ) 

second #

ID = { 592, 553, 577, 488, 511, 497, 548, 563, 512, 476, 593, 447, 425, 519, 520, 460, 417, 469, 487, 513, 509, 481, 
510, 472, 473, 493, 595, 484, 430, 453, 452, 446, 454 } 
addEventHandler ( 'onClientPlayerWeaponFire', resourceRoot, 
function (nWeapon ) 
for _, v in ipairs (ID) do 
if ( getElementInterior (v ) and (nWeapon ) == 16 ) then 
cancelEvent ( ) 
outputChatBox ( '* Using Grenades Are Not Allowed Here * ' , 255, 0, 0 ) 
     end 
   end 
end 
) 

Replace the ids, with your interior ids ,

Third #

--ClientSide

addEventHandler( 'onClientPlayerWeaponSwitch', root, 
function ( ) 
    if ( getPedWeapon(localPlayer ) == 17  ) and getElementInterior(localPlayer) ~= 0  then 
        toggleControl ( "fire", false ) 
    else 
            toggleControl ( "fire", true ) 
        end 
    end 
    ) 
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...