diff --git a/VScripts/scripting/vscript_ze_dreamin_v2.sp b/VScripts/scripting/vscript_ze_dreamin_v2.sp new file mode 100644 index 00000000..79bda157 --- /dev/null +++ b/VScripts/scripting/vscript_ze_dreamin_v2.sp @@ -0,0 +1,721 @@ +#pragma semicolon 1 + +#include +#include +#include + +#pragma newdecls required + +#define MAXTIMERS 128 + +/* STRINGS */ + +/* CONVARS */ + +/* HANDLES */ +Handle g_hTimers[MAXTIMERS] = {INVALID_HANDLE, ...}; + +/* BOOLS */ + +/* INTEGERS */ +int g_iTimerCount = 0; + + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public Plugin myinfo = +{ + name = "ze_dreamin VScript", + author = "Neon", + description = "", + version = "1.0", + url = "https://steamcommunity.com/id/n3ontm" +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void OnPluginStart() +{ + HookEvent("round_start", OnRoundStart); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void OnMapStart() +{ + VerifyMap(); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void VerifyMap() +{ + char currentMap[64]; + GetCurrentMap(currentMap, sizeof(currentMap)); + if (strcmp(currentMap, "ze_dreamin_v2csstest", false) != 0) + { + char sFilename[256]; + GetPluginFilename(INVALID_HANDLE, sFilename, sizeof(sFilename)); + ServerCommand("sm plugins unload %s", sFilename); + } +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast) +{ + + for (int i = 0; i <= (MAXTIMERS - 1); i++) + { + if (g_hTimers[i] != INVALID_HANDLE && CloseHandle(g_hTimers[i])) + g_hTimers[i] = INVALID_HANDLE; + } + g_iTimerCount = 0; + + + int iEntity = INVALID_ENT_REFERENCE; + + iEntity = FindEntityByTargetName("reflect_logic"); + if (iEntity != INVALID_ENT_REFERENCE) + HookSingleEntityOutput(iEntity, "OnFalse", st3_hitbox_reflect, false); + + iEntity = FindEntityByTargetName("upline_timer"); + if (iEntity != INVALID_ENT_REFERENCE) + HookSingleEntityOutput(iEntity, "OnTimer", upline_maker_upline, false); + + iEntity = FindEntityByTargetName("explo_timer"); + if (iEntity != INVALID_ENT_REFERENCE) + HookSingleEntityOutput(iEntity, "OnTimer", explo_maker_setan, false); + + iEntity = FindEntityByTargetName("linelaser_random"); + if (iEntity != INVALID_ENT_REFERENCE) + { + HookSingleEntityOutput(iEntity, "OnCase01", linelaser_maker_left, false); + HookSingleEntityOutput(iEntity, "OnCase02", linelaser_maker_right, false); + } + + iEntity = FindEntityByTargetName("totem_random"); + if (iEntity != INVALID_ENT_REFERENCE) + { + HookSingleEntityOutput(iEntity, "OnCase01", push_maker_setrandom, false); + HookSingleEntityOutput(iEntity, "OnCase02", heal_maker_setrandom, false); + HookSingleEntityOutput(iEntity, "OnCase03", stable_maker_setrandom, false); + HookSingleEntityOutput(iEntity, "OnCase04", rotate_maker_setrandom, false); + } + + iEntity = FindEntityByTargetName("spike_timer"); + if (iEntity != INVALID_ENT_REFERENCE) + HookSingleEntityOutput(iEntity, "OnTimer", spike_maker_top, false); + + iEntity = FindEntityByHammerID(389450); + if (iEntity != INVALID_ENT_REFERENCE) + HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_389450_display, false); + + iEntity = FindEntityByHammerID(385777); + if (iEntity != INVALID_ENT_REFERENCE) + HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_385777_display, false); + + iEntity = FindEntityByHammerID(385886); + if (iEntity != INVALID_ENT_REFERENCE) + HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_385886_display, false); + + iEntity = FindEntityByHammerID(386004); + if (iEntity != INVALID_ENT_REFERENCE) + HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_386004_display, false); + + iEntity = FindEntityByHammerID(381396); + if (iEntity != INVALID_ENT_REFERENCE) + HookSingleEntityOutput(iEntity, "OnPressed", func_button_381396_display, false); + + iEntity = FindEntityByHammerID(381463); + if (iEntity != INVALID_ENT_REFERENCE) + HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_381463_display, false); + + iEntity = FindEntityByHammerID(381581); + if (iEntity != INVALID_ENT_REFERENCE) + HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_381581_display, false); + + iEntity = FindEntityByHammerID(381648); + if (iEntity != INVALID_ENT_REFERENCE) + HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_381648_display, false); + + iEntity = FindEntityByHammerID(378212); + if (iEntity != INVALID_ENT_REFERENCE) + HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_378212_display, false); + + iEntity = FindEntityByHammerID(375007); + if (iEntity != INVALID_ENT_REFERENCE) + HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_375007_display, false); + + iEntity = FindEntityByHammerID(241061); + if (iEntity != INVALID_ENT_REFERENCE) + HookSingleEntityOutput(iEntity, "OnPressed", func_button_241061_display, false); + + iEntity = FindEntityByHammerID(213033); + if (iEntity != INVALID_ENT_REFERENCE) + HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_213033_display, false); + + iEntity = FindEntityByHammerID(142829); + if (iEntity != INVALID_ENT_REFERENCE) + HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_142829_display, false); + + iEntity = FindEntityByHammerID(95608); + if (iEntity != INVALID_ENT_REFERENCE) + HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_95608_display, false); + + iEntity = FindEntityByHammerID(95733); + if (iEntity != INVALID_ENT_REFERENCE) + HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_95733_display, false); + + iEntity = FindEntityByHammerID(95823); + if (iEntity != INVALID_ENT_REFERENCE) + HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_95823_display, false); + + iEntity = FindEntityByHammerID(77927); + if (iEntity != INVALID_ENT_REFERENCE) + HookSingleEntityOutput(iEntity, "OnPressed", func_button_77927_display, false); + + iEntity = FindEntityByHammerID(23408); + if (iEntity != INVALID_ENT_REFERENCE) + HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_23408_display, false); + + iEntity = FindEntityByHammerID(23452); + if (iEntity != INVALID_ENT_REFERENCE) + HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_23452_display, false); + + iEntity = FindEntityByHammerID(23474); + if (iEntity != INVALID_ENT_REFERENCE) + HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_23474_display, false); + + iEntity = FindEntityByHammerID(23551); + if (iEntity != INVALID_ENT_REFERENCE) + HookSingleEntityOutput(iEntity, "OnBreak", func_breakable_23551_display, false); + + iEntity = FindEntityByHammerID(21950); + if (iEntity != INVALID_ENT_REFERENCE) + HookSingleEntityOutput(iEntity, "OnPressed", func_button_21950_display, false); + + iEntity = FindEntityByHammerID(22017); + if (iEntity != INVALID_ENT_REFERENCE) + HookSingleEntityOutput(iEntity, "OnPressed", func_button_22017_display, false); + + iEntity = FindEntityByHammerID(3664); + if (iEntity != INVALID_ENT_REFERENCE) + HookSingleEntityOutput(iEntity, "OnBreak", func_breakable_3664_display, false); + + iEntity = FindEntityByHammerID(11288); + if (iEntity != INVALID_ENT_REFERENCE) + HookSingleEntityOutput(iEntity, "OnHitMin", math_counter_11288_display, false); + + CreateTimer(12.0, Credits, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public Action Credits(Handle timer) +{ + CPrintToChatAll("{pink}[VScripts] {white}Map using VScripts ported by Neon™"); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void st3_hitbox_reflect(const char[] output, int caller, int activator, float delay) +{ + if (!IsValidClient(activator)) + return; + + int iHealth = GetClientHealth(activator); + + if(iHealth > 10) + { + SetEntityHealth(activator, iHealth - 10); + } + else + { + SetEntityHealth(activator, 1); + } +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void upline_maker_upline(const char[] output, int caller, int activator, float delay) +{ + float fOrigin[3]; + fOrigin[0] = GetRandomFloat(-1280.0, 1280.0); + fOrigin[1] = GetRandomFloat(-1280.0, 1280.0); + fOrigin[2] = -2780.0; + + int iEntity = INVALID_ENT_REFERENCE; + + iEntity = FindEntityByTargetName("upline_maker"); + if (iEntity != INVALID_ENT_REFERENCE) + TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void explo_maker_setan(const char[] output, int caller, int activator, float delay) +{ + float fAngles[3]; + fAngles[0] = 0.0; + fAngles[1] = GetRandomFloat(0.0, 359.0); + fAngles[2] = 0.0; + + int iEntity = INVALID_ENT_REFERENCE; + + iEntity = FindEntityByTargetName("explo_maker"); + if (iEntity != INVALID_ENT_REFERENCE) + TeleportEntity(iEntity, NULL_VECTOR, fAngles, NULL_VECTOR); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void linelaser_maker_left(const char[] output, int caller, int activator, float delay) +{ + float fOrigin[3]; + fOrigin[0] = 0.0; + fOrigin[1] = GetRandomFloat(-640.0, 640.0); + fOrigin[2] = -1780.0; + + float fAngles[3]; + fAngles[0] = 0.0; + fAngles[1] = 0.0; + fAngles[2] = 0.0; + + int iEntity = INVALID_ENT_REFERENCE; + + iEntity = FindEntityByTargetName("linelaser_maker"); + if (iEntity != INVALID_ENT_REFERENCE) + TeleportEntity(iEntity, fOrigin, fAngles, NULL_VECTOR); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void linelaser_maker_right(const char[] output, int caller, int activator, float delay) +{ + float fOrigin[3]; + fOrigin[0] = 0.0; + fOrigin[1] = GetRandomFloat(-640.0, 640.0); + fOrigin[2] = -1820.0; + + float fAngles[3]; + fAngles[0] = 0.0; + fAngles[1] = 90.0; + fAngles[2] = 0.0; + + int iEntity = INVALID_ENT_REFERENCE; + + iEntity = FindEntityByTargetName("linelaser_maker"); + if (iEntity != INVALID_ENT_REFERENCE) + TeleportEntity(iEntity, fOrigin, fAngles, NULL_VECTOR); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void push_maker_setrandom(const char[] output, int caller, int activator, float delay) +{ + float fOrigin[3]; + fOrigin[0] = GetRandomFloat(-768.0, 768.0); + fOrigin[1] = GetRandomFloat(-768.0, 768.0); + fOrigin[2] = -2720.0; + + int iEntity = INVALID_ENT_REFERENCE; + + iEntity = FindEntityByTargetName("push_maker"); + if (iEntity != INVALID_ENT_REFERENCE) + TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void heal_maker_setrandom(const char[] output, int caller, int activator, float delay) +{ + float fOrigin[3]; + fOrigin[0] = GetRandomFloat(-768.0, 768.0); + fOrigin[1] = GetRandomFloat(-768.0, 768.0); + fOrigin[2] = -2720.0; + + int iEntity = INVALID_ENT_REFERENCE; + + iEntity = FindEntityByTargetName("heal_maker"); + if (iEntity != INVALID_ENT_REFERENCE) + TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void stable_maker_setrandom(const char[] output, int caller, int activator, float delay) +{ + float fOrigin[3]; + fOrigin[0] = GetRandomFloat(-768.0, 768.0); + fOrigin[1] = GetRandomFloat(-768.0, 768.0); + fOrigin[2] = -2720.0; + + int iEntity = INVALID_ENT_REFERENCE; + + iEntity = FindEntityByTargetName("stable_maker"); + if (iEntity != INVALID_ENT_REFERENCE) + TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void rotate_maker_setrandom(const char[] output, int caller, int activator, float delay) +{ + float fOrigin[3]; + fOrigin[0] = GetRandomFloat(-768.0, 768.0); + fOrigin[1] = GetRandomFloat(-768.0, 768.0); + fOrigin[2] = -2720.0; + + int iEntity = INVALID_ENT_REFERENCE; + + iEntity = FindEntityByTargetName("rotate_maker"); + if (iEntity != INVALID_ENT_REFERENCE) + TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void spike_maker_top(const char[] output, int caller, int activator, float delay) +{ + float fOrigin[3]; + fOrigin[0] = GetRandomFloat(12090.0, 14363.0); + fOrigin[1] = GetRandomFloat(1280.0, 3560.0); + fOrigin[2] = 1500.0; + + int iEntity = INVALID_ENT_REFERENCE; + + iEntity = FindEntityByTargetName("spike_maker"); + if (iEntity != INVALID_ENT_REFERENCE) + { + TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR); + AcceptEntityInput(iEntity, "ForceSpawn"); + } +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void trigger_once_389450_display(const char[] output, int caller, int activator, float delay) +{ + Display(30, 0); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void trigger_once_385777_display(const char[] output, int caller, int activator, float delay) +{ + Display(20, 0); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void trigger_once_385886_display(const char[] output, int caller, int activator, float delay) +{ + Display(20, 0); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void trigger_once_386004_display(const char[] output, int caller, int activator, float delay) +{ + Display(20, 0); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void func_button_381396_display(const char[] output, int caller, int activator, float delay) +{ + Display(30, 0); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void trigger_once_381463_display(const char[] output, int caller, int activator, float delay) +{ + Display(30, 0); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void trigger_once_381581_display(const char[] output, int caller, int activator, float delay) +{ + Display(50, 0); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void trigger_once_381648_display(const char[] output, int caller, int activator, float delay) +{ + Display(30, 0); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void trigger_once_378212_display(const char[] output, int caller, int activator, float delay) +{ + Display(30, 0); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void trigger_once_375007_display(const char[] output, int caller, int activator, float delay) +{ + Display(20, 0); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void func_button_241061_display(const char[] output, int caller, int activator, float delay) +{ + Display(30, 0); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void trigger_once_213033_display(const char[] output, int caller, int activator, float delay) +{ + Display(30, 0); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void trigger_once_142829_display(const char[] output, int caller, int activator, float delay) +{ + Display(20, 0); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void trigger_once_95608_display(const char[] output, int caller, int activator, float delay) +{ + Display(30, 0); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void trigger_once_95733_display(const char[] output, int caller, int activator, float delay) +{ + Display(30, 0); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void trigger_once_95823_display(const char[] output, int caller, int activator, float delay) +{ + Display(30, 0); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void func_button_77927_display(const char[] output, int caller, int activator, float delay) +{ + Display(30, 0); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void trigger_once_23408_display(const char[] output, int caller, int activator, float delay) +{ + Display(35, 0); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void trigger_once_23452_display(const char[] output, int caller, int activator, float delay) +{ + Display(20, 0); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void trigger_once_23474_display(const char[] output, int caller, int activator, float delay) +{ + Display(25, 0); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void func_breakable_23551_display(const char[] output, int caller, int activator, float delay) +{ + Display(20, 0); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void func_button_21950_display(const char[] output, int caller, int activator, float delay) +{ + Display(30, 0); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void func_button_22017_display(const char[] output, int caller, int activator, float delay) +{ + Display(10, 0); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void func_breakable_3664_display(const char[] output, int caller, int activator, float delay) +{ + Display(45, 0); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void math_counter_11288_display(const char[] output, int caller, int activator, float delay) +{ + Display(51, 0); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void Display(int amount, int i) +{ + float fOrigin[3]; + fOrigin[0] = 0.0; + fOrigin[1] = 0.0; + fOrigin[2] = 0.0; + + int iRelay = CreateEntityAtOrigin("logic_relay", fOrigin); + DispatchKeyFormat(iRelay, "targetname", "vscript_countdown_relay"); + DispatchKeyFormat(iRelay, "spawnflags", "0"); + DispatchKeyFormat(iRelay, "OnTrigger", "seconds_left,AddOutput,message seconds left,0,-1"); + + int x = amount; + int y = i; + for (int j = 1; j <= amount; j++) + { + if (x > y) + { + DispatchKeyFormat(iRelay, "OnTrigger", "text_sec,AddOutput,message %d,%d,-1", x - 1, j - 1); + DispatchKeyFormat(iRelay, "OnTrigger", "text_sec,Display,,%d,-1",j - 1); + DispatchKeyFormat(iRelay, "OnTrigger", "seconds_left,Display,,%d,-1",j - 1); + x = x - 1; + } + else + DispatchKeyFormat(iRelay, "OnTrigger", "!self,Kill,,%d,-1",j - 1); + + } + SpawnAndActivate(iRelay); + AcceptEntityInput(iRelay, "Trigger"); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public int FindEntityByTargetName(const char[] sTargetnameToFind) +{ + int iEntity = INVALID_ENT_REFERENCE; + while((iEntity = FindEntityByClassname(iEntity, "*")) != INVALID_ENT_REFERENCE) + { + char sTargetname[64]; + GetEntPropString(iEntity, Prop_Data, "m_iName", sTargetname, sizeof(sTargetname)); + + if (strcmp(sTargetnameToFind, sTargetname, false) == 0) + { + return iEntity; + } + } + PrintToChatAll("[VScripts] Error! Could not find entity: %s", sTargetnameToFind); + return INVALID_ENT_REFERENCE; +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public int FindEntityByHammerID(int iHammerID) +{ + int iEntity = INVALID_ENT_REFERENCE; + while((iEntity = FindEntityByClassname(iEntity, "*")) != INVALID_ENT_REFERENCE) + { + if(GetEntProp(iEntity, Prop_Data, "m_iHammerID") == iHammerID) + { + return iEntity; + } + } + PrintToChatAll("[VScripts] Error! Could not find entity: #%d", iHammerID); + return INVALID_ENT_REFERENCE; +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +stock int CreateEntityAtOrigin(const char[] classname, const float origin[3]) +{ + int entity = CreateEntityByName(classname); + + TeleportEntity(entity, origin, NULL_VECTOR, NULL_VECTOR); + + return entity; +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +stock bool DispatchKeyFormat(int entity, const char[] key, const char[] value, any ...) +{ + char buffer[1024]; + VFormat(buffer, sizeof(buffer), value, 4); + + DispatchKeyValue(entity, key, buffer); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +stock void SpawnAndActivate(int entity) +{ + DispatchSpawn(entity); + ActivateEntity(entity); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +stock bool IsValidClient(int client) +{ + return (client > 0 && client <= MaxClients && IsClientInGame(client) && IsPlayerAlive(client)); +} \ No newline at end of file