diff --git a/src/zr/event.inc b/src/zr/event.inc index c666693..95e8bfb 100644 --- a/src/zr/event.inc +++ b/src/zr/event.inc @@ -214,7 +214,8 @@ public Action:EventPlayerSpawnPost(Handle:timer, any:client) // Forward event to modules. WeaponsOnClientSpawnPost(client); SEffectsOnClientSpawnPost(client); - SpawnProtectOnClientSpawnPost(client); + ClassOnClientSpawnPost(client); + SpawnProtectOnClientSpawnPost(client); // Must be executed after class attributes are applied. } /** diff --git a/src/zr/playerclasses/classevents.inc b/src/zr/playerclasses/classevents.inc index 4bc8124..fcbc51c 100644 --- a/src/zr/playerclasses/classevents.inc +++ b/src/zr/playerclasses/classevents.inc @@ -247,9 +247,10 @@ ClassOnClientSpawn(client) } } - // Apply class attributes for the active class. + // Load class attributes for the active class. ClassReloadPlayerCache(client, ClassGetActiveIndex(client)); - ClassApplyAttributes(client); + + // Note: Class attributes are applied in ClassOnClientSpawnPost. // Check if instant class change cvar is set. new Float:instantspawn = GetConVarFloat(g_hCvarsList[CVAR_CLASSES_CHANGE_TIMELIMIT]); @@ -268,6 +269,23 @@ ClassOnClientSpawn(client) } } +/** + * Client have just spawned (delayed event). + * + * @param client The client index. + */ +ClassOnClientSpawnPost(client) +{ + // Check if there are no valid classes. Block this event if classes aren't + // done loading. + if (!ClassValidated) + { + return; + } + + ClassApplyAttributes(client); +} + /** * Client died. Stops timers and reset certain attributes. Call this event to * clean up class related stuff.