Raised This Month: $ Target: $400
 0% 

Trigger for Score / Deaths change ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
waza123b
Junior Member
Join Date: Feb 2012
Old 07-11-2012 , 20:03   Trigger for Score / Deaths change ?
Reply With Quote #1

Is there a way to handle a score/death change ?

for example, if some plugin in server is making +1 kills or +1 deaths, i need some function which will be triggered.. something like:


Code:
public client_handle_kills_deaths_change(id, kills, deaths){
   // do something with score
}
functions like client_death() will not help, because they triggering when client really dies not when death is set +1

Last edited by waza123b; 07-11-2012 at 20:12.
waza123b is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-11-2012 , 20:05   Re: Trigger for Score / Deaths change ?
Reply With Quote #2

Hook DeathMsg
__________________
Bugsy is offline
waza123b
Junior Member
Join Date: Feb 2012
Old 07-11-2012 , 20:10   Re: Trigger for Score / Deaths change ?
Reply With Quote #3

Quote:
Originally Posted by Bugsy View Post
Hook DeathMsg
this is called when some one dies, but as I sad before, other plugins in my server can change Kills/Deaths without killing or dying player.

For example: Zombie mod, if zombie infect player, player is alive, but zombie gets +1 kills, player gets +1 deaths, but no one dies.

need something like:

Code:
public on_kills_deaths_changing(){
}

Last edited by waza123b; 07-11-2012 at 20:12.
waza123b is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-11-2012 , 20:32   Re: Trigger for Score / Deaths change ?
Reply With Quote #4

PHP Code:
#include <amxmodx>

const MaxPlayers 32;

enum _:ScoreInfo
{
    
SI_PlayerID 1,
    
SI_Frags,
    
SI_Deaths,
    
SI_ClassID,
    
SI_TeamID 
}

enum Score
{
    
Kills,
    
Deaths
}
new 
g_ScoreMaxPlayers ][ Score ];

public 
plugin_init() 
{
    
register_event"ScoreInfo" "fw_ScoreInfo" "a" );
}

public 
fw_ScoreInfo()
{
    new 
iPlayer read_dataSI_PlayerID );
    new 
iKills read_dataSI_Frags );
    new 
iDeaths read_dataSI_Deaths );
    
//new iTeam = read_data( SI_TeamID );
    
    
if ( ( ( g_ScoreiPlayer ][ Kills ] != iKills ) || ( g_ScoreiPlayer ][ Deaths ] != iDeaths ) ) && ( iKills || iDeaths ) )
    {
        
//Player score changed
    
}
    
    
g_ScoreiPlayer ][ Kills ] = iKills;
    
g_ScoreiPlayer ][ Deaths ] = iDeaths;

__________________

Last edited by Bugsy; 07-11-2012 at 22:00. Reason: Fixing
Bugsy is offline
waza123b
Junior Member
Join Date: Feb 2012
Old 07-12-2012 , 06:05   Re: Trigger for Score / Deaths change ?
Reply With Quote #5

this is nice, thanks!

pretty hard.
waza123b 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 15:00.


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