The only thing i didn't add for now is the .ini file configuration. I'd like to know if the rest works as designed before adding that feature. I have no server setup to test this on so it'll be your task to share your feedback.
PHP Code:
#include <amxmodx>
#include <fun>
#include <fakemeta>
#define pluginName "Warm-up"
#define pluginVersion "1.0"
#define pluginAuthor "LadderGoat"
#if !defined MAX_PLAYERS
#define MAX_PLAYERS 32
#endif
#pragma semicolon 1
new const soundPath[] = "sound/warmup/active.mp3";
new statusIcon;
new bool:warmupActive;
new bool:restartActive;
public plugin_init()
{
register_plugin(pluginName, pluginVersion, pluginAuthor);
register_event("HLTV", "catchNewRoundEvent", "a", "1=0", "2=0");
register_event("TextMsg", "catchRestartGameEvents", "a", "2&#Game_C", "2&#Game_w");
register_logevent("roundStartEvent", 2, "1=Round_Start");
statusIcon = get_user_msgid("StatusIcon");
register_message(statusIcon, "blockBuyZone");
}
public plugin_precache()
{
precache_generic(soundPath);
}
public catchNewRoundEvent()
{
if(restartActive)
{
new tPlayers[MAX_PLAYERS], ctPlayers[MAX_PLAYERS], tCount, ctCount;
get_players(tPlayers, tCount, "e", "TERRORIST");
get_players(ctPlayers, ctCount, "e", "CT");
if(tCount && ctCount)
{
warmupActive = true;
}
restartActive = false;
}
}
public catchRestartGameEvents()
{
restartActive = true;
}
public roundStartEvent()
{
if(warmupActive)
{
new allPlayers[MAX_PLAYERS], allPlayerCount;
new playerID;
get_players(allPlayers, allPlayerCount, "a");
for(new player; player < allPlayerCount; player++)
{
playerID = allPlayers[player];
strip_user_weapons(playerID);
give_item(playerID, "weapon_knife");
give_item(playerID, "weapon_flashbang");
set_user_maxspeed(playerID, get_user_maxspeed(playerID) + 150.0);
client_cmd(playerID, "mp3 play %s", soundPath);
}
}
}
public blockBuyZone(messageID, messageDest, playerID)
{
if(warmupActive)
{
static statusIcon[8];
get_msg_arg_string(2, statusIcon, charsmax(statusIcon));
if(equal(statusIcon, "buyzone") && get_msg_arg_int(1))
{
set_pdata_int(playerID, 235, get_pdata_int(playerID, 235) & ~(1 << 0));
return PLUGIN_HANDLED;
}
}
return PLUGIN_CONTINUE;
}
__________________