From 1005cd73a4e72ee1338e063d10197590b711ecae Mon Sep 17 00:00:00 2001 From: Richard Helgeby Date: Thu, 4 Feb 2010 23:53:58 +0100 Subject: [PATCH] Fixed admin classes not restored from cookies. --- src/zombiereloaded.sp | 11 +++++++++++ src/zr/playerclasses/classevents.inc | 23 +++++++++++++++++------ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/zombiereloaded.sp b/src/zombiereloaded.sp index 9b8e5c0..480053b 100644 --- a/src/zombiereloaded.sp +++ b/src/zombiereloaded.sp @@ -242,6 +242,17 @@ public OnClientPutInServer(client) ZHPClientInit(client); } +/** + * Client is authorized and fully in-game. + * + * @param client Client index. + */ +public OnClientPostAdminCheck(client) +{ + // Forward authorized event to modules that depend on client admin info. + ClassOnClientAuthorized(client); +} + /** * Client is leaving the server. * diff --git a/src/zr/playerclasses/classevents.inc b/src/zr/playerclasses/classevents.inc index e197cd3..f093a5f 100644 --- a/src/zr/playerclasses/classevents.inc +++ b/src/zr/playerclasses/classevents.inc @@ -67,14 +67,9 @@ ClassOnMapStart() */ ClassClientInit(client) { - // Check if there are valid classes and the client is valid. - // To prevent bots or SourceTV causing errors. If classes are invalid this - // event was executed before classes were loaded. + // Check if classes are loaded successfully and the client is valid. if (ClassValidated && ZRIsClientValid(client)) { - // Set default class indexes on the player. - ClassClientSetDefaultIndexes(client); - // Forward event to sub-modules. ClassOverlayClientInit(client); } @@ -83,6 +78,22 @@ ClassClientInit(client) ClassPlayerSpawned[client] = false; } +/** + * Event callback for authorized clients when they're connecting. + * (OnClientPostAdminCheck) + * + * @param client Client index. + */ +ClassOnClientAuthorized(client) +{ + // Check if classes are loaded successfully and the client is valid. + if (ClassValidated && ZRIsClientValid(client)) + { + // Set default class indexes on the player. + ClassClientSetDefaultIndexes(client); + } +} + /** * Called a client disconnects. */