2009-05-20 15:28:44 +02:00
|
|
|
/*
|
|
|
|
* ============================================================================
|
|
|
|
*
|
2009-07-05 08:49:23 +02:00
|
|
|
* Zombie:Reloaded
|
2009-05-20 15:28:44 +02:00
|
|
|
*
|
2009-06-12 05:51:26 +02:00
|
|
|
* File: roundstart.inc
|
|
|
|
* Type: Core
|
|
|
|
* Description: Handles round start actions.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2009 Greyscale, Richard Helgeby
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2009-05-20 15:28:44 +02:00
|
|
|
*
|
|
|
|
* ============================================================================
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* List of objective entities.
|
|
|
|
*/
|
|
|
|
#define ROUNDSTART_OBJECTIVE_ENTITIES "func_bomb_target|func_hostage_rescue|c4|hostage_entity"
|
|
|
|
|
2009-06-26 02:10:45 +02:00
|
|
|
/**
|
|
|
|
* 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);
|
|
|
|
}
|
|
|
|
|
2009-05-20 15:28:44 +02:00
|
|
|
/**
|
|
|
|
* The round is starting.
|
|
|
|
*/
|
|
|
|
RoundStartOnRoundStart()
|
|
|
|
{
|
2009-06-17 23:32:46 +02:00
|
|
|
// Print round objective to all clients.
|
|
|
|
TranslationPrintToChatAll(true, false, "General round objective");
|
|
|
|
|
2009-05-20 15:28:44 +02:00
|
|
|
// Kill all objective entities.
|
|
|
|
RoundStartKillObjectives();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Kills all objective entities.
|
|
|
|
*/
|
2009-07-21 22:25:11 +02:00
|
|
|
stock RoundStartKillObjectives()
|
2009-05-20 15:28:44 +02:00
|
|
|
{
|
|
|
|
decl String:classname[64];
|
|
|
|
|
|
|
|
// Get max entity count.
|
|
|
|
new maxentities = GetMaxEntities();
|
|
|
|
|
|
|
|
// x = entity index.
|
|
|
|
for (new x = 0; x <= maxentities; x++)
|
|
|
|
{
|
|
|
|
// If entity isn't valid, then stop.
|
|
|
|
if(!IsValidEdict(x))
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get valid edict's classname.
|
|
|
|
GetEdictClassname(x, classname, sizeof(classname));
|
|
|
|
|
|
|
|
// Check if it matches any objective entities, then stop if it doesn't.
|
2009-07-21 22:25:11 +02:00
|
|
|
if(StrContains(ROUNDSTART_OBJECTIVE_ENTITIES, classname) > -1)
|
2009-05-20 15:28:44 +02:00
|
|
|
{
|
2009-07-21 22:25:11 +02:00
|
|
|
// Entity is an objective, kill it.
|
|
|
|
RemoveEdict(x);
|
2009-05-20 15:28:44 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|