Jump to content

grenade laucher


Monty

Recommended Posts

Posted

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 ) 

ANY SCRIPT REQUEST FOR FREE HERE: http://www.stolka.altervista.org

Posted

The second argument of addCommandHandler is the function, not a player element.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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) 

Looking for tutorials or information? check out: www.simpleask.co.uk

Posted

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) 
  

ANY SCRIPT REQUEST FOR FREE HERE: http://www.stolka.altervista.org

Posted

Errors or anything? is the script set as client side?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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 
) 

╔═╦╦╦╗╔╦═╦═╦═╦═╦╦╦╦╦╦╦═╦╦╦╦╗

║║║║║╠╝║║╚╣║║║║║║║║║║║║║║║║║

║║║║║╚╦╦═╦╦╦╦╣║║║║║║║║║║║║║║

║║║║╠═╣╠╝╔══╝║║║║║╟╢║║║║║╟╢║

╚╩══╩══╩═╩═══╩╩══╩╩═╩╩╩═╩╩═╝

«سبحانك اللهم وبحمدك أشهد أن لا إله إلا أنت أستغفرك وأتوب إليك»

M7mdAl7arthy : لتواصل سكايب

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