AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Add effects when I shot with a gun. [please help me] (https://forums.alliedmods.net/showthread.php?t=50015)

hip_hop_x 01-17-2007 16:57

Add effects when I shot with a gun. [please help me]
 
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.

stupok 01-17-2007 19:31

Re: Add effects when I shot with a gun. [please help me]
 
The Code Snippets/Tutorials is very helpful sometimes :wink:.

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

VEN 01-18-2007 05:01

Re: Add effects when I shot with a gun. [please help me]
 
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.

dutchmeat 01-18-2007 06:17

Re: Add effects when I shot with a gun. [please help me]
 
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.  } } }

hip_hop_x 01-18-2007 13:45

Re: Add effects when I shot with a gun. [please help me]
 
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.

stupok 01-18-2007 17:52

Re: Add effects when I shot with a gun. [please help me]
 
Post your code so we can tell you what you have done incorrectly and show you the correct method.

hip_hop_x 01-19-2007 06:45

Re: Add effects when I shot with a gun. [please help me]
 
1 Attachment(s)
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

dutchmeat 01-19-2007 07:36

Re: Add effects when I shot with a gun. [please help me]
 
Do you know the weapon numbers?
And what's wrong with the menu, and teleport?

hip_hop_x 01-19-2007 08:00

Re: Add effects when I shot with a gun. [please help me]
 
I don't know the weapon noumbers :(, and the teleport doesn't works right. It doesn't teleport to exact aimorigin - to the target.

dutchmeat 01-19-2007 08:52

Re: Add effects when I shot with a gun. [please help me]
 
where does it teleport you to ?


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

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