Jump to content

grenade laucher


Monty

Recommended Posts

what's wrong? why doesnt shoot?

-- This function gets triggered everytime player shoots. 
function onClientPlayerWeaponFireFunc(weapon,ammo,ammoInClip,hitX,hitY,hitZ,hitElement) 
    if weapon == 31 then -- if source is a local player and he uses minigun... 
                x,y,z = getElementPosition(getLocalPlayer()) 
        if not createProjectile(getLocalPlayer(),16,x,y,z,200) then -- then we either create a projectile... 
            outputChatBox ( "Rocket minigun overheated! Give it a rest pal!", source ) -- or if projectile limit is reached we output player a chat message 
        end 
    end 
end 
  
-- Don't forget to add the onClientPlayerWeaponFireFunc function as a handler for onClientPlayerWeaponFire. 
addCommandHandler( "grenade", getLocalPlayer(), onClientPlayerWeaponFireFunc ) 

Link to comment

1. You need m4

2. U are creating air bomb o_O

3. The command handler is wrong

4. add this line at the bottom:

addEventHandler("onClientPlayerWeaponFire", getLocalPlayer(), onClientPlayerWeaponFireFunc) 

5. Change:

addCommandHandler("grenade", getLocalPlayer(), onClientPlayerWeaponFireFunc) 

to:

addCommandHandler("grenade", onClientPlayerWeaponFireFunc) 

Link to comment

still not working :(

function onClientPlayerWeaponFireFunc(weapon,ammo,ammoInClip,hitX,hitY,hitZ,hitElement) 
    if weapon == 31 then -- if source is a local player and he uses minigun... 
                x,y,z = getElementPosition(getLocalPlayer()) 
        if not createProjectile(getLocalPlayer(),16,x,y,z,200) then -- then we either create a projectile... 
            outputChatBox ( "Rocket minigun overheated! Give it a rest pal!", source ) -- or if projectile limit is reached we output player a chat message 
        end 
    end 
end 
  
-- Don't forget to add the onClientPlayerWeaponFireFunc function as a handler for onClientPlayerWeaponFire. 
    addEventHandler("onClientPlayerWeaponFire", getLocalPlayer(), onClientPlayerWeaponFireFunc) 
    addCommandHandler("grenade", onClientPlayerWeaponFireFunc) 
  

Link to comment
function onClientPlayerWeaponFireFunc( aWeapon ) 
    if ( aWeapon == 31 ) then 
        createProjectile( localPlayer, 16, getElementPosition( localPlayer ), 200 ) 
    end 
end 
  
addCommandHandler( 'grenade',  
    function( ) 
        if not( i ) then 
            addEventHandler(  
                'onClientPlayerWeaponFire', 
                localPlayer, onClientPlayerWeaponFireFunc  
            ) 
        else 
            removeEventHandler( 
                'onClientPlayerWeaponFire', 
                localPlayer, onClientPlayerWeaponFireFunc  
            ) 
        end 
        i = not i 
    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...