From 735839c19c909d068d0da11cfd870da32ae02a74 Mon Sep 17 00:00:00 2001 From: Greyscale Date: Thu, 25 Jun 2009 17:10:45 -0700 Subject: [PATCH] Moved ZMenu reminder to roundstart module, and fixed bug where it would be printed twice when connecting/spawning. --- src/zr/event.inc | 11 +---------- src/zr/roundstart.inc | 27 +++++++++++++++++++++++++++ src/zr/weapons/zmarket.inc | 6 ++++++ 3 files changed, 34 insertions(+), 10 deletions(-) diff --git a/src/zr/event.inc b/src/zr/event.inc index b98c157..2c609c7 100644 --- a/src/zr/event.inc +++ b/src/zr/event.inc @@ -184,6 +184,7 @@ public Action:EventPlayerSpawn(Handle:event, const String:name[], bool:dontBroad AccountOnClientSpawn(index); // Some modules depend on this to finish first. ClassOnClientSpawn(index); WeaponsOnClientSpawn(index); + RoundStartOnClientSpawn(index); SEffectsOnClientSpawn(index); SpawnProtectOnClientSpawn(index); RespawnOnClientSpawn(index); @@ -191,16 +192,6 @@ public Action:EventPlayerSpawn(Handle:event, const String:name[], bool:dontBroad ZHPOnClientSpawn(index); VolOnPlayerSpawn(index); - // Get public chat trigger prefix. - decl String:publictrigger[4]; - SayHooksGetPublicChatTrigger(publictrigger, sizeof(publictrigger)); - - // If public chat trigger is disabled, then don't print message. - if (!StrEqual(publictrigger, "N/A", false)) - { - TranslationPrintToChat(index, "General zmenu reminder", publictrigger, SAYHOOKS_KEYWORD_ZMENU); - } - // Fire post player_spawn event. CreateTimer(0.0, EventPlayerSpawnPost, index); } diff --git a/src/zr/roundstart.inc b/src/zr/roundstart.inc index afeaf0c..bcc6b27 100644 --- a/src/zr/roundstart.inc +++ b/src/zr/roundstart.inc @@ -30,6 +30,33 @@ */ #define ROUNDSTART_OBJECTIVE_ENTITIES "func_bomb_target|func_hostage_rescue|c4|hostage_entity" +/** + * Client is spawning into the game. + * + * @param client The client index. + */ +RoundStartOnClientSpawn(client) +{ + // If client hasn't spawned yet, then stop. + if (!IsPlayerAlive(client)) + { + return; + } + + // Get public chat trigger prefix. + decl String:publictrigger[4]; + SayHooksGetPublicChatTrigger(publictrigger, sizeof(publictrigger)); + + // If public chat trigger is disabled, then don't print message. + if (StrEqual(publictrigger, "N/A", false)) + { + return; + } + + // Print to client, how to access ZMenu. + TranslationPrintToChat(client, "General zmenu reminder", publictrigger, SAYHOOKS_KEYWORD_ZMENU); +} + /** * The round is starting. */ diff --git a/src/zr/weapons/zmarket.inc b/src/zr/weapons/zmarket.inc index 7fa6359..01ce6f7 100644 --- a/src/zr/weapons/zmarket.inc +++ b/src/zr/weapons/zmarket.inc @@ -161,6 +161,12 @@ ZMarketOnClientSpawnPost(client) return; } + // If client is a zombie, then stop. + if (InfectIsClientInfected(client)) + { + return; + } + // If auto-rebuy is enabled, then force client to rebuy weapons. if (CookiesGetClientCookieBool(client, g_hZMarketAutoRebuyCookie)) {