Raised This Month: $ Target: $400
 0% 

Add effects when I shot with a gun. [please help me]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hip_hop_x
Senior Member
Join Date: Apr 2006
Old 01-17-2007 , 16:57   Add effects when I shot with a gun. [please help me]
Reply With Quote #1

How to add some code while I shot with guns? I've made some effects, but I don' know how to add them.
I don't know how to do this:
Code:
if( player is shoting(id) ) //this is what I don't know { //my code to set some effects for all weapons }

And how to add some code while I shot only with that gun.
Code:
if( player is shoting(id) ) && (weapon is crossbow) { // my cod to set the effects only for weapon crossbow }

Anyone could give me some examples, andif you have time, can you please give me a url/post all the weaopn names from half-life(not cstrike).
I need this to finish my plugin.

I'll give +karma If you help me.

Last edited by hip_hop_x; 01-17-2007 at 16:59.
hip_hop_x is offline
Send a message via MSN to hip_hop_x Send a message via Yahoo to hip_hop_x
stupok
Veteran Member
Join Date: Feb 2006
Old 01-17-2007 , 19:31   Re: Add effects when I shot with a gun. [please help me]
Reply With Quote #2

The Code Snippets/Tutorials is very helpful sometimes .

These two threads have exactly what you need. You need to hook prethink to see what button is being pushed, that is how you can determine if a client fires a weapon.

http://forums.alliedmods.net/showthread.php?t=49395
http://forums.alliedmods.net/showthread.php?t=41265

Weapon List
stupok is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 01-18-2007 , 05:01   Re: Add effects when I shot with a gun. [please help me]
Reply With Quote #3

Quote:
see what button is being pushed, that is how you can determine if a client fires a weapon
There are many situations when button is pressed but weapon isn't fired. For example empty clip, non-automatical weapons etc.
VEN is offline
dutchmeat
Senior Member
Join Date: Sep 2006
Old 01-18-2007 , 06:17   Re: Add effects when I shot with a gun. [please help me]
Reply With Quote #4

You can find the current weapon with get_user_weapon:
http://www.amxmodx.org/funcwiki.php?go=func&id=156
and here's an example of how i would check if the player is firing a weapon
Code:
new checkammo[33] public client_PostThink(id) { new iwpn, wclip, wammo iwpn = get_user_weapon(id,wclip,wammo) if(entity_get_int(id,EV_INT_button) & ~IN_ATTACK  && iwpn != 13) // if the player is holding the firing button       //i don't know which number is crossbow {  //If the clip isn't 0 (empty clip) and isn't the same number as the last time we checked  if (wclip != 0 && wclip != checkammo[id]){   checkammo[id] = wclip   //you can add the effect here.  } } }
__________________
before you criticize someone, you should walk a mile in their shoes. that way, when you criticize them, you're a mile away and you have their shoes.
dutchmeat is offline
hip_hop_x
Senior Member
Join Date: Apr 2006
Old 01-18-2007 , 13:45   Re: Add effects when I shot with a gun. [please help me]
Reply With Quote #5

thanks guys. Also if someone will be able to give me an example if the weapon is crossbow will be very good.

------------------------------------

But there are some problems, while I change my weapon the effect starts, but also works while I shot with any gun.

Last edited by hip_hop_x; 01-18-2007 at 16:23.
hip_hop_x is offline
Send a message via MSN to hip_hop_x Send a message via Yahoo to hip_hop_x
stupok
Veteran Member
Join Date: Feb 2006
Old 01-18-2007 , 17:52   Re: Add effects when I shot with a gun. [please help me]
Reply With Quote #6

Post your code so we can tell you what you have done incorrectly and show you the correct method.
stupok is offline
hip_hop_x
Senior Member
Join Date: Apr 2006
Old 01-19-2007 , 06:45   Re: Add effects when I shot with a gun. [please help me]
Reply With Quote #7

ok, posted the full plugin. Plugin is not 100% done.
I still have to add:
-3 effects for every power (only for some guns)
-to make the teleport to work good
- improve the menu
Attached Files
File Type: sma Get Plugin or Get Source (hx_menu.sma - 641 views - 6.3 KB)
hip_hop_x is offline
Send a message via MSN to hip_hop_x Send a message via Yahoo to hip_hop_x
dutchmeat
Senior Member
Join Date: Sep 2006
Old 01-19-2007 , 07:36   Re: Add effects when I shot with a gun. [please help me]
Reply With Quote #8

Do you know the weapon numbers?
And what's wrong with the menu, and teleport?
__________________
before you criticize someone, you should walk a mile in their shoes. that way, when you criticize them, you're a mile away and you have their shoes.
dutchmeat is offline
hip_hop_x
Senior Member
Join Date: Apr 2006
Old 01-19-2007 , 08:00   Re: Add effects when I shot with a gun. [please help me]
Reply With Quote #9

I don't know the weapon noumbers , and the teleport doesn't works right. It doesn't teleport to exact aimorigin - to the target.
hip_hop_x is offline
Send a message via MSN to hip_hop_x Send a message via Yahoo to hip_hop_x
dutchmeat
Senior Member
Join Date: Sep 2006
Old 01-19-2007 , 08:52   Re: Add effects when I shot with a gun. [please help me]
Reply With Quote #10

where does it teleport you to ?
__________________
before you criticize someone, you should walk a mile in their shoes. that way, when you criticize them, you're a mile away and you have their shoes.
dutchmeat is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:25.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode