Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma semicolon 1
- #define DEBUG
- #define PLUGIN_AUTHOR ""
- #define PLUGIN_VERSION "0.00"
- #include <sourcemod>
- #include <sdktools>
- #include <morecolors>
- #pragma newdecls required
- bool Enabled;
- public Plugin myinfo =
- {
- name = "xXSoulXx",
- author = PLUGIN_AUTHOR,
- description = "I don't know'",
- version = PLUGIN_VERSION,
- url = ""
- };
- public void OnPluginStart()
- {
- RegAdminCmd("sm_test", Command_Test, ADMFLAG_GENERIC, "Spawns a bot");
- }
- public Action Command_Test(int client, int args)
- {
- if (Enabled)
- {
- Enabled = false;
- ServerCommand("tf_bot_kick all");
- CPrintToChatAll("{fullred}[SVH] {darkgray}Test Bot Disabled");
- }
- else
- {
- ServerCommand("mp_autoteambalance 0");
- ServerCommand("tf_bot_add 1 Pyro blue easy");
- ServerCommand("tf_bot_difficulty 0");
- ServerCommand("tf_bot_keep_class_after_death 1");
- ServerCommand("tf_bot_taunt_victim_chance 0");
- ServerCommand("tf_bot_join_after_player 0");
- Enabled = true;
- CPrintToChatAll("{fullred}[SVH] {darkgray}Test Bot Enabled");
- }
- return Plugin_Handled;
- }
- public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon)
- {
- if (!Enabled || !IsPlayerAlive(client) || !IsClientBot(client)) return Plugin_Continue;
- int rocket = INVALID_ENT_REFERENCE;
- float fClientEyePosition[3];
- GetClientEyePosition(client, fClientEyePosition);
- int iWeapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
- if (!IsValidEntity(iWeapon))return Plugin_Continue;
- while ((rocket = FindEntityByClassname(rocket, "tf_projectile_*")) != INVALID_ENT_REFERENCE)
- {
- float rocketLocation[3];
- GetEntPropVector(rocket, Prop_Data,"m_vecOrigin",rocketLocation);
- float pos[3];
- GetClientAbsOrigin(client, pos);
- float angle[3];
- angle[0] = 0.0 - RadToDeg(ArcTangent((rocketLocation[2] - fClientEyePosition[2]) / (FloatAbs(SquareRoot(Pow(fClientEyePosition[0] - rocketLocation[0], 2.0) + Pow(rocketLocation[1] - fClientEyePosition[1], 2.0))))));
- angle[1] = GetAngle(fClientEyePosition, rocketLocation);
- if (GetVectorDistance(pos, rocketLocation) < 250.0)
- {
- TeleportEntity(client, NULL_VECTOR, angle, NULL_VECTOR);
- ModRateOfFire(iWeapon);
- buttons |= IN_ATTACK2;
- }
- }
- for (new i = 1 ; i <= MaxClients ;i++)
- {
- if (IsClientInGame(i) && IsClientConnected(i) && !IsClientObserver(i) && GetClientTeam(i) != GetClientTeam(client) && IsPlayerAlive(i))
- {
- }
- }
- return Plugin_Continue;
- }
- stock bool IsClientBot(int client)
- {
- return client != 0 && IsClientInGame(client) && IsFakeClient(client) && !IsClientReplay(client) && !IsClientSourceTV(client);
- }
- stock void ModRateOfFire(int weapon)
- {
- float m_flNextPrimaryAttack = GetEntPropFloat(weapon, Prop_Send, "m_flNextPrimaryAttack");
- float m_flNextSecondaryAttack = GetEntPropFloat(weapon, Prop_Send, "m_flNextSecondaryAttack");
- SetEntPropFloat(weapon, Prop_Send, "m_flPlaybackRate", 10.0);
- float fGameTime = GetGameTime();
- float fPrimaryTime = ((m_flNextPrimaryAttack - fGameTime) - 0.99);
- float fSecondaryTime = ((m_flNextSecondaryAttack - fGameTime) - 0.99);
- SetEntPropFloat(weapon, Prop_Send, "m_flNextPrimaryAttack", fPrimaryTime + fGameTime);
- SetEntPropFloat(weapon, Prop_Send, "m_flNextSecondaryAttack", fSecondaryTime + fGameTime);
- }
- stock float GetAngle(const float coords1[3], const float coords2[3])
- {
- float angle = RadToDeg(ArcTangent((coords2[1] - coords1[1]) / (coords2[0] - coords1[0])));
- if (coords2[0] < coords1[0])
- {
- if (angle > 0.0) angle -= 180.0;
- else angle += 180.0;
- }
- return angle;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement