From 07b4ed9373b7df6df7e6d1041f466606d9af9626 Mon Sep 17 00:00:00 2001 From: Richard Helgeby Date: Mon, 5 Apr 2010 00:54:21 +0200 Subject: [PATCH] Imported fix from dev: 686:b0fc2136d03a - Fixed class attributes applied to early (moved to spawn post event). FOV (and possibly other stuff) was reset on spawn. --- src/zr/event.inc | 3 ++- src/zr/playerclasses/classevents.inc | 22 ++++++++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) 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.