Monty Posted December 18, 2012 Posted December 18, 2012 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
Castillo Posted December 18, 2012 Posted December 18, 2012 The second argument of addCommandHandler is the function, not a player element. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
manve1 Posted December 18, 2012 Posted December 18, 2012 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
Monty Posted December 18, 2012 Author Posted December 18, 2012 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
Castillo Posted December 18, 2012 Posted December 18, 2012 Errors or anything? is the script set as client side? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
abu5lf Posted December 18, 2012 Posted December 18, 2012 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 : لتواصل سكايب
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now