diff --git a/VScripts/scripting/include/vscripts.inc b/VScripts/scripting/include/vscripts.inc index 38d4848c..b3f421df 100644 --- a/VScripts/scripting/include/vscripts.inc +++ b/VScripts/scripting/include/vscripts.inc @@ -30,7 +30,7 @@ public int GetEntityIndexByName(const char[] name, const char[] classname){ return -1; } -public int FindEntityByClassnameWithin(int startEnt, const char[] classname, const float[3] origin, const float radius){ //Tested. Works properly. +public int FindEntityByClassnameWithin(int startEnt, const char[] classname, const float origin[3], const float radius){ //Tested. Works properly. float torigin[3]; while((startEnt = FindEntityByClassname(startEnt,classname))!= -1){ GetOrigin(startEnt, torigin); @@ -39,7 +39,7 @@ public int FindEntityByClassnameWithin(int startEnt, const char[] classname, con return -1; } -public float TraceLine(const float[3] origin, const float[3] v2, int entity){ //Tested. Works properly +public float TraceLine(const float origin[3], const float v2[3], int entity){ //Tested. Works properly Handle trace = TR_TraceRayFilterEx(origin, v2, CONTENTS_SOLID, RayType_EndPoint, TraceEntityFilterSelf, entity); float pos[3], dist = 1.0; if(TR_DidHit(trace)){ @@ -55,27 +55,27 @@ public bool TraceEntityFilterSelf(int entity, int contentsMask, any data) return (data != entity && entity > 64); } -public void GetOrigin(int entity, float[3] buffer){ //Tested. Works properly. +public void GetOrigin(int entity, float buffer[3]){ //Tested. Works properly. if(IsValidEntity(entity)) GetEntPropVector(entity, Prop_Send, "m_vecOrigin", buffer); } -public void GetAngles(int entity, float[3] buffer){ //Gives you wrong values after spawn it via env_entity_maker +public void GetAngles(int entity, float buffer[3]){ //Gives you wrong values after spawn it via env_entity_maker if(IsValidEntity(entity)) GetEntPropVector(entity, Prop_Send, "m_angRotation", buffer); } -public void SetAngles(int entity, const float[3] buffer){ //Tested. Works properly. +public void SetAngles(int entity, const float buffer[3]){ //Tested. Works properly. if(IsValidEntity(entity)) TeleportEntity(entity, NULL_VECTOR, buffer, NULL_VECTOR); } -public void SetOrigin(int entity, const float[3] buffer){ //Tested. Works properly. +public void SetOrigin(int entity, const float buffer[3]){ //Tested. Works properly. if(IsValidEntity(entity)) TeleportEntity(entity, buffer, NULL_VECTOR, NULL_VECTOR); } -public void GetForwardVector(int entity, float[3] buffer) //Tested. Works properly. +public void GetForwardVector(int entity, float buffer[3]) //Tested. Works properly. { if(IsValidEntity(entity)) { @@ -85,7 +85,7 @@ public void GetForwardVector(int entity, float[3] buffer) //Tested. Works proper } } -public void SetForwardVector(int entity, const float[3] buffer) //Tested. Works properly. +public void SetForwardVector(int entity, const float buffer[3]) //Tested. Works properly. { if(IsValidEntity(entity)) { @@ -134,4 +134,4 @@ public Action InputDelay(Handle timer, DataPack data) SetVariantString(parametr); AcceptEntityInput(target, input, activator); } -} \ No newline at end of file +} diff --git a/VScripts/scripting/include/vscripts/Aesthetic.inc b/VScripts/scripting/include/vscripts/Aesthetic.inc index 13000f9c..18857e2a 100644 --- a/VScripts/scripting/include/vscripts/Aesthetic.inc +++ b/VScripts/scripting/include/vscripts/Aesthetic.inc @@ -208,7 +208,7 @@ const float DEFAULT_PER_FRAME_MAX_VEL_DELTA = 0.0003333; // 2.0 / (120.0 * 50.0) const float DEFAULT_PER_FRAME_MAX_ACC_DELTA = 0.0000125; // 0.075 / (120.0 * 50.0); #define PI 3.14159 -public bool SphereCollideWithWorld(const float[3] orig, const float radius, float degree, float[3] buffer, int entity) +public bool SphereCollideWithWorld(const float orig[3], const float radius, float degree, float buffer[3], int entity) { float inc = PI / degree; @@ -371,22 +371,22 @@ methodmap Eye < Basic } } - public void GetVel(float[3] vel) + public void GetVel(float vel[3]) { this.GetVector("vVel", vel); } - public void SetVel(const float[3] vel) + public void SetVel(const float vel[3]) { this.SetVector("vVel", vel); } - public void GetAcc(float[3] acc) + public void GetAcc(float acc[3]) { this.GetVector("vAcc", acc); } - public void SetAcc(const float[3] acc) + public void SetAcc(const float acc[3]) { this.SetVector("vAcc", acc); } @@ -565,4 +565,4 @@ methodmap Eye < Basic } } -} \ No newline at end of file +} diff --git a/VScripts/scripting/include/vscripts/JJBA.inc b/VScripts/scripting/include/vscripts/JJBA.inc index 442b8899..c3ab0f2a 100644 --- a/VScripts/scripting/include/vscripts/JJBA.inc +++ b/VScripts/scripting/include/vscripts/JJBA.inc @@ -12,14 +12,14 @@ #define SPEED_FORWARD 1.0 #define SPEED_TURNING 0.5 -stock float FloatMod(float num, float denom) +stock float FloatMod1(float num, float denom) { return num - denom * RoundToFloor(num / denom); } stock float operator%(float oper1, float oper2) { - return FloatMod(oper1, oper2); + return FloatMod1(oper1, oper2); } public bool IsValidPlayer(int player) @@ -27,7 +27,7 @@ public bool IsValidPlayer(int player) return player >= 1 && player <= 64 && IsValidEntity(player) && IsPlayerAlive(player); } -public float GetDistance(const float[3] v1, const float[3] v2) +public float GetDistance(const float v1[3], const float v2[3]) { return SquareRoot((v1[0] - v2[0]) * (v1[0] - v2[0]) + (v1[1] - v2[1]) * (v1[1] - v2[1]) + (v1[2] - v2[2]) * (v1[2] - v2[2])); } @@ -130,9 +130,8 @@ methodmap MovingNpc < Basic } } - public float GetTargetYaw(const float[3] start, const float[3] target) + public float GetTargetYaw(const float start[3], const float target[3]) { - float yaw = 0.00; float v[3]; SubtractVectors(start, target, v); diff --git a/VScripts/scripting/vscript_Aesthetic.sp b/VScripts/scripting/vscript_Aesthetic.sp index 4b929a6c..f02d4512 100644 --- a/VScripts/scripting/vscript_Aesthetic.sp +++ b/VScripts/scripting/vscript_Aesthetic.sp @@ -36,83 +36,77 @@ public void OnMapStart() HookEvent("round_end", OnRoundEnd, EventHookMode_PostNoCopy); g_aEyes = new ArrayList(); } - else - { - char sFilename[256]; - GetPluginFilename(INVALID_HANDLE, sFilename, sizeof(sFilename)); - - ServerCommand("sm plugins unload %s", sFilename); - } } public void OnRoundStart(Event event, const char[] name, bool dontBroadcast) { - if(!bValidMap) - return; - g_Chess = new Chess(GetEntityIndexByName("GreenStart", "path_track"), GetEntityIndexByName("GreenEnd", "path_track"), - GetEntityIndexByName("PurpleStart", "path_track"), GetEntityIndexByName("PurpleEnd", "path_track")); - int tmp = GetEntityIndexByName("GreenEnd", "path_track"); + if(bValidMap) + { + g_Chess = new Chess(GetEntityIndexByName("GreenStart", "path_track"), GetEntityIndexByName("GreenEnd", "path_track"), + GetEntityIndexByName("PurpleStart", "path_track"), GetEntityIndexByName("PurpleEnd", "path_track")); + int tmp = GetEntityIndexByName("GreenEnd", "path_track"); - HookSingleEntityOutput(tmp, "OnPass", OnGreenEndPass); - tmp = GetEntityIndexByName("PurpleEnd", "path_track"); + HookSingleEntityOutput(tmp, "OnPass", OnGreenEndPass); + tmp = GetEntityIndexByName("PurpleEnd", "path_track"); - HookSingleEntityOutput(tmp, "OnPass", OnPurpleEndPass); - tmp = GetEntityIndexByHammerID(92835, "func_button"); + HookSingleEntityOutput(tmp, "OnPass", OnPurpleEndPass); + tmp = GetEntityIndexByHammerID(92835, "func_button"); - HookSingleEntityOutput(tmp, "OnPressed", OnPurpleButton1); - tmp = GetEntityIndexByHammerID(92838, "func_button"); + HookSingleEntityOutput(tmp, "OnPressed", OnPurpleButton1); + tmp = GetEntityIndexByHammerID(92838, "func_button"); - HookSingleEntityOutput(tmp, "OnPressed", OnPurpleButton2); - tmp = GetEntityIndexByHammerID(92841, "func_button"); + HookSingleEntityOutput(tmp, "OnPressed", OnPurpleButton2); + tmp = GetEntityIndexByHammerID(92841, "func_button"); - HookSingleEntityOutput(tmp, "OnPressed", OnPurpleButton3); - tmp = GetEntityIndexByHammerID(92844, "func_button"); + HookSingleEntityOutput(tmp, "OnPressed", OnPurpleButton3); + tmp = GetEntityIndexByHammerID(92844, "func_button"); - HookSingleEntityOutput(tmp, "OnPressed", OnPurpleButton4); - tmp = GetEntityIndexByHammerID(92850, "func_button"); + HookSingleEntityOutput(tmp, "OnPressed", OnPurpleButton4); + tmp = GetEntityIndexByHammerID(92850, "func_button"); - HookSingleEntityOutput(tmp, "OnPressed", OnPurpleButton5); - tmp = GetEntityIndexByHammerID(92847, "func_button"); - HookSingleEntityOutput(tmp, "OnPressed", OnPurpleButton6); - tmp = GetEntityIndexByHammerID(92853, "func_button"); + HookSingleEntityOutput(tmp, "OnPressed", OnPurpleButton5); + tmp = GetEntityIndexByHammerID(92847, "func_button"); + HookSingleEntityOutput(tmp, "OnPressed", OnPurpleButton6); + tmp = GetEntityIndexByHammerID(92853, "func_button"); - HookSingleEntityOutput(tmp, "OnPressed", OnPurpleButton7); - tmp = GetEntityIndexByHammerID(92856, "func_button"); + HookSingleEntityOutput(tmp, "OnPressed", OnPurpleButton7); + tmp = GetEntityIndexByHammerID(92856, "func_button"); - HookSingleEntityOutput(tmp, "OnPressed", OnPurpleButton8); - tmp = GetEntityIndexByHammerID(92013, "func_button"); + HookSingleEntityOutput(tmp, "OnPressed", OnPurpleButton8); + tmp = GetEntityIndexByHammerID(92013, "func_button"); - HookSingleEntityOutput(tmp, "OnPressed", OnGreenButton1); - tmp = GetEntityIndexByHammerID(92084, "func_button"); + HookSingleEntityOutput(tmp, "OnPressed", OnGreenButton1); + tmp = GetEntityIndexByHammerID(92084, "func_button"); - HookSingleEntityOutput(tmp, "OnPressed", OnGreenButton2); - tmp = GetEntityIndexByHammerID(91906, "func_button"); + HookSingleEntityOutput(tmp, "OnPressed", OnGreenButton2); + tmp = GetEntityIndexByHammerID(91906, "func_button"); - HookSingleEntityOutput(tmp, "OnPressed", OnGreenButton3); - tmp = GetEntityIndexByHammerID(92081, "func_button"); + HookSingleEntityOutput(tmp, "OnPressed", OnGreenButton3); + tmp = GetEntityIndexByHammerID(92081, "func_button"); - HookSingleEntityOutput(tmp, "OnPressed", OnGreenButton4); - tmp = GetEntityIndexByHammerID(92016, "func_button"); + HookSingleEntityOutput(tmp, "OnPressed", OnGreenButton4); + tmp = GetEntityIndexByHammerID(92016, "func_button"); - HookSingleEntityOutput(tmp, "OnPressed", OnGreenButton5); - tmp = GetEntityIndexByHammerID(92075, "func_button"); + HookSingleEntityOutput(tmp, "OnPressed", OnGreenButton5); + tmp = GetEntityIndexByHammerID(92075, "func_button"); - HookSingleEntityOutput(tmp, "OnPressed", OnGreenButton6); - tmp = GetEntityIndexByHammerID(89814, "func_button"); + HookSingleEntityOutput(tmp, "OnPressed", OnGreenButton6); + tmp = GetEntityIndexByHammerID(89814, "func_button"); - HookSingleEntityOutput(tmp, "OnPressed", OnGreenButton7); - tmp = GetEntityIndexByHammerID(92046, "func_button"); + HookSingleEntityOutput(tmp, "OnPressed", OnGreenButton7); + tmp = GetEntityIndexByHammerID(92046, "func_button"); - HookSingleEntityOutput(tmp, "OnPressed", OnGreenButton8); - tmp = GetEntityIndexByHammerID(89040, "func_button"); + HookSingleEntityOutput(tmp, "OnPressed", OnGreenButton8); + tmp = GetEntityIndexByHammerID(89040, "func_button"); - HookSingleEntityOutput(tmp, "OnPressed", OnPressedTrig, true); - tmp = GetEntityIndexByHammerID(490936, "trigger_push"); + HookSingleEntityOutput(tmp, "OnPressed", OnPressedTrig, true); + tmp = GetEntityIndexByHammerID(490936, "trigger_push"); - HookSingleEntityOutput(tmp, "OnStartTouch", OnPushTrigger); - tmp = GetEntityIndexByHammerID(445713, "trigger_push"); + HookSingleEntityOutput(tmp, "OnStartTouch", OnPushTrigger); + tmp = GetEntityIndexByHammerID(445713, "trigger_push"); - HookSingleEntityOutput(tmp, "OnStartTouch", OnPushTrigger2); + HookSingleEntityOutput(tmp, "OnStartTouch", OnPushTrigger2); + } } public void OnPushTrigger2(const char[] output, int caller, int activator, float delay) @@ -304,29 +298,30 @@ public void OnPurpleEndPass(const char[] output, int caller, int activator, floa public void OnEntitySpawned(int entity, const char[] classname) { - if(!bValidMap) - return; - if(IsValidEntity(entity)) - { - if(strcmp(classname, "func_breakable") == 0) - { - char sName[128]; - GetEntPropString(entity, Prop_Data, "m_iName", sName, sizeof(sName)); - if(!sName[0]) - return; - int pos = FindCharInString(sName, '&', true); - if(pos != -1) - { sName[pos] = 0; - if(strcmp(sName, "EyeBoss") == 0) - { + if(bValidMap) + { + if(IsValidEntity(entity)) + { + if(strcmp(classname, "func_breakable") == 0) + { + char sName[128]; + GetEntPropString(entity, Prop_Data, "m_iName", sName, sizeof(sName)); + if(!sName[0]) + return; + int pos = FindCharInString(sName, '&', true); + if(pos != -1) + { sName[pos] = 0; + if(strcmp(sName, "EyeBoss") == 0) + { - Eye eye = new Eye(entity); - HookSingleEntityOutput(entity, "OnUser2", OnEyeMove); - g_aEyes.Push(eye); - } - } - } - } + Eye eye = new Eye(entity); + HookSingleEntityOutput(entity, "OnUser2", OnEyeMove); + g_aEyes.Push(eye); + } + } + } + } + } } public void OnEyeMove(const char[] output, int caller, int activator, float delay) @@ -345,33 +340,34 @@ public void OnEyeMove(const char[] output, int caller, int activator, float dela public void OnEntityDestroyed(int entity) { - if(!bValidMap) - return; - if(IsValidEntity(entity)) - { - char sClassname[64]; - GetEntityClassname(entity, sClassname, sizeof(sClassname)); - if(strcmp(sClassname, "func_breakable") == 0) - { - char sName[128]; - GetEntPropString(entity, Prop_Data, "m_iName", sName, sizeof(sName)); - if(!sName[0]) - return; - if(StrContains(sName, "EyeBoss") != -1) - { - for (int i = 0; i < g_aEyes.Length; i++) - { - Eye tmp = view_as(g_aEyes.Get(i)); - if(entity == tmp.entity) - { + if(bValidMap) + { + if(IsValidEntity(entity)) + { + char sClassname[64]; + GetEntityClassname(entity, sClassname, sizeof(sClassname)); + if(strcmp(sClassname, "func_breakable") == 0) + { + char sName[128]; + GetEntPropString(entity, Prop_Data, "m_iName", sName, sizeof(sName)); + if(!sName[0]) + return; + if(StrContains(sName, "EyeBoss") != -1) + { + for (int i = 0; i < g_aEyes.Length; i++) + { + Eye tmp = view_as(g_aEyes.Get(i)); + if(entity == tmp.entity) + { - delete tmp; - g_aEyes.Erase(i); - } - } - } - } - } + delete tmp; + g_aEyes.Erase(i); + } + } + } + } + } + } } public void Cleanup() @@ -402,4 +398,4 @@ public void OnMapEnd() UnhookEvent("round_end", OnRoundEnd, EventHookMode_PostNoCopy); } bValidMap = false; -} \ No newline at end of file +} diff --git a/VScripts/scripting/vscript_JJBA.sp b/VScripts/scripting/vscript_JJBA.sp index f2e1d72a..5568c6e1 100644 --- a/VScripts/scripting/vscript_JJBA.sp +++ b/VScripts/scripting/vscript_JJBA.sp @@ -34,91 +34,86 @@ public void OnMapStart() { g_aMovingNpc = new ArrayList(); } - else - { - char sFilename[256]; - GetPluginFilename(INVALID_HANDLE, sFilename, sizeof(sFilename)); - - ServerCommand("sm plugins unload %s", sFilename); - } } public void OnEntitySpawned(int entity, const char[] classname) { - if(!bValidMap) - return; - if(IsValidEntity(entity)) - { - if(strcmp(classname, "phys_thruster") == 0) - { - char sTarget[128]; - GetOutputTarget(entity, "m_OnUser1", 0, sTarget, sizeof(sTarget)); - if(!sTarget[0]) - return; + if(bValidMap) + { + if(IsValidEntity(entity)) + { + if(strcmp(classname, "phys_thruster") == 0) + { + char sTarget[128]; + GetOutputTarget(entity, "m_OnUser1", 0, sTarget, sizeof(sTarget)); + if(!sTarget[0]) + return; - if (StrContains(sTarget, "npc_physbox") != -1) - { - int ent = GetEntityIndexByName(sTarget, "func_physbox"); - MovingNpc npc = null; - bool bAlreadyInList = false; - for (int i = 0; i < g_aMovingNpc.Length; i++) - { - MovingNpc tmp = view_as(g_aMovingNpc.Get(i)); - if(tmp.entity == ent) - { - npc = tmp; - bAlreadyInList = true; - } - } - if(!bAlreadyInList) - { - npc = new MovingNpc(ent); - } - GetEntPropString(entity, Prop_Data, "m_iName", sTarget, sizeof(sTarget)); - if(StrContains(sTarget, "npc_thruster_forward") != -1) - { - npc.SetThruster(true, entity); - } - else if(StrContains(sTarget, "npc_thruster_side") != -1) - { - npc.SetThruster(false, entity); - } + if (StrContains(sTarget, "npc_physbox") != -1) + { + int ent = GetEntityIndexByName(sTarget, "func_physbox"); + MovingNpc npc = null; + bool bAlreadyInList = false; + for (int i = 0; i < g_aMovingNpc.Length; i++) + { + MovingNpc tmp = view_as(g_aMovingNpc.Get(i)); + if(tmp.entity == ent) + { + npc = tmp; + bAlreadyInList = true; + } + } + if(!bAlreadyInList) + { + npc = new MovingNpc(ent); + } + GetEntPropString(entity, Prop_Data, "m_iName", sTarget, sizeof(sTarget)); + if(StrContains(sTarget, "npc_thruster_forward") != -1) + { + npc.SetThruster(true, entity); + } + else if(StrContains(sTarget, "npc_thruster_side") != -1) + { + npc.SetThruster(false, entity); + } - if(bAlreadyInList) - { - npc.Start(); + if(bAlreadyInList) + { + npc.Start(); - } - else - g_aMovingNpc.Push(npc); - } - } - } + } + else + g_aMovingNpc.Push(npc); + } + } + } + } } public void OnEntityDestroyed(int entity) { - if(!bValidMap) - return; - if(IsValidEntity(entity)) - { - char sClassname[128]; - GetEntityClassname(entity, sClassname, sizeof(sClassname)); - if(strcmp(sClassname, "func_physbox") == 0) - { - for (int i = 0; i < g_aMovingNpc.Length; i++) - { - MovingNpc npc = view_as(g_aMovingNpc.Get(i)); - if(npc.entity == entity) - { + if(bValidMap) + { + if(IsValidEntity(entity)) + { + char sClassname[128]; + GetEntityClassname(entity, sClassname, sizeof(sClassname)); + if(strcmp(sClassname, "func_physbox") == 0) + { + for (int i = 0; i < g_aMovingNpc.Length; i++) + { + MovingNpc npc = view_as(g_aMovingNpc.Get(i)); + if(npc.entity == entity) + { - npc.Stop(); - g_aMovingNpc.Erase(i); - break; - } - } - } - } + npc.Stop(); + g_aMovingNpc.Erase(i); + break; + } + } + } + } + } } @@ -135,4 +130,4 @@ public void OnMapEnd() delete g_aMovingNpc; } bValidMap = false; -} \ No newline at end of file +} diff --git a/VScripts/scripting/vscript_ze_dreamin_v2.sp b/VScripts/scripting/vscript_ze_dreamin_v2.sp index f7711ef5..be8462de 100644 --- a/VScripts/scripting/vscript_ze_dreamin_v2.sp +++ b/VScripts/scripting/vscript_ze_dreamin_v2.sp @@ -5,16 +5,18 @@ #pragma semicolon 1 #pragma newdecls required +bool g_bIsDreamingv2 = false; + //---------------------------------------------------------------------------------------------------- // Purpose: //---------------------------------------------------------------------------------------------------- public Plugin myinfo = { - name = "ze_dreamin VScript", - author = "Neon", - description = "", - version = "1.0", - url = "https://steamcommunity.com/id/n3ontm" + name = "ze_dreamin VScript", + author = "Neon", + description = "", + version = "1.0", + url = "https://steamcommunity.com/id/n3ontm" } //---------------------------------------------------------------------------------------------------- @@ -22,7 +24,8 @@ public Plugin myinfo = //---------------------------------------------------------------------------------------------------- public void OnPluginStart() { - HookEvent("round_start", OnRoundStart); + VerifyMap(); + HookEvent("round_start", OnRoundStart); } //---------------------------------------------------------------------------------------------------- @@ -30,7 +33,7 @@ public void OnPluginStart() //---------------------------------------------------------------------------------------------------- public void OnMapStart() { - VerifyMap(); + VerifyMap(); } //---------------------------------------------------------------------------------------------------- @@ -38,16 +41,9 @@ public void OnMapStart() //---------------------------------------------------------------------------------------------------- public void VerifyMap() { - char sCurrentMap[64]; - GetCurrentMap(sCurrentMap, sizeof(sCurrentMap)); - - if (strncmp(sCurrentMap, "ze_dreamin_v2", 13, false) != 0) - { - char sFilename[256]; - GetPluginFilename(INVALID_HANDLE, sFilename, sizeof(sFilename)); - - ServerCommand("sm plugins unload %s", sFilename); - } + char sCurrentMap[64]; + GetCurrentMap(sCurrentMap, sizeof(sCurrentMap)); + g_bIsDreamingv2 = strncmp(sCurrentMap, "ze_dreamin_v2", 13, false) == 0; } //---------------------------------------------------------------------------------------------------- @@ -55,141 +51,144 @@ public void VerifyMap() //---------------------------------------------------------------------------------------------------- public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast) { - int iEntity = INVALID_ENT_REFERENCE; + if (g_bIsDreamingv2) + { + int iEntity = INVALID_ENT_REFERENCE; - iEntity = FindEntityByTargetName("reflect_logic"); - if (iEntity != INVALID_ENT_REFERENCE) - HookSingleEntityOutput(iEntity, "OnFalse", st3_hitbox_reflect, false); + 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("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("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("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("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 = 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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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); + 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); + CreateTimer(12.0, Credits, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE); + } } //---------------------------------------------------------------------------------------------------- @@ -197,7 +196,7 @@ public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast) //---------------------------------------------------------------------------------------------------- public Action Credits(Handle timer) { - CPrintToChatAll("{pink}[VScripts] {white}Map using VScripts ported by Neon™"); + CPrintToChatAll("{pink}[VScripts] {white}Map using VScripts ported by Neon™"); } //---------------------------------------------------------------------------------------------------- @@ -205,19 +204,19 @@ public Action Credits(Handle timer) //---------------------------------------------------------------------------------------------------- public void st3_hitbox_reflect(const char[] output, int caller, int activator, float delay) { - if (!IsValidClient(activator)) - return; + if (!IsValidClient(activator)) + return; - int iHealth = GetClientHealth(activator); + int iHealth = GetClientHealth(activator); - if(iHealth > 10) - { - SetEntityHealth(activator, iHealth - 10); - } - else - { - SetEntityHealth(activator, 1); - } + if(iHealth > 10) + { + SetEntityHealth(activator, iHealth - 10); + } + else + { + SetEntityHealth(activator, 1); + } } //---------------------------------------------------------------------------------------------------- @@ -225,16 +224,16 @@ public void st3_hitbox_reflect(const char[] output, int caller, int activator, f //---------------------------------------------------------------------------------------------------- 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; + 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; + int iEntity = INVALID_ENT_REFERENCE; - iEntity = FindEntityByTargetName("upline_maker"); - if (iEntity != INVALID_ENT_REFERENCE) - TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR); + iEntity = FindEntityByTargetName("upline_maker"); + if (iEntity != INVALID_ENT_REFERENCE) + TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR); } //---------------------------------------------------------------------------------------------------- @@ -242,16 +241,16 @@ public void upline_maker_upline(const char[] output, int caller, int activator, //---------------------------------------------------------------------------------------------------- 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; + float fAngles[3]; + fAngles[0] = 0.0; + fAngles[1] = GetRandomFloat(0.0, 359.0); + fAngles[2] = 0.0; - int iEntity = INVALID_ENT_REFERENCE; + int iEntity = INVALID_ENT_REFERENCE; - iEntity = FindEntityByTargetName("explo_maker"); - if (iEntity != INVALID_ENT_REFERENCE) - TeleportEntity(iEntity, NULL_VECTOR, fAngles, NULL_VECTOR); + iEntity = FindEntityByTargetName("explo_maker"); + if (iEntity != INVALID_ENT_REFERENCE) + TeleportEntity(iEntity, NULL_VECTOR, fAngles, NULL_VECTOR); } //---------------------------------------------------------------------------------------------------- @@ -259,21 +258,21 @@ public void explo_maker_setan(const char[] output, int caller, int activator, fl //---------------------------------------------------------------------------------------------------- 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 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; + float fAngles[3]; + fAngles[0] = 0.0; + fAngles[1] = 0.0; + fAngles[2] = 0.0; - int iEntity = INVALID_ENT_REFERENCE; + int iEntity = INVALID_ENT_REFERENCE; - iEntity = FindEntityByTargetName("linelaser_maker"); - if (iEntity != INVALID_ENT_REFERENCE) - TeleportEntity(iEntity, fOrigin, fAngles, NULL_VECTOR); + iEntity = FindEntityByTargetName("linelaser_maker"); + if (iEntity != INVALID_ENT_REFERENCE) + TeleportEntity(iEntity, fOrigin, fAngles, NULL_VECTOR); } //---------------------------------------------------------------------------------------------------- @@ -281,21 +280,21 @@ public void linelaser_maker_left(const char[] output, int caller, int activator, //---------------------------------------------------------------------------------------------------- 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 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; + float fAngles[3]; + fAngles[0] = 0.0; + fAngles[1] = 90.0; + fAngles[2] = 0.0; - int iEntity = INVALID_ENT_REFERENCE; + int iEntity = INVALID_ENT_REFERENCE; - iEntity = FindEntityByTargetName("linelaser_maker"); - if (iEntity != INVALID_ENT_REFERENCE) - TeleportEntity(iEntity, fOrigin, fAngles, NULL_VECTOR); + iEntity = FindEntityByTargetName("linelaser_maker"); + if (iEntity != INVALID_ENT_REFERENCE) + TeleportEntity(iEntity, fOrigin, fAngles, NULL_VECTOR); } //---------------------------------------------------------------------------------------------------- @@ -303,16 +302,16 @@ public void linelaser_maker_right(const char[] output, int caller, int activator //---------------------------------------------------------------------------------------------------- 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; + 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; + int iEntity = INVALID_ENT_REFERENCE; - iEntity = FindEntityByTargetName("push_maker"); - if (iEntity != INVALID_ENT_REFERENCE) - TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR); + iEntity = FindEntityByTargetName("push_maker"); + if (iEntity != INVALID_ENT_REFERENCE) + TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR); } //---------------------------------------------------------------------------------------------------- @@ -320,16 +319,16 @@ public void push_maker_setrandom(const char[] output, int caller, int activator, //---------------------------------------------------------------------------------------------------- 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; + 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; + int iEntity = INVALID_ENT_REFERENCE; - iEntity = FindEntityByTargetName("heal_maker"); - if (iEntity != INVALID_ENT_REFERENCE) - TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR); + iEntity = FindEntityByTargetName("heal_maker"); + if (iEntity != INVALID_ENT_REFERENCE) + TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR); } //---------------------------------------------------------------------------------------------------- @@ -337,16 +336,16 @@ public void heal_maker_setrandom(const char[] output, int caller, int activator, //---------------------------------------------------------------------------------------------------- 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; + 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; + int iEntity = INVALID_ENT_REFERENCE; - iEntity = FindEntityByTargetName("stable_maker"); - if (iEntity != INVALID_ENT_REFERENCE) - TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR); + iEntity = FindEntityByTargetName("stable_maker"); + if (iEntity != INVALID_ENT_REFERENCE) + TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR); } //---------------------------------------------------------------------------------------------------- @@ -354,16 +353,16 @@ public void stable_maker_setrandom(const char[] output, int caller, int activato //---------------------------------------------------------------------------------------------------- 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; + 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; + int iEntity = INVALID_ENT_REFERENCE; - iEntity = FindEntityByTargetName("rotate_maker"); - if (iEntity != INVALID_ENT_REFERENCE) - TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR); + iEntity = FindEntityByTargetName("rotate_maker"); + if (iEntity != INVALID_ENT_REFERENCE) + TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR); } //---------------------------------------------------------------------------------------------------- @@ -371,19 +370,19 @@ public void rotate_maker_setrandom(const char[] output, int caller, int activato //---------------------------------------------------------------------------------------------------- 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; + 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; + int iEntity = INVALID_ENT_REFERENCE; - iEntity = FindEntityByTargetName("spike_maker"); - if (iEntity != INVALID_ENT_REFERENCE) - { - TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR); - AcceptEntityInput(iEntity, "ForceSpawn"); - } + iEntity = FindEntityByTargetName("spike_maker"); + if (iEntity != INVALID_ENT_REFERENCE) + { + TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR); + AcceptEntityInput(iEntity, "ForceSpawn"); + } } //---------------------------------------------------------------------------------------------------- @@ -391,7 +390,7 @@ public void spike_maker_top(const char[] output, int caller, int activator, floa //---------------------------------------------------------------------------------------------------- public void trigger_once_389450_display(const char[] output, int caller, int activator, float delay) { - Display(30); + Display(30); } //---------------------------------------------------------------------------------------------------- @@ -399,7 +398,7 @@ public void trigger_once_389450_display(const char[] output, int caller, int act //---------------------------------------------------------------------------------------------------- public void trigger_once_385777_display(const char[] output, int caller, int activator, float delay) { - Display(20); + Display(20); } //---------------------------------------------------------------------------------------------------- @@ -407,7 +406,7 @@ public void trigger_once_385777_display(const char[] output, int caller, int act //---------------------------------------------------------------------------------------------------- public void trigger_once_385886_display(const char[] output, int caller, int activator, float delay) { - Display(20); + Display(20); } //---------------------------------------------------------------------------------------------------- @@ -415,7 +414,7 @@ public void trigger_once_385886_display(const char[] output, int caller, int act //---------------------------------------------------------------------------------------------------- public void trigger_once_386004_display(const char[] output, int caller, int activator, float delay) { - Display(20); + Display(20); } //---------------------------------------------------------------------------------------------------- @@ -423,7 +422,7 @@ public void trigger_once_386004_display(const char[] output, int caller, int act //---------------------------------------------------------------------------------------------------- public void func_button_381396_display(const char[] output, int caller, int activator, float delay) { - Display(30); + Display(30); } //---------------------------------------------------------------------------------------------------- @@ -431,7 +430,7 @@ public void func_button_381396_display(const char[] output, int caller, int acti //---------------------------------------------------------------------------------------------------- public void trigger_once_381463_display(const char[] output, int caller, int activator, float delay) { - Display(30); + Display(30); } //---------------------------------------------------------------------------------------------------- @@ -439,7 +438,7 @@ public void trigger_once_381463_display(const char[] output, int caller, int act //---------------------------------------------------------------------------------------------------- public void trigger_once_381581_display(const char[] output, int caller, int activator, float delay) { - Display(50); + Display(50); } //---------------------------------------------------------------------------------------------------- @@ -447,7 +446,7 @@ public void trigger_once_381581_display(const char[] output, int caller, int act //---------------------------------------------------------------------------------------------------- public void trigger_once_381648_display(const char[] output, int caller, int activator, float delay) { - Display(30); + Display(30); } //---------------------------------------------------------------------------------------------------- @@ -455,7 +454,7 @@ public void trigger_once_381648_display(const char[] output, int caller, int act //---------------------------------------------------------------------------------------------------- public void trigger_once_378212_display(const char[] output, int caller, int activator, float delay) { - Display(30); + Display(30); } //---------------------------------------------------------------------------------------------------- @@ -463,7 +462,7 @@ public void trigger_once_378212_display(const char[] output, int caller, int act //---------------------------------------------------------------------------------------------------- public void trigger_once_375007_display(const char[] output, int caller, int activator, float delay) { - Display(20); + Display(20); } //---------------------------------------------------------------------------------------------------- @@ -471,7 +470,7 @@ public void trigger_once_375007_display(const char[] output, int caller, int act //---------------------------------------------------------------------------------------------------- public void func_button_241061_display(const char[] output, int caller, int activator, float delay) { - Display(30); + Display(30); } //---------------------------------------------------------------------------------------------------- @@ -479,7 +478,7 @@ public void func_button_241061_display(const char[] output, int caller, int acti //---------------------------------------------------------------------------------------------------- public void trigger_once_213033_display(const char[] output, int caller, int activator, float delay) { - Display(30); + Display(30); } //---------------------------------------------------------------------------------------------------- @@ -487,7 +486,7 @@ public void trigger_once_213033_display(const char[] output, int caller, int act //---------------------------------------------------------------------------------------------------- public void trigger_once_142829_display(const char[] output, int caller, int activator, float delay) { - Display(20); + Display(20); } //---------------------------------------------------------------------------------------------------- @@ -495,7 +494,7 @@ public void trigger_once_142829_display(const char[] output, int caller, int act //---------------------------------------------------------------------------------------------------- public void trigger_once_95608_display(const char[] output, int caller, int activator, float delay) { - Display(30); + Display(30); } //---------------------------------------------------------------------------------------------------- @@ -503,7 +502,7 @@ public void trigger_once_95608_display(const char[] output, int caller, int acti //---------------------------------------------------------------------------------------------------- public void trigger_once_95733_display(const char[] output, int caller, int activator, float delay) { - Display(30); + Display(30); } //---------------------------------------------------------------------------------------------------- @@ -511,7 +510,7 @@ public void trigger_once_95733_display(const char[] output, int caller, int acti //---------------------------------------------------------------------------------------------------- public void trigger_once_95823_display(const char[] output, int caller, int activator, float delay) { - Display(30); + Display(30); } //---------------------------------------------------------------------------------------------------- @@ -519,7 +518,7 @@ public void trigger_once_95823_display(const char[] output, int caller, int acti //---------------------------------------------------------------------------------------------------- public void func_button_77927_display(const char[] output, int caller, int activator, float delay) { - Display(30); + Display(30); } //---------------------------------------------------------------------------------------------------- @@ -527,7 +526,7 @@ public void func_button_77927_display(const char[] output, int caller, int activ //---------------------------------------------------------------------------------------------------- public void trigger_once_23408_display(const char[] output, int caller, int activator, float delay) { - Display(35); + Display(35); } //---------------------------------------------------------------------------------------------------- @@ -535,7 +534,7 @@ public void trigger_once_23408_display(const char[] output, int caller, int acti //---------------------------------------------------------------------------------------------------- public void trigger_once_23452_display(const char[] output, int caller, int activator, float delay) { - Display(20); + Display(20); } //---------------------------------------------------------------------------------------------------- @@ -543,7 +542,7 @@ public void trigger_once_23452_display(const char[] output, int caller, int acti //---------------------------------------------------------------------------------------------------- public void trigger_once_23474_display(const char[] output, int caller, int activator, float delay) { - Display(25); + Display(25); } //---------------------------------------------------------------------------------------------------- @@ -551,7 +550,7 @@ public void trigger_once_23474_display(const char[] output, int caller, int acti //---------------------------------------------------------------------------------------------------- public void func_breakable_23551_display(const char[] output, int caller, int activator, float delay) { - Display(20); + Display(20); } //---------------------------------------------------------------------------------------------------- @@ -559,7 +558,7 @@ public void func_breakable_23551_display(const char[] output, int caller, int ac //---------------------------------------------------------------------------------------------------- public void func_button_21950_display(const char[] output, int caller, int activator, float delay) { - Display(30); + Display(30); } //---------------------------------------------------------------------------------------------------- @@ -567,7 +566,7 @@ public void func_button_21950_display(const char[] output, int caller, int activ //---------------------------------------------------------------------------------------------------- public void func_button_22017_display(const char[] output, int caller, int activator, float delay) { - Display(10); + Display(10); } //---------------------------------------------------------------------------------------------------- @@ -575,7 +574,7 @@ public void func_button_22017_display(const char[] output, int caller, int activ //---------------------------------------------------------------------------------------------------- public void func_breakable_3664_display(const char[] output, int caller, int activator, float delay) { - Display(45); + Display(45); } //---------------------------------------------------------------------------------------------------- @@ -583,7 +582,7 @@ public void func_breakable_3664_display(const char[] output, int caller, int act //---------------------------------------------------------------------------------------------------- public void math_counter_11288_display(const char[] output, int caller, int activator, float delay) { - Display(51); + Display(51); } //---------------------------------------------------------------------------------------------------- @@ -591,25 +590,25 @@ public void math_counter_11288_display(const char[] output, int caller, int acti //---------------------------------------------------------------------------------------------------- public void Display(int iTimer) { - int iRelay = CreateEntityByName("logic_relay"); - DispatchKeyFormat(iRelay, "targetname", "vscript_countdown_relay"); - DispatchKeyFormat(iRelay, "spawnflags", "0"); - DispatchKeyFormat(iRelay, "OnSpawn", "seconds_left,AddOutput,message seconds left,0,-1"); - DispatchKeyFormat(iRelay, "OnSpawn", "text_sec,AddOutput,message %d,0,-1", iTimer - 1); + int iRelay = CreateEntityByName("logic_relay"); + DispatchKeyFormat(iRelay, "targetname", "vscript_countdown_relay"); + DispatchKeyFormat(iRelay, "spawnflags", "0"); + DispatchKeyFormat(iRelay, "OnSpawn", "seconds_left,AddOutput,message seconds left,0,-1"); + DispatchKeyFormat(iRelay, "OnSpawn", "text_sec,AddOutput,message %d,0,-1", iTimer - 1); - int iBackup = iTimer; - for (int j = 0; j <= iTimer; j++) - { - iBackup--; - DispatchKeyFormat(iRelay, "OnSpawn", "text_sec,AddOutput,message %d,%d,-1", iBackup, j); - DispatchKeyFormat(iRelay, "OnSpawn", "seconds_left,Display,,%d,-1", j); - DispatchKeyFormat(iRelay, "OnSpawn", "text_sec,Display,,%d,-1", j); - } + int iBackup = iTimer; + for (int j = 0; j <= iTimer; j++) + { + iBackup--; + DispatchKeyFormat(iRelay, "OnSpawn", "text_sec,AddOutput,message %d,%d,-1", iBackup, j); + DispatchKeyFormat(iRelay, "OnSpawn", "seconds_left,Display,,%d,-1", j); + DispatchKeyFormat(iRelay, "OnSpawn", "text_sec,Display,,%d,-1", j); + } - DispatchKeyFormat(iRelay, "OnSpawn", "seconds_left,AddOutput,message ,%d,-1", iTimer + 1); - DispatchKeyFormat(iRelay, "OnSpawn", "text_sec,AddOutput,message ,%d,-1", iTimer + 1); - DispatchKeyFormat(iRelay, "OnSpawn", "!self,Kill,,%d,-1", iTimer + 2); - SpawnAndActivate(iRelay); + DispatchKeyFormat(iRelay, "OnSpawn", "seconds_left,AddOutput,message ,%d,-1", iTimer + 1); + DispatchKeyFormat(iRelay, "OnSpawn", "text_sec,AddOutput,message ,%d,-1", iTimer + 1); + DispatchKeyFormat(iRelay, "OnSpawn", "!self,Kill,,%d,-1", iTimer + 2); + SpawnAndActivate(iRelay); } //---------------------------------------------------------------------------------------------------- @@ -617,20 +616,20 @@ public void Display(int iTimer) //---------------------------------------------------------------------------------------------------- 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)); + 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; - } - } + if (strcmp(sTargetnameToFind, sTargetname, false) == 0) + { + return iEntity; + } + } - PrintToChatAll("[VScripts] Error! Could not find entity: %s", sTargetnameToFind); - return INVALID_ENT_REFERENCE; + PrintToChatAll("[VScripts] Error! Could not find entity: %s", sTargetnameToFind); + return INVALID_ENT_REFERENCE; } //---------------------------------------------------------------------------------------------------- @@ -638,17 +637,17 @@ public int FindEntityByTargetName(const char[] sTargetnameToFind) //---------------------------------------------------------------------------------------------------- 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; - } - } + 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; + PrintToChatAll("[VScripts] Error! Could not find entity: #%d", iHammerID); + return INVALID_ENT_REFERENCE; } //---------------------------------------------------------------------------------------------------- @@ -656,10 +655,10 @@ public int FindEntityByHammerID(int iHammerID) //---------------------------------------------------------------------------------------------------- stock bool DispatchKeyFormat(int entity, const char[] key, const char[] value, any ...) { - char buffer[1024]; - VFormat(buffer, sizeof(buffer), value, 4); + char buffer[1024]; + VFormat(buffer, sizeof(buffer), value, 4); - DispatchKeyValue(entity, key, buffer); + DispatchKeyValue(entity, key, buffer); } //---------------------------------------------------------------------------------------------------- @@ -667,8 +666,8 @@ stock bool DispatchKeyFormat(int entity, const char[] key, const char[] value, a //---------------------------------------------------------------------------------------------------- stock void SpawnAndActivate(int entity) { - DispatchSpawn(entity); - ActivateEntity(entity); + DispatchSpawn(entity); + ActivateEntity(entity); } //---------------------------------------------------------------------------------------------------- @@ -676,5 +675,5 @@ stock void SpawnAndActivate(int entity) //---------------------------------------------------------------------------------------------------- stock bool IsValidClient(int client) { - return (client > 0 && client <= MaxClients && IsClientInGame(client) && IsPlayerAlive(client)); -} \ No newline at end of file + return (client > 0 && client <= MaxClients && IsClientInGame(client) && IsPlayerAlive(client)); +} diff --git a/VScripts/scripting/vscript_ze_dreamin_v3.sp b/VScripts/scripting/vscript_ze_dreamin_v3.sp index 2a7c0dd5..93b5bb29 100644 --- a/VScripts/scripting/vscript_ze_dreamin_v3.sp +++ b/VScripts/scripting/vscript_ze_dreamin_v3.sp @@ -5,16 +5,18 @@ #pragma semicolon 1 #pragma newdecls required +bool g_bIsDreamingv3 = false; + //---------------------------------------------------------------------------------------------------- // Purpose: //---------------------------------------------------------------------------------------------------- public Plugin myinfo = { - name = "ze_dreamin VScript", - author = "Neon", - description = "", - version = "1.0", - url = "https://steamcommunity.com/id/n3ontm" + name = "ze_dreamin VScript", + author = "Neon", + description = "", + version = "1.0", + url = "https://steamcommunity.com/id/n3ontm" } //---------------------------------------------------------------------------------------------------- @@ -22,7 +24,8 @@ public Plugin myinfo = //---------------------------------------------------------------------------------------------------- public void OnPluginStart() { - HookEvent("round_start", OnRoundStart); + VerifyMap(); + HookEvent("round_start", OnRoundStart); } //---------------------------------------------------------------------------------------------------- @@ -30,7 +33,7 @@ public void OnPluginStart() //---------------------------------------------------------------------------------------------------- public void OnMapStart() { - VerifyMap(); + VerifyMap(); } //---------------------------------------------------------------------------------------------------- @@ -38,16 +41,10 @@ public void OnMapStart() //---------------------------------------------------------------------------------------------------- public void VerifyMap() { - char sCurrentMap[64]; - GetCurrentMap(sCurrentMap, sizeof(sCurrentMap)); + char sCurrentMap[64]; + GetCurrentMap(sCurrentMap, sizeof(sCurrentMap)); - if (strncmp(sCurrentMap, "ze_dreamin_v3", 12, false) != 0) - { - char sFilename[256]; - GetPluginFilename(INVALID_HANDLE, sFilename, sizeof(sFilename)); - - ServerCommand("sm plugins unload %s", sFilename); - } + g_bIsDreamingv3 = strncmp(sCurrentMap, "ze_dreamin_v3", 12, false) == 0; } //---------------------------------------------------------------------------------------------------- @@ -55,176 +52,179 @@ public void VerifyMap() //---------------------------------------------------------------------------------------------------- public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast) { - int iEntity = INVALID_ENT_REFERENCE; + if (g_bIsDreamingv3) + { + int iEntity = INVALID_ENT_REFERENCE; - iEntity = FindEntityByTargetName("reflect_logic"); - if (iEntity != INVALID_ENT_REFERENCE) - HookSingleEntityOutput(iEntity, "OnFalse", st3_hitbox_reflect, false); + 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("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("explo_timer"); + if (iEntity != INVALID_ENT_REFERENCE) + HookSingleEntityOutput(iEntity, "OnTimer", explo_maker_setan, false); - iEntity = FindEntityByTargetName("rtv_laser_timer"); - if (iEntity != INVALID_ENT_REFERENCE) - HookSingleEntityOutput(iEntity, "OnTimer", rtv_laser_timer, false); + iEntity = FindEntityByTargetName("rtv_laser_timer"); + if (iEntity != INVALID_ENT_REFERENCE) + HookSingleEntityOutput(iEntity, "OnTimer", rtv_laser_timer, false); - iEntity = FindEntityByTargetName("rtv_th_timer"); - if (iEntity != INVALID_ENT_REFERENCE) - HookSingleEntityOutput(iEntity, "OnTimer", rtv_th_timer, false); + iEntity = FindEntityByTargetName("rtv_th_timer"); + if (iEntity != INVALID_ENT_REFERENCE) + HookSingleEntityOutput(iEntity, "OnTimer", rtv_th_timer, 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("linelaser_random"); + if (iEntity != INVALID_ENT_REFERENCE) + { + HookSingleEntityOutput(iEntity, "OnCase01", linelaser_maker_left, false); + HookSingleEntityOutput(iEntity, "OnCase02", linelaser_maker_right, false); + } - iEntity = FindEntityByTargetName("case_1"); - if (iEntity != INVALID_ENT_REFERENCE) - { - HookSingleEntityOutput(iEntity, "OnCase01", sbomb_1_Case01, false); - HookSingleEntityOutput(iEntity, "OnCase02", sbomb_1_Case02, false); - HookSingleEntityOutput(iEntity, "OnCase03", sbomb_1_Case03, false); - HookSingleEntityOutput(iEntity, "OnCase04", sbomb_1_Case04, false); - } + iEntity = FindEntityByTargetName("case_1"); + if (iEntity != INVALID_ENT_REFERENCE) + { + HookSingleEntityOutput(iEntity, "OnCase01", sbomb_1_Case01, false); + HookSingleEntityOutput(iEntity, "OnCase02", sbomb_1_Case02, false); + HookSingleEntityOutput(iEntity, "OnCase03", sbomb_1_Case03, false); + HookSingleEntityOutput(iEntity, "OnCase04", sbomb_1_Case04, false); + } - iEntity = FindEntityByTargetName("case_2"); - if (iEntity != INVALID_ENT_REFERENCE) - { - HookSingleEntityOutput(iEntity, "OnCase01", sbomb_2_Case01, false); - HookSingleEntityOutput(iEntity, "OnCase02", sbomb_2_Case02, false); - HookSingleEntityOutput(iEntity, "OnCase03", sbomb_2_Case03, false); - HookSingleEntityOutput(iEntity, "OnCase04", sbomb_2_Case04, false); - } + iEntity = FindEntityByTargetName("case_2"); + if (iEntity != INVALID_ENT_REFERENCE) + { + HookSingleEntityOutput(iEntity, "OnCase01", sbomb_2_Case01, false); + HookSingleEntityOutput(iEntity, "OnCase02", sbomb_2_Case02, false); + HookSingleEntityOutput(iEntity, "OnCase03", sbomb_2_Case03, false); + HookSingleEntityOutput(iEntity, "OnCase04", sbomb_2_Case04, false); + } - iEntity = FindEntityByTargetName("case_3"); - if (iEntity != INVALID_ENT_REFERENCE) - { - HookSingleEntityOutput(iEntity, "OnCase01", sbomb_3_Case01, false); - HookSingleEntityOutput(iEntity, "OnCase02", sbomb_3_Case02, false); - HookSingleEntityOutput(iEntity, "OnCase03", sbomb_3_Case03, false); - HookSingleEntityOutput(iEntity, "OnCase04", sbomb_3_Case04, false); - } + iEntity = FindEntityByTargetName("case_3"); + if (iEntity != INVALID_ENT_REFERENCE) + { + HookSingleEntityOutput(iEntity, "OnCase01", sbomb_3_Case01, false); + HookSingleEntityOutput(iEntity, "OnCase02", sbomb_3_Case02, false); + HookSingleEntityOutput(iEntity, "OnCase03", sbomb_3_Case03, false); + HookSingleEntityOutput(iEntity, "OnCase04", sbomb_3_Case04, 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("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 = 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(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(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(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(386004); + if (iEntity != INVALID_ENT_REFERENCE) + HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_386004_display, false); - iEntity = FindEntityByHammerID(381463); - if (iEntity != INVALID_ENT_REFERENCE) - HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_381463_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(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(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(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(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(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(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(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(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(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(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(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(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(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(23474); + if (iEntity != INVALID_ENT_REFERENCE) + HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_23474_display, false); - iEntity = FindEntityByHammerID(579052); - if (iEntity != INVALID_ENT_REFERENCE) - HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_579052_display, false); + iEntity = FindEntityByHammerID(579052); + if (iEntity != INVALID_ENT_REFERENCE) + HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_579052_display, false); - iEntity = FindEntityByHammerID(23551); - if (iEntity != INVALID_ENT_REFERENCE) - HookSingleEntityOutput(iEntity, "OnBreak", func_breakable_23551_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(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(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(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); + 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); + CreateTimer(12.0, Credits, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE); + } } //---------------------------------------------------------------------------------------------------- @@ -232,7 +232,7 @@ public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast) //---------------------------------------------------------------------------------------------------- public Action Credits(Handle timer) { - CPrintToChatAll("{pink}[VScripts] {white}Map using VScripts ported by Neon™"); + CPrintToChatAll("{pink}[VScripts] {white}Map using VScripts ported by Neon™"); } //---------------------------------------------------------------------------------------------------- @@ -240,19 +240,19 @@ public Action Credits(Handle timer) //---------------------------------------------------------------------------------------------------- public void st3_hitbox_reflect(const char[] output, int caller, int activator, float delay) { - if (!IsValidClient(activator)) - return; + if (!IsValidClient(activator)) + return; - int iHealth = GetClientHealth(activator); + int iHealth = GetClientHealth(activator); - if(iHealth > 10) - { - SetEntityHealth(activator, iHealth - 10); - } - else - { - SetEntityHealth(activator, 1); - } + if(iHealth > 10) + { + SetEntityHealth(activator, iHealth - 10); + } + else + { + SetEntityHealth(activator, 1); + } } //---------------------------------------------------------------------------------------------------- @@ -260,16 +260,16 @@ public void st3_hitbox_reflect(const char[] output, int caller, int activator, f //---------------------------------------------------------------------------------------------------- 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; + 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; + int iEntity = INVALID_ENT_REFERENCE; - iEntity = FindEntityByTargetName("upline_maker"); - if (iEntity != INVALID_ENT_REFERENCE) - TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR); + iEntity = FindEntityByTargetName("upline_maker"); + if (iEntity != INVALID_ENT_REFERENCE) + TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR); } //---------------------------------------------------------------------------------------------------- @@ -277,16 +277,16 @@ public void upline_maker_upline(const char[] output, int caller, int activator, //---------------------------------------------------------------------------------------------------- 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; + float fAngles[3]; + fAngles[0] = 0.0; + fAngles[1] = GetRandomFloat(0.0, 359.0); + fAngles[2] = 0.0; - int iEntity = INVALID_ENT_REFERENCE; + int iEntity = INVALID_ENT_REFERENCE; - iEntity = FindEntityByTargetName("explo_maker"); - if (iEntity != INVALID_ENT_REFERENCE) - TeleportEntity(iEntity, NULL_VECTOR, fAngles, NULL_VECTOR); + iEntity = FindEntityByTargetName("explo_maker"); + if (iEntity != INVALID_ENT_REFERENCE) + TeleportEntity(iEntity, NULL_VECTOR, fAngles, NULL_VECTOR); } //---------------------------------------------------------------------------------------------------- @@ -294,21 +294,21 @@ public void explo_maker_setan(const char[] output, int caller, int activator, fl //---------------------------------------------------------------------------------------------------- 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 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; + float fAngles[3]; + fAngles[0] = 0.0; + fAngles[1] = 0.0; + fAngles[2] = 0.0; - int iEntity = INVALID_ENT_REFERENCE; + int iEntity = INVALID_ENT_REFERENCE; - iEntity = FindEntityByTargetName("linelaser_maker"); - if (iEntity != INVALID_ENT_REFERENCE) - TeleportEntity(iEntity, fOrigin, fAngles, NULL_VECTOR); + iEntity = FindEntityByTargetName("linelaser_maker"); + if (iEntity != INVALID_ENT_REFERENCE) + TeleportEntity(iEntity, fOrigin, fAngles, NULL_VECTOR); } //---------------------------------------------------------------------------------------------------- @@ -316,21 +316,21 @@ public void linelaser_maker_left(const char[] output, int caller, int activator, //---------------------------------------------------------------------------------------------------- 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 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; + float fAngles[3]; + fAngles[0] = 0.0; + fAngles[1] = 90.0; + fAngles[2] = 0.0; - int iEntity = INVALID_ENT_REFERENCE; + int iEntity = INVALID_ENT_REFERENCE; - iEntity = FindEntityByTargetName("linelaser_maker"); - if (iEntity != INVALID_ENT_REFERENCE) - TeleportEntity(iEntity, fOrigin, fAngles, NULL_VECTOR); + iEntity = FindEntityByTargetName("linelaser_maker"); + if (iEntity != INVALID_ENT_REFERENCE) + TeleportEntity(iEntity, fOrigin, fAngles, NULL_VECTOR); } //---------------------------------------------------------------------------------------------------- @@ -338,16 +338,16 @@ public void linelaser_maker_right(const char[] output, int caller, int activator //---------------------------------------------------------------------------------------------------- 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; + 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; + int iEntity = INVALID_ENT_REFERENCE; - iEntity = FindEntityByTargetName("push_maker"); - if (iEntity != INVALID_ENT_REFERENCE) - TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR); + iEntity = FindEntityByTargetName("push_maker"); + if (iEntity != INVALID_ENT_REFERENCE) + TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR); } //---------------------------------------------------------------------------------------------------- @@ -355,16 +355,16 @@ public void push_maker_setrandom(const char[] output, int caller, int activator, //---------------------------------------------------------------------------------------------------- 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; + 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; + int iEntity = INVALID_ENT_REFERENCE; - iEntity = FindEntityByTargetName("heal_maker"); - if (iEntity != INVALID_ENT_REFERENCE) - TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR); + iEntity = FindEntityByTargetName("heal_maker"); + if (iEntity != INVALID_ENT_REFERENCE) + TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR); } //---------------------------------------------------------------------------------------------------- @@ -372,16 +372,16 @@ public void heal_maker_setrandom(const char[] output, int caller, int activator, //---------------------------------------------------------------------------------------------------- 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; + 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; + int iEntity = INVALID_ENT_REFERENCE; - iEntity = FindEntityByTargetName("stable_maker"); - if (iEntity != INVALID_ENT_REFERENCE) - TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR); + iEntity = FindEntityByTargetName("stable_maker"); + if (iEntity != INVALID_ENT_REFERENCE) + TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR); } //---------------------------------------------------------------------------------------------------- @@ -389,16 +389,16 @@ public void stable_maker_setrandom(const char[] output, int caller, int activato //---------------------------------------------------------------------------------------------------- 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; + 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; + int iEntity = INVALID_ENT_REFERENCE; - iEntity = FindEntityByTargetName("rotate_maker"); - if (iEntity != INVALID_ENT_REFERENCE) - TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR); + iEntity = FindEntityByTargetName("rotate_maker"); + if (iEntity != INVALID_ENT_REFERENCE) + TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR); } //---------------------------------------------------------------------------------------------------- @@ -406,19 +406,19 @@ public void rotate_maker_setrandom(const char[] output, int caller, int activato //---------------------------------------------------------------------------------------------------- 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; + 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; + int iEntity = INVALID_ENT_REFERENCE; - iEntity = FindEntityByTargetName("spike_maker"); - if (iEntity != INVALID_ENT_REFERENCE) - { - TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR); - AcceptEntityInput(iEntity, "ForceSpawn"); - } + iEntity = FindEntityByTargetName("spike_maker"); + if (iEntity != INVALID_ENT_REFERENCE) + { + TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR); + AcceptEntityInput(iEntity, "ForceSpawn"); + } } //---------------------------------------------------------------------------------------------------- @@ -426,24 +426,24 @@ public void spike_maker_top(const char[] output, int caller, int activator, floa //---------------------------------------------------------------------------------------------------- public void rtv_laser_timer(const char[] output, int caller, int activator, float delay) { - float fOrigin[3]; - fOrigin[0] = GetRandomFloat(6300.0, 8350.0); - fOrigin[1] = GetRandomFloat(-1850.0, 220.0); - fOrigin[2] = -610.0; + float fOrigin[3]; + fOrigin[0] = GetRandomFloat(6300.0, 8350.0); + fOrigin[1] = GetRandomFloat(-1850.0, 220.0); + fOrigin[2] = -610.0; - float fAngles[3]; - fAngles[0] = 0.0; - fAngles[1] = GetRandomFloat(0.0, 359.0); - fAngles[2] = 0.0; + float fAngles[3]; + fAngles[0] = 0.0; + fAngles[1] = GetRandomFloat(0.0, 359.0); + fAngles[2] = 0.0; - int iEntity = INVALID_ENT_REFERENCE; + int iEntity = INVALID_ENT_REFERENCE; - iEntity = FindEntityByTargetName("rtv_laser_maker"); - if (iEntity != INVALID_ENT_REFERENCE) - { - TeleportEntity(iEntity, fOrigin, fAngles, NULL_VECTOR); - AcceptEntityInput(iEntity, "ForceSpawn"); - } + iEntity = FindEntityByTargetName("rtv_laser_maker"); + if (iEntity != INVALID_ENT_REFERENCE) + { + TeleportEntity(iEntity, fOrigin, fAngles, NULL_VECTOR); + AcceptEntityInput(iEntity, "ForceSpawn"); + } } //---------------------------------------------------------------------------------------------------- @@ -451,19 +451,19 @@ public void rtv_laser_timer(const char[] output, int caller, int activator, floa //---------------------------------------------------------------------------------------------------- public void rtv_th_timer(const char[] output, int caller, int activator, float delay) { - float fOrigin[3]; - fOrigin[0] = GetRandomFloat(6300.0, 8350.0); - fOrigin[1] = GetRandomFloat(-1850.0, 220.0); - fOrigin[2] = -610.0; + float fOrigin[3]; + fOrigin[0] = GetRandomFloat(6300.0, 8350.0); + fOrigin[1] = GetRandomFloat(-1850.0, 220.0); + fOrigin[2] = -610.0; - int iEntity = INVALID_ENT_REFERENCE; + int iEntity = INVALID_ENT_REFERENCE; - iEntity = FindEntityByTargetName("rtv_th_maker"); - if (iEntity != INVALID_ENT_REFERENCE) - { - TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR); - AcceptEntityInput(iEntity, "ForceSpawn"); - } + iEntity = FindEntityByTargetName("rtv_th_maker"); + if (iEntity != INVALID_ENT_REFERENCE) + { + TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR); + AcceptEntityInput(iEntity, "ForceSpawn"); + } } //---------------------------------------------------------------------------------------------------- @@ -471,11 +471,11 @@ public void rtv_th_timer(const char[] output, int caller, int activator, float d //---------------------------------------------------------------------------------------------------- public void sbomb_1_Case01(const char[] output, int caller, int activator, float delay) { - int iEntity = INVALID_ENT_REFERENCE; - iEntity = FindEntityByTargetName("sbomb_1"); + int iEntity = INVALID_ENT_REFERENCE; + iEntity = FindEntityByTargetName("sbomb_1"); - if (iEntity != INVALID_ENT_REFERENCE) - run(iEntity, 300.0, 0.0); + if (iEntity != INVALID_ENT_REFERENCE) + run(iEntity, 300.0, 0.0); } //---------------------------------------------------------------------------------------------------- @@ -483,11 +483,11 @@ public void sbomb_1_Case01(const char[] output, int caller, int activator, float //---------------------------------------------------------------------------------------------------- public void sbomb_1_Case02(const char[] output, int caller, int activator, float delay) { - int iEntity = INVALID_ENT_REFERENCE; - iEntity = FindEntityByTargetName("sbomb_1"); + int iEntity = INVALID_ENT_REFERENCE; + iEntity = FindEntityByTargetName("sbomb_1"); - if (iEntity != INVALID_ENT_REFERENCE) - run(iEntity, -300.0, 0.0); + if (iEntity != INVALID_ENT_REFERENCE) + run(iEntity, -300.0, 0.0); } //---------------------------------------------------------------------------------------------------- @@ -495,11 +495,11 @@ public void sbomb_1_Case02(const char[] output, int caller, int activator, float //---------------------------------------------------------------------------------------------------- public void sbomb_1_Case03(const char[] output, int caller, int activator, float delay) { - int iEntity = INVALID_ENT_REFERENCE; - iEntity = FindEntityByTargetName("sbomb_1"); + int iEntity = INVALID_ENT_REFERENCE; + iEntity = FindEntityByTargetName("sbomb_1"); - if (iEntity != INVALID_ENT_REFERENCE) - run(iEntity, 0.0, 300.0); + if (iEntity != INVALID_ENT_REFERENCE) + run(iEntity, 0.0, 300.0); } //---------------------------------------------------------------------------------------------------- @@ -507,11 +507,11 @@ public void sbomb_1_Case03(const char[] output, int caller, int activator, float //---------------------------------------------------------------------------------------------------- public void sbomb_1_Case04(const char[] output, int caller, int activator, float delay) { - int iEntity = INVALID_ENT_REFERENCE; - iEntity = FindEntityByTargetName("sbomb_1"); + int iEntity = INVALID_ENT_REFERENCE; + iEntity = FindEntityByTargetName("sbomb_1"); - if (iEntity != INVALID_ENT_REFERENCE) - run(iEntity, 0.0, -300.0); + if (iEntity != INVALID_ENT_REFERENCE) + run(iEntity, 0.0, -300.0); } //---------------------------------------------------------------------------------------------------- @@ -519,11 +519,11 @@ public void sbomb_1_Case04(const char[] output, int caller, int activator, float //---------------------------------------------------------------------------------------------------- public void sbomb_2_Case01(const char[] output, int caller, int activator, float delay) { - int iEntity = INVALID_ENT_REFERENCE; - iEntity = FindEntityByTargetName("sbomb_2"); + int iEntity = INVALID_ENT_REFERENCE; + iEntity = FindEntityByTargetName("sbomb_2"); - if (iEntity != INVALID_ENT_REFERENCE) - run(iEntity, 300.0, 0.0); + if (iEntity != INVALID_ENT_REFERENCE) + run(iEntity, 300.0, 0.0); } //---------------------------------------------------------------------------------------------------- @@ -531,11 +531,11 @@ public void sbomb_2_Case01(const char[] output, int caller, int activator, float //---------------------------------------------------------------------------------------------------- public void sbomb_2_Case02(const char[] output, int caller, int activator, float delay) { - int iEntity = INVALID_ENT_REFERENCE; - iEntity = FindEntityByTargetName("sbomb_2"); + int iEntity = INVALID_ENT_REFERENCE; + iEntity = FindEntityByTargetName("sbomb_2"); - if (iEntity != INVALID_ENT_REFERENCE) - run(iEntity, -300.0, 0.0); + if (iEntity != INVALID_ENT_REFERENCE) + run(iEntity, -300.0, 0.0); } //---------------------------------------------------------------------------------------------------- @@ -543,11 +543,11 @@ public void sbomb_2_Case02(const char[] output, int caller, int activator, float //---------------------------------------------------------------------------------------------------- public void sbomb_2_Case03(const char[] output, int caller, int activator, float delay) { - int iEntity = INVALID_ENT_REFERENCE; - iEntity = FindEntityByTargetName("sbomb_2"); + int iEntity = INVALID_ENT_REFERENCE; + iEntity = FindEntityByTargetName("sbomb_2"); - if (iEntity != INVALID_ENT_REFERENCE) - run(iEntity, 0.0, 300.0); + if (iEntity != INVALID_ENT_REFERENCE) + run(iEntity, 0.0, 300.0); } //---------------------------------------------------------------------------------------------------- @@ -555,11 +555,11 @@ public void sbomb_2_Case03(const char[] output, int caller, int activator, float //---------------------------------------------------------------------------------------------------- public void sbomb_2_Case04(const char[] output, int caller, int activator, float delay) { - int iEntity = INVALID_ENT_REFERENCE; - iEntity = FindEntityByTargetName("sbomb_2"); + int iEntity = INVALID_ENT_REFERENCE; + iEntity = FindEntityByTargetName("sbomb_2"); - if (iEntity != INVALID_ENT_REFERENCE) - run(iEntity, 0.0, -300.0); + if (iEntity != INVALID_ENT_REFERENCE) + run(iEntity, 0.0, -300.0); } //---------------------------------------------------------------------------------------------------- @@ -567,11 +567,11 @@ public void sbomb_2_Case04(const char[] output, int caller, int activator, float //---------------------------------------------------------------------------------------------------- public void sbomb_3_Case01(const char[] output, int caller, int activator, float delay) { - int iEntity = INVALID_ENT_REFERENCE; - iEntity = FindEntityByTargetName("sbomb_3"); + int iEntity = INVALID_ENT_REFERENCE; + iEntity = FindEntityByTargetName("sbomb_3"); - if (iEntity != INVALID_ENT_REFERENCE) - run(iEntity, 300.0, 0.0); + if (iEntity != INVALID_ENT_REFERENCE) + run(iEntity, 300.0, 0.0); } //---------------------------------------------------------------------------------------------------- @@ -579,11 +579,11 @@ public void sbomb_3_Case01(const char[] output, int caller, int activator, float //---------------------------------------------------------------------------------------------------- public void sbomb_3_Case02(const char[] output, int caller, int activator, float delay) { - int iEntity = INVALID_ENT_REFERENCE; - iEntity = FindEntityByTargetName("sbomb_3"); + int iEntity = INVALID_ENT_REFERENCE; + iEntity = FindEntityByTargetName("sbomb_3"); - if (iEntity != INVALID_ENT_REFERENCE) - run(iEntity, -300.0, 0.0); + if (iEntity != INVALID_ENT_REFERENCE) + run(iEntity, -300.0, 0.0); } //---------------------------------------------------------------------------------------------------- @@ -591,11 +591,11 @@ public void sbomb_3_Case02(const char[] output, int caller, int activator, float //---------------------------------------------------------------------------------------------------- public void sbomb_3_Case03(const char[] output, int caller, int activator, float delay) { - int iEntity = INVALID_ENT_REFERENCE; - iEntity = FindEntityByTargetName("sbomb_3"); + int iEntity = INVALID_ENT_REFERENCE; + iEntity = FindEntityByTargetName("sbomb_3"); - if (iEntity != INVALID_ENT_REFERENCE) - run(iEntity, 0.0, 300.0); + if (iEntity != INVALID_ENT_REFERENCE) + run(iEntity, 0.0, 300.0); } //---------------------------------------------------------------------------------------------------- @@ -603,11 +603,11 @@ public void sbomb_3_Case03(const char[] output, int caller, int activator, float //---------------------------------------------------------------------------------------------------- public void sbomb_3_Case04(const char[] output, int caller, int activator, float delay) { - int iEntity = INVALID_ENT_REFERENCE; - iEntity = FindEntityByTargetName("sbomb_3"); + int iEntity = INVALID_ENT_REFERENCE; + iEntity = FindEntityByTargetName("sbomb_3"); - if (iEntity != INVALID_ENT_REFERENCE) - run(iEntity, 0.0, -300.0); + if (iEntity != INVALID_ENT_REFERENCE) + run(iEntity, 0.0, -300.0); } //---------------------------------------------------------------------------------------------------- @@ -615,7 +615,7 @@ public void sbomb_3_Case04(const char[] output, int caller, int activator, float //---------------------------------------------------------------------------------------------------- public void trigger_once_389450_display(const char[] output, int caller, int activator, float delay) { - Display(30); + Display(30); } //---------------------------------------------------------------------------------------------------- @@ -623,7 +623,7 @@ public void trigger_once_389450_display(const char[] output, int caller, int act //---------------------------------------------------------------------------------------------------- public void trigger_once_385777_display(const char[] output, int caller, int activator, float delay) { - Display(20); + Display(20); } //---------------------------------------------------------------------------------------------------- @@ -631,7 +631,7 @@ public void trigger_once_385777_display(const char[] output, int caller, int act //---------------------------------------------------------------------------------------------------- public void trigger_once_385886_display(const char[] output, int caller, int activator, float delay) { - Display(20); + Display(20); } //---------------------------------------------------------------------------------------------------- @@ -639,7 +639,7 @@ public void trigger_once_385886_display(const char[] output, int caller, int act //---------------------------------------------------------------------------------------------------- public void trigger_once_386004_display(const char[] output, int caller, int activator, float delay) { - Display(20); + Display(20); } //---------------------------------------------------------------------------------------------------- @@ -647,7 +647,7 @@ public void trigger_once_386004_display(const char[] output, int caller, int act //---------------------------------------------------------------------------------------------------- public void trigger_once_381463_display(const char[] output, int caller, int activator, float delay) { - Display(20); + Display(20); } //---------------------------------------------------------------------------------------------------- @@ -655,7 +655,7 @@ public void trigger_once_381463_display(const char[] output, int caller, int act //---------------------------------------------------------------------------------------------------- public void trigger_once_381581_display(const char[] output, int caller, int activator, float delay) { - Display(20); + Display(20); } //---------------------------------------------------------------------------------------------------- @@ -663,7 +663,7 @@ public void trigger_once_381581_display(const char[] output, int caller, int act //---------------------------------------------------------------------------------------------------- public void trigger_once_381648_display(const char[] output, int caller, int activator, float delay) { - Display(30); + Display(30); } //---------------------------------------------------------------------------------------------------- @@ -671,7 +671,7 @@ public void trigger_once_381648_display(const char[] output, int caller, int act //---------------------------------------------------------------------------------------------------- public void trigger_once_378212_display(const char[] output, int caller, int activator, float delay) { - Display(20); + Display(20); } //---------------------------------------------------------------------------------------------------- @@ -679,7 +679,7 @@ public void trigger_once_378212_display(const char[] output, int caller, int act //---------------------------------------------------------------------------------------------------- public void trigger_once_375007_display(const char[] output, int caller, int activator, float delay) { - Display(15); + Display(15); } //---------------------------------------------------------------------------------------------------- @@ -687,7 +687,7 @@ public void trigger_once_375007_display(const char[] output, int caller, int act //---------------------------------------------------------------------------------------------------- public void func_button_241061_display(const char[] output, int caller, int activator, float delay) { - Display(30); + Display(30); } //---------------------------------------------------------------------------------------------------- @@ -695,7 +695,7 @@ public void func_button_241061_display(const char[] output, int caller, int acti //---------------------------------------------------------------------------------------------------- public void trigger_once_213033_display(const char[] output, int caller, int activator, float delay) { - Display(30); + Display(30); } //---------------------------------------------------------------------------------------------------- @@ -703,7 +703,7 @@ public void trigger_once_213033_display(const char[] output, int caller, int act //---------------------------------------------------------------------------------------------------- public void trigger_once_142829_display(const char[] output, int caller, int activator, float delay) { - Display(20); + Display(20); } //---------------------------------------------------------------------------------------------------- @@ -711,7 +711,7 @@ public void trigger_once_142829_display(const char[] output, int caller, int act //---------------------------------------------------------------------------------------------------- public void trigger_once_95608_display(const char[] output, int caller, int activator, float delay) { - Display(30); + Display(30); } //---------------------------------------------------------------------------------------------------- @@ -719,7 +719,7 @@ public void trigger_once_95608_display(const char[] output, int caller, int acti //---------------------------------------------------------------------------------------------------- public void trigger_once_95733_display(const char[] output, int caller, int activator, float delay) { - Display(30); + Display(30); } //---------------------------------------------------------------------------------------------------- @@ -727,7 +727,7 @@ public void trigger_once_95733_display(const char[] output, int caller, int acti //---------------------------------------------------------------------------------------------------- public void trigger_once_95823_display(const char[] output, int caller, int activator, float delay) { - Display(20); + Display(20); } //---------------------------------------------------------------------------------------------------- @@ -735,7 +735,7 @@ public void trigger_once_95823_display(const char[] output, int caller, int acti //---------------------------------------------------------------------------------------------------- public void func_button_77927_display(const char[] output, int caller, int activator, float delay) { - Display(30); + Display(30); } //---------------------------------------------------------------------------------------------------- @@ -743,7 +743,7 @@ public void func_button_77927_display(const char[] output, int caller, int activ //---------------------------------------------------------------------------------------------------- public void trigger_once_23408_display(const char[] output, int caller, int activator, float delay) { - Display(35); + Display(35); } //---------------------------------------------------------------------------------------------------- @@ -751,7 +751,7 @@ public void trigger_once_23408_display(const char[] output, int caller, int acti //---------------------------------------------------------------------------------------------------- public void trigger_once_23452_display(const char[] output, int caller, int activator, float delay) { - Display(20); + Display(20); } //---------------------------------------------------------------------------------------------------- @@ -759,7 +759,7 @@ public void trigger_once_23452_display(const char[] output, int caller, int acti //---------------------------------------------------------------------------------------------------- public void trigger_once_23474_display(const char[] output, int caller, int activator, float delay) { - Display(25); + Display(25); } //---------------------------------------------------------------------------------------------------- @@ -767,7 +767,7 @@ public void trigger_once_23474_display(const char[] output, int caller, int acti //---------------------------------------------------------------------------------------------------- public void trigger_once_579052_display(const char[] output, int caller, int activator, float delay) { - Display(20); + Display(20); } //---------------------------------------------------------------------------------------------------- @@ -775,7 +775,7 @@ public void trigger_once_579052_display(const char[] output, int caller, int act //---------------------------------------------------------------------------------------------------- public void func_breakable_23551_display(const char[] output, int caller, int activator, float delay) { - Display(20); + Display(20); } //---------------------------------------------------------------------------------------------------- @@ -783,7 +783,7 @@ public void func_breakable_23551_display(const char[] output, int caller, int ac //---------------------------------------------------------------------------------------------------- public void func_button_21950_display(const char[] output, int caller, int activator, float delay) { - Display(30); + Display(30); } //---------------------------------------------------------------------------------------------------- @@ -791,7 +791,7 @@ public void func_button_21950_display(const char[] output, int caller, int activ //---------------------------------------------------------------------------------------------------- public void func_button_22017_display(const char[] output, int caller, int activator, float delay) { - Display(10); + Display(10); } //---------------------------------------------------------------------------------------------------- @@ -799,7 +799,7 @@ public void func_button_22017_display(const char[] output, int caller, int activ //---------------------------------------------------------------------------------------------------- public void func_breakable_3664_display(const char[] output, int caller, int activator, float delay) { - Display(45); + Display(45); } //---------------------------------------------------------------------------------------------------- @@ -807,7 +807,7 @@ public void func_breakable_3664_display(const char[] output, int caller, int act //---------------------------------------------------------------------------------------------------- public void math_counter_11288_display(const char[] output, int caller, int activator, float delay) { - Display(51); + Display(51); } //---------------------------------------------------------------------------------------------------- @@ -815,25 +815,25 @@ public void math_counter_11288_display(const char[] output, int caller, int acti //---------------------------------------------------------------------------------------------------- public void Display(int iTimer) { - int iRelay = CreateEntityByName("logic_relay"); - DispatchKeyFormat(iRelay, "targetname", "vscript_countdown_relay"); - DispatchKeyFormat(iRelay, "spawnflags", "0"); - DispatchKeyFormat(iRelay, "OnSpawn", "seconds_left,AddOutput,message seconds left,0,-1"); - DispatchKeyFormat(iRelay, "OnSpawn", "text_sec,AddOutput,message %d,0,-1", iTimer - 1); + int iRelay = CreateEntityByName("logic_relay"); + DispatchKeyFormat(iRelay, "targetname", "vscript_countdown_relay"); + DispatchKeyFormat(iRelay, "spawnflags", "0"); + DispatchKeyFormat(iRelay, "OnSpawn", "seconds_left,AddOutput,message seconds left,0,-1"); + DispatchKeyFormat(iRelay, "OnSpawn", "text_sec,AddOutput,message %d,0,-1", iTimer - 1); - int iBackup = iTimer; - for (int j = 0; j <= iTimer; j++) - { - iBackup--; - DispatchKeyFormat(iRelay, "OnSpawn", "text_sec,AddOutput,message %d,%d,-1", iBackup, j); - DispatchKeyFormat(iRelay, "OnSpawn", "seconds_left,Display,,%d,-1", j); - DispatchKeyFormat(iRelay, "OnSpawn", "text_sec,Display,,%d,-1", j); - } + int iBackup = iTimer; + for (int j = 0; j <= iTimer; j++) + { + iBackup--; + DispatchKeyFormat(iRelay, "OnSpawn", "text_sec,AddOutput,message %d,%d,-1", iBackup, j); + DispatchKeyFormat(iRelay, "OnSpawn", "seconds_left,Display,,%d,-1", j); + DispatchKeyFormat(iRelay, "OnSpawn", "text_sec,Display,,%d,-1", j); + } - DispatchKeyFormat(iRelay, "OnSpawn", "seconds_left,AddOutput,message ,%d,-1", iTimer + 1); - DispatchKeyFormat(iRelay, "OnSpawn", "text_sec,AddOutput,message ,%d,-1", iTimer + 1); - DispatchKeyFormat(iRelay, "OnSpawn", "!self,Kill,,%d,-1", iTimer + 2); - SpawnAndActivate(iRelay); + DispatchKeyFormat(iRelay, "OnSpawn", "seconds_left,AddOutput,message ,%d,-1", iTimer + 1); + DispatchKeyFormat(iRelay, "OnSpawn", "text_sec,AddOutput,message ,%d,-1", iTimer + 1); + DispatchKeyFormat(iRelay, "OnSpawn", "!self,Kill,,%d,-1", iTimer + 2); + SpawnAndActivate(iRelay); } //---------------------------------------------------------------------------------------------------- @@ -841,19 +841,19 @@ public void Display(int iTimer) //---------------------------------------------------------------------------------------------------- public void run(int iEntity, float fX1, float fY1) { - float fOrigin[3]; - GetEntPropVector(iEntity, Prop_Send, "m_vecOrigin", fOrigin); - fOrigin[0] += fX1; - fOrigin[1] += fY1; + float fOrigin[3]; + GetEntPropVector(iEntity, Prop_Send, "m_vecOrigin", fOrigin); + fOrigin[0] += fX1; + fOrigin[1] += fY1; - if (fOrigin[0] > 8300.0 || fOrigin[1] > 150.0 || fOrigin[0] < -1800.0 || fOrigin[1] < -5194.0) - { - fOrigin[0] = 7312.0; - fOrigin[1] = -816.0; - fOrigin[2] = -634.0; - } + if (fOrigin[0] > 8300.0 || fOrigin[1] > 150.0 || fOrigin[0] < -1800.0 || fOrigin[1] < -5194.0) + { + fOrigin[0] = 7312.0; + fOrigin[1] = -816.0; + fOrigin[2] = -634.0; + } - TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR); + TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR); } //---------------------------------------------------------------------------------------------------- @@ -861,20 +861,20 @@ public void run(int iEntity, float fX1, float fY1) //---------------------------------------------------------------------------------------------------- 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)); + 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; - } - } + if (strcmp(sTargetnameToFind, sTargetname, false) == 0) + { + return iEntity; + } + } - PrintToChatAll("[VScripts] Error! Could not find entity: %s", sTargetnameToFind); - return INVALID_ENT_REFERENCE; + PrintToChatAll("[VScripts] Error! Could not find entity: %s", sTargetnameToFind); + return INVALID_ENT_REFERENCE; } //---------------------------------------------------------------------------------------------------- @@ -882,17 +882,17 @@ public int FindEntityByTargetName(const char[] sTargetnameToFind) //---------------------------------------------------------------------------------------------------- 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; - } - } + 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; + PrintToChatAll("[VScripts] Error! Could not find entity: #%d", iHammerID); + return INVALID_ENT_REFERENCE; } //---------------------------------------------------------------------------------------------------- @@ -900,10 +900,10 @@ public int FindEntityByHammerID(int iHammerID) //---------------------------------------------------------------------------------------------------- stock bool DispatchKeyFormat(int entity, const char[] key, const char[] value, any ...) { - char buffer[1024]; - VFormat(buffer, sizeof(buffer), value, 4); + char buffer[1024]; + VFormat(buffer, sizeof(buffer), value, 4); - DispatchKeyValue(entity, key, buffer); + DispatchKeyValue(entity, key, buffer); } //---------------------------------------------------------------------------------------------------- @@ -911,8 +911,8 @@ stock bool DispatchKeyFormat(int entity, const char[] key, const char[] value, a //---------------------------------------------------------------------------------------------------- stock void SpawnAndActivate(int entity) { - DispatchSpawn(entity); - ActivateEntity(entity); + DispatchSpawn(entity); + ActivateEntity(entity); } //---------------------------------------------------------------------------------------------------- @@ -920,5 +920,5 @@ stock void SpawnAndActivate(int entity) //---------------------------------------------------------------------------------------------------- stock bool IsValidClient(int client) { - return (client > 0 && client <= MaxClients && IsClientInGame(client) && IsPlayerAlive(client)); -} \ No newline at end of file + return (client > 0 && client <= MaxClients && IsClientInGame(client) && IsPlayerAlive(client)); +} diff --git a/momsurffix_map_specific/scripting/momsurffix2.sp b/momsurffix_map_specific/scripting/momsurffix2.sp new file mode 100644 index 00000000..9b691272 --- /dev/null +++ b/momsurffix_map_specific/scripting/momsurffix2.sp @@ -0,0 +1,704 @@ +#include "sourcemod" +#include "sdktools" +#include "sdkhooks" +#include "dhooks" + +#define SNAME "[momsurffix2] " +#define GAME_DATA_FILE "momsurffix2.games" +//#define DEBUG_PROFILE +//#define DEBUG_MEMTEST + +public Plugin myinfo = { + name = "Momentum surf fix \2", + author = "GAMMA CASE", + description = "Ported surf fix from momentum mod.", + version = "1.1.5", + url = "http://steamcommunity.com/id/_GAMMACASE_/" +}; + +#define FLT_EPSILON 1.192092896e-07 +#define MAX_CLIP_PLANES 5 + +#define ASM_PATCH_LEN 17 +#define ASM_START_OFFSET 100 + +enum OSType +{ + OSUnknown = -1, + OSWindows = 1, + OSLinux = 2 +}; + +OSType gOSType; +EngineVersion gEngineVersion; + +#define ASSERTUTILS_FAILSTATE_FUNC SetFailStateCustom +#define MEMUTILS_PLUGINENDCALL +#include "glib/memutils" +#undef MEMUTILS_PLUGINENDCALL + +#include "momsurffix/utils.sp" +#include "momsurffix/baseplayer.sp" +#include "momsurffix/gametrace.sp" +#include "momsurffix/gamemovement.sp" + +ConVar gRampBumpCount, + gBounce, + gRampInitialRetraceLength, + gNoclipWorkAround; + +float vec3_origin[3] = {0.0, 0.0, 0.0}; +bool gBasePlayerLoadedTooEarly; +bool bValidMap = false; + +#define DEBUG_PROFILE + +#if defined DEBUG_PROFILE +#include "profiler" +Profiler gProf; +ArrayList gProfData; +float gProfTime; + +void PROF_START() +{ + if(gProf) + gProf.Start(); +} + +void PROF_STOP(int idx) +{ + if(gProf) + { + gProf.Stop(); + Prof_Check(idx); + } +} + +#else +#define PROF_START%1; +#define PROF_STOP%1; +#endif + +public void OnPluginStart() +{ + char sCurMap[256]; + GetCurrentMap(sCurMap, sizeof(sCurMap)); + bValidMap = (strcmp("ze_atix_helicopter_i3d_c1", sCurMap, false) == 0); + +#if defined DEBUG_MEMTEST + RegAdminCmd("sm_mom_dumpmempool", SM_Dumpmempool, ADMFLAG_ROOT, "Dumps active momory pool. Mainly for debugging."); +#endif +#if defined DEBUG_PROFILE + RegAdminCmd("sm_mom_prof", SM_Prof, ADMFLAG_ROOT, "Profiles performance of some expensive parts. Mainly for debugging."); +#endif + + gRampBumpCount = CreateConVar("momsurffix_ramp_bumpcount", "8", "Helps with fixing surf/ramp bugs", .hasMin = true, .min = 4.0, .hasMax = true, .max = 16.0); + gRampInitialRetraceLength = CreateConVar("momsurffix_ramp_initial_retrace_length", "0.2", "Amount of units used in offset for retraces", .hasMin = true, .min = 0.2, .hasMax = true, .max = 5.0); + gNoclipWorkAround = CreateConVar("momsurffix_enable_noclip_workaround", "1", "Enables workaround to prevent issue #1, can actually help if momsuffix_enable_asm_optimizations is 0", .hasMin = true, .min = 0.0, .hasMax = true, .max = 1.0); + gBounce = FindConVar("sv_bounce"); + ASSERT_MSG(gBounce, "\"sv_bounce\" convar wasnt found!"); + + AutoExecConfig(); + + GameData gd = new GameData(GAME_DATA_FILE); + ASSERT_FINAL(gd); + + ValidateGameAndOS(gd); + + InitUtils(gd); + InitGameTrace(gd); + gBasePlayerLoadedTooEarly = InitBasePlayer(gd); + InitGameMovement(gd); + + SetupDhooks(gd); + + delete gd; +} + +public void OnMapStart() +{ + char sCurMap[256]; + GetCurrentMap(sCurMap, sizeof(sCurMap)); + bValidMap = (strcmp("ze_atix_helicopter_i3d_c1", sCurMap, false) == 0); + + if(gBasePlayerLoadedTooEarly) + { + GameData gd = new GameData(GAME_DATA_FILE); + LateInitBasePlayer(gd); + gBasePlayerLoadedTooEarly = false; + delete gd; + } +} + +public void OnPluginEnd() +{ + CleanUpUtils(); +} + +#if defined DEBUG_MEMTEST +public Action SM_Dumpmempool(int client, int args) +{ + DumpMemoryUsage(); + + return Plugin_Handled; +} +#endif + +#if defined DEBUG_PROFILE +public Action SM_Prof(int client, int args) +{ + if(args < 1) + { + ReplyToCommand(client, SNAME..."Usage: sm_prof "); + return Plugin_Handled; + } + + char buff[32]; + GetCmdArg(1, buff, sizeof(buff)); + gProfTime = StringToFloat(buff); + + if(gProfTime <= 0.1) + { + ReplyToCommand(client, SNAME..."Time should be higher then 0.1 seconds."); + return Plugin_Handled; + } + + gProfData = new ArrayList(3); + gProf = new Profiler(); + CreateTimer(gProfTime, Prof_Check_Timer, client); + + ReplyToCommand(client, SNAME..."Profiler started, awaiting %.2f seconds.", gProfTime); + + return Plugin_Handled; +} + +stock void Prof_Check(int idx) +{ + int idx2; + if(gProfData.Length - 1 < idx) + { + idx2 = gProfData.Push(gProf.Time); + gProfData.Set(idx2, 1, 1); + gProfData.Set(idx2, idx, 2); + } + else + { + idx2 = gProfData.FindValue(idx, 2); + + gProfData.Set(idx2, view_as(gProfData.Get(idx2)) + gProf.Time); + gProfData.Set(idx2, gProfData.Get(idx2, 1) + 1, 1); + } +} + +public Action Prof_Check_Timer(Handle timer, int client) +{ + ReplyToCommand(client, SNAME..."Profiler finished:"); + if(gProfData.Length == 0) + ReplyToCommand(client, SNAME..."There was no profiling data..."); + + for(int i = 0; i < gProfData.Length; i++) + ReplyToCommand(client, SNAME..."[%i] Avg time: %f | Calls: %i", i, view_as(gProfData.Get(i)) / float(gProfData.Get(i, 1)), gProfData.Get(i, 1)); + + delete gProf; + delete gProfData; + + return Plugin_Handled; +} +#endif + +void ValidateGameAndOS(GameData gd) +{ + gOSType = view_as(gd.GetOffset("OSType")); + ASSERT_FINAL_MSG(gOSType != OSUnknown, "Failed to get OS type or you are trying to load it on unsupported OS!"); + + gEngineVersion = GetEngineVersion(); + ASSERT_FINAL_MSG(gEngineVersion == Engine_CSS || gEngineVersion == Engine_CSGO, "Only CSGO and CSS are supported by this plugin!"); +} + +void SetupDhooks(GameData gd) +{ + Handle dhook = DHookCreateDetour(Address_Null, CallConv_THISCALL, ReturnType_Int, ThisPointer_Address); + + DHookSetFromConf(dhook, gd, SDKConf_Signature, "CGameMovement::TryPlayerMove"); + DHookAddParam(dhook, HookParamType_Int); + DHookAddParam(dhook, HookParamType_Int); + + ASSERT(DHookEnableDetour(dhook, false, TryPlayerMove_Dhook)); +} + +public MRESReturn TryPlayerMove_Dhook(Address pThis, Handle hReturn, Handle hParams) +{ + if (!bValidMap) //only on atix helicopter we want to disable the fix. + { + Address pFirstDest = DHookGetParam(hParams, 1); + Address pFirstTrace = DHookGetParam(hParams, 2); + + DHookSetReturn(hReturn, TryPlayerMove(view_as(pThis), view_as(pFirstDest), view_as(pFirstTrace))); + } + + return MRES_Supercede; +} + +int TryPlayerMove(CGameMovement pThis, Vector pFirstDest, CGameTrace pFirstTrace) +{ + float original_velocity[3], primal_velocity[3], fixed_origin[3], valid_plane[3], new_velocity[3], end[3], dir[3]; + float allFraction, d, time_left = GetGameFrameTime(), planes[MAX_CLIP_PLANES][3]; + int bumpcount, blocked, numplanes, numbumps = gRampBumpCount.IntValue, i, j, h; + bool stuck_on_ramp, has_valid_plane; + CGameTrace pm = CGameTrace(); + + Vector vecVelocity = pThis.mv.m_vecVelocity; + vecVelocity.ToArray(original_velocity); + vecVelocity.ToArray(primal_velocity); + Vector vecAbsOrigin = pThis.mv.m_vecAbsOrigin; + vecAbsOrigin.ToArray(fixed_origin); + + Vector plane_normal; + static Vector alloced_vector, alloced_vector2; + + if(alloced_vector.Address == Address_Null) + alloced_vector = Vector(); + + if(alloced_vector2.Address == Address_Null) + alloced_vector2 = Vector(); + + for(bumpcount = 0; bumpcount < numbumps; bumpcount++) + { + if(vecVelocity.LengthSqr() == 0.0) + break; + + if(stuck_on_ramp) + { + if(!has_valid_plane) + { + plane_normal = pm.plane.normal; + if(!CloseEnough(VectorToArray(plane_normal), view_as({0.0, 0.0, 0.0})) && + !IsEqual(valid_plane, VectorToArray(plane_normal))) + { + plane_normal.ToArray(valid_plane); + has_valid_plane = true; + } + else + { + for(i = numplanes; i-- > 0;) + { + if(!CloseEnough(planes[i], view_as({0.0, 0.0, 0.0})) && + FloatAbs(planes[i][0]) <= 1.0 && FloatAbs(planes[i][1]) <= 1.0 && FloatAbs(planes[i][2]) <= 1.0 && + !IsEqual(valid_plane, planes[i])) + { + VectorCopy(planes[i], valid_plane); + has_valid_plane = true; + break; + } + } + } + } + + if(has_valid_plane) + { + alloced_vector.FromArray(valid_plane); + if(valid_plane[2] >= 0.7 && valid_plane[2] <= 1.0) + { + ClipVelocity(pThis, vecVelocity, alloced_vector, vecVelocity, 1.0); + vecVelocity.ToArray(original_velocity); + } + else + { + ClipVelocity(pThis, vecVelocity, alloced_vector, vecVelocity, 1.0 + gBounce.FloatValue * (1.0 - pThis.player.m_surfaceFriction)); + vecVelocity.ToArray(original_velocity); + } + alloced_vector.ToArray(valid_plane); + } + //TODO: should be replaced with normal solution!! Currently hack to fix issue #1. + else if(!gNoclipWorkAround.BoolValue || (vecVelocity.z < -6.25 || vecVelocity.z > 0.0)) + { + //Quite heavy part of the code, should not be triggered much or else it'll impact performance by a lot!!! + float offsets[3]; + offsets[0] = (float(bumpcount) * 2.0) * -gRampInitialRetraceLength.FloatValue; + offsets[2] = (float(bumpcount) * 2.0) * gRampInitialRetraceLength.FloatValue; + int valid_planes = 0; + + VectorCopy(view_as({0.0, 0.0, 0.0}), valid_plane); + + float offset[3], offset_mins[3], offset_maxs[3], buff[3]; + static Ray_t ray; + + // Keep this variable allocated only once + // since ray.Init should take care of removing any left garbage values + if(ray.Address == Address_Null) + ray = Ray_t(); + + for(i = 0; i < 3; i++) + { + for(j = 0; j < 3; j++) + { + for(h = 0; h < 3; h++) + { + PROF_START(); + offset[0] = offsets[i]; + offset[1] = offsets[j]; + offset[2] = offsets[h]; + + VectorCopy(offset, offset_mins); + ScaleVector(offset_mins, 0.5); + VectorCopy(offset, offset_maxs); + ScaleVector(offset_maxs, 0.5); + + if(offset[0] > 0.0) + offset_mins[0] /= 2.0; + if(offset[1] > 0.0) + offset_mins[1] /= 2.0; + if(offset[2] > 0.0) + offset_mins[2] /= 2.0; + + if(offset[0] < 0.0) + offset_maxs[0] /= 2.0; + if(offset[1] < 0.0) + offset_maxs[1] /= 2.0; + if(offset[2] < 0.0) + offset_maxs[2] /= 2.0; + PROF_STOP(0); + + PROF_START(); + AddVectors(fixed_origin, offset, buff); + SubtractVectors(end, offset, offset); + if(gEngineVersion == Engine_CSGO) + { + SubtractVectors(VectorToArray(GetPlayerMins(pThis)), offset_mins, offset_mins); + AddVectors(VectorToArray(GetPlayerMaxs(pThis)), offset_maxs, offset_maxs); + } + else + { + SubtractVectors(VectorToArray(GetPlayerMinsCSS(pThis, alloced_vector)), offset_mins, offset_mins); + AddVectors(VectorToArray(GetPlayerMaxsCSS(pThis, alloced_vector2)), offset_maxs, offset_maxs); + } + PROF_STOP(1); + + PROF_START(); + ray.Init(buff, offset, offset_mins, offset_maxs); + PROF_STOP(2); + + PROF_START(); + UTIL_TraceRay(ray, MASK_PLAYERSOLID, pThis, COLLISION_GROUP_PLAYER_MOVEMENT, pm); + PROF_STOP(3); + + PROF_START(); + plane_normal = pm.plane.normal; + + if(FloatAbs(plane_normal.x) <= 1.0 && FloatAbs(plane_normal.y) <= 1.0 && + FloatAbs(plane_normal.z) <= 1.0 && pm.fraction > 0.0 && pm.fraction < 1.0 && !pm.startsolid) + { + valid_planes++; + AddVectors(valid_plane, VectorToArray(plane_normal), valid_plane); + } + PROF_STOP(4); + } + } + } + + if(valid_planes != 0 && !CloseEnough(valid_plane, view_as({0.0, 0.0, 0.0}))) + { + has_valid_plane = true; + NormalizeVector(valid_plane, valid_plane); + continue; + } + } + + if(has_valid_plane) + { + VectorMA(fixed_origin, gRampInitialRetraceLength.FloatValue, valid_plane, fixed_origin); + } + else + { + stuck_on_ramp = false; + continue; + } + } + + VectorMA(fixed_origin, time_left, VectorToArray(vecVelocity), end); + + if(pFirstDest.Address != Address_Null && IsEqual(end, VectorToArray(pFirstDest))) + { + pm.Free(); + pm = pFirstTrace; + } + else + { + alloced_vector2.FromArray(end); + + if(stuck_on_ramp && has_valid_plane) + { + alloced_vector.FromArray(fixed_origin); + TracePlayerBBox(pThis, alloced_vector, alloced_vector2, MASK_PLAYERSOLID, COLLISION_GROUP_PLAYER_MOVEMENT, pm); + pm.plane.normal.FromArray(valid_plane); + } + else + { + TracePlayerBBox(pThis, vecAbsOrigin, alloced_vector2, MASK_PLAYERSOLID, COLLISION_GROUP_PLAYER_MOVEMENT, pm); + } + } + + if(bumpcount > 0 && pThis.player.m_hGroundEntity == view_as
(-1) && !IsValidMovementTrace(pThis, pm)) + { + has_valid_plane = false; + stuck_on_ramp = true; + continue; + } + + if(pm.fraction > 0.0) + { + if((bumpcount == 0 || pThis.player.m_hGroundEntity != view_as
(-1)) && numbumps > 0 && pm.fraction == 1.0) + { + CGameTrace stuck = CGameTrace(); + TracePlayerBBox(pThis, pm.endpos, pm.endpos, MASK_PLAYERSOLID, COLLISION_GROUP_PLAYER_MOVEMENT, stuck); + + if((stuck.startsolid || stuck.fraction != 1.0) && bumpcount == 0) + { + has_valid_plane = false; + stuck_on_ramp = true; + + stuck.Free(); + continue; + } + else if(stuck.startsolid || stuck.fraction != 1.0) + { + vecVelocity.FromArray(vec3_origin); + + stuck.Free(); + break; + } + + stuck.Free(); + } + + has_valid_plane = false; + stuck_on_ramp = false; + + vecVelocity.ToArray(original_velocity); + vecAbsOrigin.FromArray(VectorToArray(pm.endpos)); + vecAbsOrigin.ToArray(fixed_origin); + allFraction += pm.fraction; + numplanes = 0; + } + + if(CloseEnoughFloat(pm.fraction, 1.0)) + break; + + MoveHelper().AddToTouched(pm, vecVelocity); + + if(pm.plane.normal.z >= 0.7) + blocked |= 1; + + if(CloseEnoughFloat(pm.plane.normal.z, 0.0)) + blocked |= 2; + + time_left -= time_left * pm.fraction; + + if(numplanes >= MAX_CLIP_PLANES) + { + vecVelocity.FromArray(vec3_origin); + break; + } + + pm.plane.normal.ToArray(planes[numplanes]); + numplanes++; + + if(numplanes == 1 && pThis.player.m_MoveType == MOVETYPE_WALK && pThis.player.m_hGroundEntity != view_as
(-1)) + { + Vector vec1 = Vector(); + PROF_START(); + if(planes[0][2] >= 0.7) + { + vec1.FromArray(original_velocity); + alloced_vector2.FromArray(planes[0]); + alloced_vector.FromArray(new_velocity); + ClipVelocity(pThis, vec1, alloced_vector2, alloced_vector, 1.0); + alloced_vector.ToArray(original_velocity); + alloced_vector.ToArray(new_velocity); + } + else + { + vec1.FromArray(original_velocity); + alloced_vector2.FromArray(planes[0]); + alloced_vector.FromArray(new_velocity); + ClipVelocity(pThis, vec1, alloced_vector2, alloced_vector, 1.0 + gBounce.FloatValue * (1.0 - pThis.player.m_surfaceFriction)); + alloced_vector.ToArray(new_velocity); + } + PROF_STOP(5); + + vecVelocity.FromArray(new_velocity); + VectorCopy(new_velocity, original_velocity); + + vec1.Free(); + } + else + { + for(i = 0; i < numplanes; i++) + { + alloced_vector2.FromArray(original_velocity); + alloced_vector.FromArray(planes[i]); + ClipVelocity(pThis, alloced_vector2, alloced_vector, vecVelocity, 1.0); + alloced_vector.ToArray(planes[i]); + + for(j = 0; j < numplanes; j++) + if(j != i) + if(vecVelocity.Dot(planes[j]) < 0.0) + break; + + if(j == numplanes) + break; + } + + if(i != numplanes) + { + + } + else + { + if(numplanes != 2) + { + vecVelocity.FromArray(vec3_origin); + break; + } + + if(CloseEnough(planes[0], planes[1])) + { + VectorMA(original_velocity, 20.0, planes[0], new_velocity); + vecVelocity.x = new_velocity[0]; + vecVelocity.y = new_velocity[1]; + + break; + } + + GetVectorCrossProduct(planes[0], planes[1], dir); + NormalizeVector(dir, dir); + + d = vecVelocity.Dot(dir); + + ScaleVector(dir, d); + vecVelocity.FromArray(dir); + } + + d = vecVelocity.Dot(primal_velocity); + if(d <= 0.0) + { + vecVelocity.FromArray(vec3_origin); + break; + } + } + } + + if(CloseEnoughFloat(allFraction, 0.0)) + vecVelocity.FromArray(vec3_origin); + + pm.Free(); + return blocked; +} + +stock void VectorMA(float start[3], float scale, float dir[3], float dest[3]) +{ + dest[0] = start[0] + dir[0] * scale; + dest[1] = start[1] + dir[1] * scale; + dest[2] = start[2] + dir[2] * scale; +} + +stock void VectorCopy(float from[3], float to[3]) +{ + to[0] = from[0]; + to[1] = from[1]; + to[2] = from[2]; +} + +stock float[] VectorToArray(Vector vec) +{ + float ret[3]; + vec.ToArray(ret); + return ret; +} + +stock bool IsEqual(float a[3], float b[3]) +{ + return a[0] == b[0] && a[1] == b[1] && a[2] == b[2]; +} + +stock bool CloseEnough(float a[3], float b[3], float eps = FLT_EPSILON) +{ + return FloatAbs(a[0] - b[0]) <= eps && + FloatAbs(a[1] - b[1]) <= eps && + FloatAbs(a[2] - b[2]) <= eps; +} + +stock bool CloseEnoughFloat(float a, float b, float eps = FLT_EPSILON) +{ + return FloatAbs(a - b) <= eps; +} + +public void SetFailStateCustom(const char[] fmt, any ...) +{ + char buff[512]; + VFormat(buff, sizeof(buff), fmt, 2); + + CleanUpUtils(); + + char ostype[32]; + switch(gOSType) + { + case OSLinux: ostype = "LIN"; + case OSWindows: ostype = "WIN"; + default: ostype = "UNK"; + } + + SetFailState("[%s | %i] %s", ostype, gEngineVersion, buff); +} + +stock bool IsValidMovementTrace(CGameMovement pThis, CGameTrace tr) +{ + if(tr.allsolid || tr.startsolid) + return false; + + if(CloseEnoughFloat(tr.fraction, 0.0)) + return false; + + Vector plane_normal = tr.plane.normal; + if(FloatAbs(plane_normal.x) > 1.0 || FloatAbs(plane_normal.y) > 1.0 || FloatAbs(plane_normal.z) > 1.0) + return false; + + CGameTrace stuck = CGameTrace(); + + TracePlayerBBox(pThis, tr.endpos, tr.endpos, MASK_PLAYERSOLID, COLLISION_GROUP_PLAYER_MOVEMENT, stuck); + if(stuck.startsolid || !CloseEnoughFloat(stuck.fraction, 1.0)) + { + stuck.Free(); + return false; + } + + stuck.Free(); + return true; +} + +stock void UTIL_TraceRay(Ray_t ray, int mask, CGameMovement gm, int collisionGroup, CGameTrace trace) +{ + if(gEngineVersion == Engine_CSGO) + { + CTraceFilterSimple filter = LockTraceFilter(gm, collisionGroup); + + gm.m_nTraceCount++; + ITraceListData tracelist = gm.m_pTraceListData; + + if(tracelist.Address != Address_Null && tracelist.CanTraceRay(ray)) + TraceRayAgainstLeafAndEntityList(ray, tracelist, mask, filter, trace); + else + TraceRay(ray, mask, filter, trace); + + UnlockTraceFilter(gm, filter); + } + else if(gEngineVersion == Engine_CSS) + { + CTraceFilterSimple filter = CTraceFilterSimple(); + filter.Init(LookupEntity(gm.mv.m_nPlayerHandle), collisionGroup); + + TraceRay(ray, mask, filter, trace); + + filter.Free(); + } +}