Raised This Month: $51 Target: $400
 12% 

call function everytime a client fires shots?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MistaGee
Senior Member
Join Date: Aug 2004
Location: Germany (Fulda)
Old 08-09-2005 , 09:41   call function everytime a client fires shots?
Reply With Quote #1

Hi,

I need to call a function everytime the clients shoot. How do I do that?

Greetz MGee
__________________
Ich hab nie behauptet dass ich kein Genie bin!
Mumble-Django: A web interface for Mumble
MistaGee is offline
Send a message via ICQ to MistaGee
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 08-09-2005 , 11:48  
Reply With Quote #2

This is one way I did that in my Prox-Mines plugin:

Code:
#include <amxmodx> // Tracks players Shots-Fired: [0]=WeaponID, [1]=Ammo new g_iCurrWeapon[33][2] public plugin_init() {     register_event( "CurWeapon", "Event_ShotFired""b" ) } public Event_ShotFired( id ) {     // Players current weapon data..     new wID = read_data( 2 )     new wAmmo = read_data( 3 )     if( g_iCurrWeapon[id][0] != wID ) // User Changed Weapons..     {         g_iCurrWeapon[id][0] = wID         g_iCurrWeapon[id][1] = wAmmo         return PLUGIN_CONTINUE     }     if( g_iCurrWeapon[id][1] < wAmmo ) // User Reloaded..     {         g_iCurrWeapon[id][1] = wAmmo         return PLUGIN_CONTINUE     }     if( g_iCurrWeapon[id][1] == wAmmo ) // User did something else, but didn't shoot..         return PLUGIN_CONTINUE     // This far means user shot his/her gun..     // Save new weapon data..     g_iCurrWeapon[id][1] = wAmmo     g_iCurrWeapon[id][0] = wID     // Do Stuff here..     return PLUGIN_CONTINUE }

I hope that helps!
xeroblood is offline
Send a message via MSN to xeroblood
MistaGee
Senior Member
Join Date: Aug 2004
Location: Germany (Fulda)
Old 08-10-2005 , 10:35  
Reply With Quote #3

maaan this is great, exactly what I needed to finish my plugin!

big THX

this means +karma_4u and
http://forums.alliedmods.net/showthr...=137934#142762
__________________
Ich hab nie behauptet dass ich kein Genie bin!
Mumble-Django: A web interface for Mumble
MistaGee is offline
Send a message via ICQ to MistaGee
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 08:10.


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