AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Trigger for Score / Deaths change ? (https://forums.alliedmods.net/showthread.php?t=189858)

waza123b 07-11-2012 20:03

Trigger for Score / Deaths change ?
 
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

Bugsy 07-11-2012 20:05

Re: Trigger for Score / Deaths change ?
 
Hook DeathMsg

waza123b 07-11-2012 20:10

Re: Trigger for Score / Deaths change ?
 
Quote:

Originally Posted by Bugsy (Post 1748385)
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(){
}


Bugsy 07-11-2012 20:32

Re: Trigger for Score / Deaths change ?
 
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;



waza123b 07-12-2012 06:05

Re: Trigger for Score / Deaths change ?
 
this is nice, thanks!

pretty hard.


All times are GMT -4. The time now is 15:00.

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