Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <sdktools>
- #pragma semicolon 1
- #pragma newdecls required
- public Plugin myinfo = {
- name = "Hard Spawns Survival",
- author = "Gravity",
- description = "no",
- version = "1.0",
- url = ""
- };
- public void OnPluginStart()
- {
- HookEvent("survival_round_start", Event_SurvStart, EventHookMode_Pre);
- HookEvent("round_start", Event_OnRoundInit, EventHookMode_Pre);
- SetConvars();
- AddCommandListener(Listener_Idle, "go_away_from_keyboard");
- }
- public void OnPluginEnd()
- {
- ResetConvars();
- }
- public void OnMapStart()
- {
- SetConvars();
- }
- public void OnClientPutInServer(int client)
- {
- if (IsFakeClient(client))
- {
- return;
- }
- if(client && IsClientInGame(client))
- {
- CreateTimer(5.0, Timer_PrintHelpMessage, GetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE);
- }
- }
- public Action Timer_PrintHelpMessage(Handle timer, any data)
- {
- int client = GetClientOfUserId(data);
- if(client && IsClientInGame(client))
- {
- PrintHelpMesssage(client);
- PrintToChat(client, "\x03Hard Spawns survival\x01 loaded.");
- }
- }
- void PrintHelpMesssage(int client)
- {
- PrintToConsole(client, "");
- PrintToConsole(client, "|--------------------------------------------------------------------|");
- PrintToConsole(client, "| Hard Spawns survival |");
- PrintToConsole(client, "|--------------------------------------------------------------------|");
- PrintToConsole(client, "| Changes: |");
- PrintToConsole(client, "| - Spawns wont shut down. |");
- PrintToConsole(client, "| - SI wont get stuck. |");
- PrintToConsole(client, "| - SI spawning intervals slightly decreased. |");
- PrintToConsole(client, "| - Spawning rules changed, infected can spawn nearly everywhere. |");
- PrintToConsole(client, "|--------------------------------------------------------------------|");
- }
- public Action Listener_Idle(int client, const char[] command, int argc)
- {
- PrintToChat(client, "Idle not allowed.");
- return Plugin_Handled;
- }
- public void Event_OnRoundInit(Event event, const char[] name, bool dontBroadcast)
- {
- // Prevent some of spawn shutdowns caused by team switching or disconnects
- SetConVarInt(FindConVar("z_spawn_range"), 10);
- }
- public void Event_SurvStart(Event event, const char[] name, bool dontBroadcast)
- {
- // Spawn range has to be reset
- ResetConVar(FindConVar("z_spawn_range"));
- CreateNavPointerEntity();
- }
- /*
- * Creates a point_nav_attribute_region entity which affects the whole map and enables a lot of additional spawns.
- * Sets two flags aka navmesh attributes:
- * Battlefield - General tag
- * Not clearable - The area is not clearable.
- */
- void CreateNavPointerEntity()
- {
- float fMins[3], fMaxs[3];
- char sMins[64], sMaxs[64];
- GetEntPropVector(0, Prop_Data, "m_WorldMaxs", fMaxs);
- GetEntPropVector(0, Prop_Data, "m_WorldMins", fMins);
- Format(sMins, sizeof(sMins), "%f %f %f", fMins[0], fMins[1], fMins[2]);
- Format(sMaxs, sizeof(sMaxs), "%f %f %f", fMaxs[0], fMaxs[1], fMaxs[2]);
- int iEntity = CreateEntityByName("point_nav_attribute_region");
- if(IsValidEdict(iEntity))
- {
- DispatchKeyValue(iEntity, "spawnflags", "1280");
- DispatchKeyValue(iEntity, "maxs", sMaxs);
- DispatchKeyValue(iEntity, "mins", sMins);
- DispatchSpawn(iEntity);
- }
- }
- void ResetConvars()
- {
- SetConVarBool(FindConVar("z_dont_clear"), false);
- ResetConVar(FindConVar("z_discard_range"));
- ResetConVar(FindConVar("z_spawn_range"));
- ResetConVar(FindConVar("survival_special_spawn_interval"));
- ResetConVar(FindConVar("survival_special_stage_interval"));
- ResetConVar(FindConVar("director_special_respawn_interval"));
- ResetConVar(FindConVar("survival_max_specials"));
- ResetConVar(FindConVar("director_afk_timeout"));
- }
- // Some of these SI limits are probably overriden by director vscripts etc.
- void SetConvars()
- {
- SetConVarBool(FindConVar("z_dont_clear"), true); // Dont allow spawn clearing
- SetConVarInt(FindConVar("z_discard_range"), 999999); // dont slay distant SI
- SetConVarInt(FindConVar("survival_special_spawn_interval"), 3);
- SetConVarInt(FindConVar("survival_special_stage_interval"), 10);
- SetConVarInt(FindConVar("director_special_respawn_interval"), 3);
- SetConVarInt(FindConVar("survival_max_specials"), 20); // Max SI alive at a time
- // AFK timeout
- SetConVarInt(FindConVar("director_afk_timeout"), 9999);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement