View Single Post
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 11-16-2022 , 07:38   Re: [L4D2] How to detect winner teams ?
Reply With Quote #5

You can look server events with:
sm_cvar net_showevents 2

To log those:
Code:
sm_cvar con_logtimestamp 1
sm_cvar con_logfile mylogs.log // use .log file name extension
Sometimes server not follow all events in some cases.
Use plugin for that.
Here is one of those plugins, it will print in server console events with parameters.
-Snip- Hook Events From Files

But use above things only for testing debug/purpose, these will lag server a lot (because lot of printing in console)


Quote:
Originally Posted by alasfourom View Post
Hello guys,

When trying to detect winners team for l4d2 while hooking round_end event, winners team will be equal to 0 ???

If this method doesnt work, is there any other way to do so?

Thanks

PHP Code:
#pragma semicolon 1#pragma newdecls required#include <sourcemod>#include <sdkhooks>#include <sdktools>public void OnPluginStart(){    HookEvent("round_end", Event_RoundEnd);}void Event_RoundEnd(Event event, const char[] name, bool dontBroadcast){    int WinnerTeam = GetEventInt(event, "winner");        for (int i = 1; i <= MaxClients; i++)    {        if(GetClientTeam(i) == WinnerTeam) PrintToChat(i, "Winner Team == %d", WinnerTeam);        else PrintToChat(i, "Losing Team != %d", WinnerTeam);    }} 
__________________
Do not Private Message @me
Bacardi is offline