diff --git a/unloze_ConsoleMessages/scripting/unloze_ConsoleMessages.sp b/unloze_ConsoleMessages/scripting/unloze_ConsoleMessages.sp index cf843f82..c7f5aa49 100644 --- a/unloze_ConsoleMessages/scripting/unloze_ConsoleMessages.sp +++ b/unloze_ConsoleMessages/scripting/unloze_ConsoleMessages.sp @@ -1,18 +1,20 @@ #include #include #include +#include +#pragma newdecls required float roundStartedTime = -1.0; int g_iTextChannel; bool g_bDisabled; ConVar g_cvEnabled; -public Plugin:myinfo = +public Plugin myinfo = { name = "UNLOZE Console Messages", description = "Make console messages printed by maps more fancy", - author = "zaCade, decompiled by neon and slightly modified by jenz", - version = "1.1", + author = "zaCade, decompiled by Neon and slightly modified by jenz", + version = "1.2", url = "" }; @@ -24,12 +26,12 @@ public void OnPluginStart() public void OnMapStart() { - new bool:bChannelTaken[6]; - new bool:bChannelFound; - new entity = -1; + bool bChannelTaken[6]; + bool bChannelFound; + int entity = -1; while ((entity = FindEntityByClassname(entity, "game_text")) != -1) { - new channel = GetEntProp(entity, PropType:1, "m_textParms.channel", 4, 0); + int channel = GetEntProp(entity, Prop_Data, "m_textParms.channel", 4, 0); LogMessage("Checking channel: %d", channel); if (channel < 6) { @@ -40,7 +42,7 @@ public void OnMapStart() } } } - new channel; + int channel; while (channel < 6) { if (!bChannelTaken[channel]) @@ -65,7 +67,7 @@ public void OnMapStart() return; } -public float GetRoundTimeAtTimerEnd(number) +public float GetRoundTimeAtTimerEnd(int number) { float g = GetCurrentRoundTime() - number; return g; @@ -83,25 +85,24 @@ public void Event_RoundStart(Handle event, const char[] name, bool dontBroadcast roundStartedTime = GetEngineTime(); } - -public Action PointServerCommandForward(String:sCommand[]) +public Action PointServerCommandForward(const char[] sCommand) { if (!strncmp("say", sCommand, 3, false)) { - new String:sMessage[512]; - new i; + char sMessage[512]; + char sSecondsAppend[32]; + bool found_numeric = false; + int i; while (strlen(sCommand) + -4 > i) { sMessage[i] = sCommand[i + 4]; i++; } - new String:sSecondsAppend[32]; - bool found_numeric = false; if (StrContains(sMessage, "sec", false) != -1) { - new indexTracker = -1 - new endIndexTracker = -1 - for (new j = 0; j <= strlen(sMessage); ++j) + int indexTracker = -1 + int endIndexTracker = -1 + for (int j = 0; j < strlen(sMessage); ++j) { if (IsCharNumeric(sMessage[j])) { @@ -123,12 +124,12 @@ public Action PointServerCommandForward(String:sCommand[]) { endIndexTracker = strlen(sMessage); } - new String:SecondsLocal[512]; - for (new ij = indexTracker; ij <= endIndexTracker; ij++) + char SecondsLocal[512]; + for (int ij = indexTracker; ij < endIndexTracker; ij++) { StrCat(SecondsLocal, sizeof(SecondsLocal), sMessage[ij]); } - new number = StringToInt(SecondsLocal); + int number = StringToInt(SecondsLocal); //PrintToChatAll("number: %i", number); if (GetRoundTimeAtTimerEnd(number) > 0.0) { @@ -151,7 +152,7 @@ public Action PointServerCommandForward(String:sCommand[]) { if (g_cvEnabled.BoolValue) { - new Handle:hMessage = StartMessageAll("HudMsg", 0); + Handle hMessage = StartMessageAll("HudMsg", 0); if (hMessage) { BfWriteByte(hMessage, g_iTextChannel); @@ -175,9 +176,9 @@ public Action PointServerCommandForward(String:sCommand[]) } } } - return Action:4; + return Plugin_Handled; } - return Action:0; + return Plugin_Continue; } stock void FormatPlayerTime(float Time, char[] result, int maxlength, bool showDash, int precision)