Raised This Month: $ Target: $400
 0% 

[CSS] player_score not executed


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nerus
Senior Member
Join Date: Aug 2010
Location: Poland
Old 01-09-2017 , 13:05   [CSS] player_score not executed
Reply With Quote #1

Hi,

why this event not working in CSS ?

Event exist in hl2/resource/gameevents.res

PHP Code:
    "player_score"                // players scores changed
    
{
        
"userid"    "short"        // user ID on server
        
"kills"        "short"        // # of kills
        
"deaths"    "short"        // # of deaths
        
"score"        "short"        // total game score
    

Test code:
PHP Code:
public void OnPluginStart()
{    
    
PrintToServer("Test plugin start");

    
HookEvent("player_score"OnPlayerSoreChangedEventHookMode_Post);
}

public 
void OnPlayerSoreChanged(Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientFromEvent(event);

    
int kills GetEventInt(event"kills");

    
int deaths GetEventInt(event"deaths");

    
int score GetEventInt(event"score");
    
    
PrintToChat(client"Your scores changed: kills: %d, deaths: %d, score: %d"killsdeathsscore);

Even client is invalid, we will not see any errors occurred - why is not fired ?

Regards,
Nerus.
Nerus is offline
psychonic

BAFFLED
Join Date: May 2008
Old 01-09-2017 , 13:45   Re: [CSS] player_score not executed
Reply With Quote #2

Not all games use or fire all events in the generic event files (nor even in their game-specific one.). Also not the case for this one, but keep in mind that some events can be fired by the client (to all client listeners) rather than only from the server (to server and/or client listeners).
psychonic is offline
Nerus
Senior Member
Join Date: Aug 2010
Location: Poland
Old 01-11-2017 , 11:33   Re: [CSS] player_score not executed
Reply With Quote #3

Quote:
Originally Posted by psychonic View Post
Not all games use or fire all events in the generic event files (nor even in their game-specific one.). Also not the case for this one, but keep in mind that some events can be fired by the client (to all client listeners) rather than only from the server (to server and/or client listeners).
OK, then I need to use some events on clients to around it.

Second thing: Is any way to create event on client money change via GUI ?

I found: "HookUserMessage", is this correct function to hook account value and if is correct then with type of message I need to hookup ?
Nerus 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 23:45.


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