@@ -37,6 +37,7 @@ If you have questions concerning this license or the applicable additional terms
3737#include "g_q3f_admin.h"
3838#include "g_q3f_team.h"
3939#include "g_q3f_flag.h"
40+ #include "g_q3f_eventlog.h"
4041
4142#include "g_bot_interface.h"
4243#ifdef BUILD_LUA
@@ -1574,6 +1575,7 @@ qboolean ClientSpawn(gentity_t *ent) {
15741575 int flags , savedPing , i ;
15751576 g_q3f_playerclass_t * cls ;
15761577 qboolean beginclass = qfalse ;
1578+ int oldclass = Q3F_CLASS_NULL ;
15771579 g_q3f_location_t * deathloc , * gren1loc , * gren2loc ;
15781580 int eventSequence ;
15791581 char userinfo [MAX_INFO_STRING ];
@@ -1587,6 +1589,7 @@ qboolean ClientSpawn(gentity_t *ent) {
15871589 // Golliwog: If class has changed, perform class term/init functions
15881590 if ( client -> ps .persistant [PERS_CURRCLASS ] != client -> sess .sessionClass )
15891591 {
1592+ oldclass = client -> ps .persistant [PERS_CURRCLASS ];
15901593 // RR2DO2: check for classlimits
15911594 if ( g_q3f_teamlist [ent -> client -> sess .sessionTeam ].classmaximums [client -> sess .sessionClass ] == -1 ||
15921595 g_q3f_teamlist [ent -> client -> sess .sessionTeam ].classmaximums [client -> sess .sessionClass ] > G_Q3F_ClassCount (ent -> client -> sess .sessionTeam , client -> sess .sessionClass ) ||
@@ -1783,6 +1786,15 @@ qboolean ClientSpawn(gentity_t *ent) {
17831786 G_LuaHook_ClientSpawn (ent - g_entities );
17841787#endif
17851788
1789+ if (!Q3F_IsSpectator (client )) {
1790+ G_EventLog_PlayerStart (ent );
1791+ if (beginclass ) {
1792+ int timeplayed = client -> pers .class_time > 0 ? level .time - client -> pers .class_time : 0 ;
1793+ G_EventLog_ChangeClass (ent , oldclass , client -> ps .persistant [PERS_CURRCLASS ], timeplayed );
1794+ client -> pers .class_time = level .time ;
1795+ }
1796+ }
1797+
17861798 // run a client frame to drop exactly to the floor,
17871799 // initialize animations and other things
17881800 client -> ps .commandTime = level .time - 100 ;
0 commit comments