Optifaider Stealing code

Creato Il diff non scade mai
39 rimozioni
831 linee
20 aggiunte
813 linee
/* SM Jailbreak Thanos round
*
* Copyright (C) 2019 Francisco 'Franc1sco' García
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see http://www.gnu.org/licenses/.
*/

#include <sourcemod>
#include <sourcemod>
#include <sdktools>
#include <sdktools>
#include <sdkhooks>
#include <sdkhooks>
#include <cstrike>
#include <cstrike>
#include <warden>
#include <warden>
#include <myjbwarden>
#include <myjbwarden>
#include <myjailbreak>
#include <myjailbreak>
#include <myweapons>
#include <myweapons>
#include <smartjaildoors>
#include <smartjaildoors>


int usuarios;
int usuarios;


#define SOLID_NONE 0
#define SOLID_NONE 0
#define FSOLID_NOT_SOLID 0x0004
#define FSOLID_NOT_SOLID 0x0004


new Float:MinNadeHull[3] = {-2.5, -2.5, -2.5};
new Float:MinNadeHull[3] = {-2.5, -2.5, -2.5};
new Float:MaxNadeHull[3] = {2.5, 2.5, 2.5};
new Float:MaxNadeHull[3] = {2.5, 2.5, 2.5};
new Float:SpinVel[3] = {0.0, 0.0, 200.0};
new Float:SpinVel[3] = {0.0, 0.0, 200.0};
new Float:SmokeOrigin[3] = {-30.0,0.0,0.0};
new Float:SmokeOrigin[3] = {-30.0,0.0,0.0};
new Float:SmokeAngle[3] = {0.0,-180.0,0.0};
new Float:SmokeAngle[3] = {0.0,-180.0,0.0};


#define MINUTES 30
#define MINUTES 30


bool soccer;
bool soccer;




int g_iTime;
int g_iTime;


bool pending;
bool pending;




#define DATA "1.0"
#define DATA "1.0"


int thanos;
int thanos;


int NadeDamage = 1000;
int NadeDamage = 1000;
int NadeRadius = 350;
int NadeRadius = 350;
float NadeSpeed = 900.0;
float NadeSpeed = 900.0;


new g_iToolsVelocity;
new g_iToolsVelocity;


public Plugin myinfo =
public Plugin myinfo =
{
{
name = "SM Jailbreak Thanos round",
name = "SM Jailbreak Thanos round",
author = "Franc1sco franug",
author = "Optifiader",
description = "",
description = "",
version = DATA,
version = DATA,
url = "http://steamcommunity.com/id/franug"
url = ""
};
};


public OnPluginStart()
public OnPluginStart()
{
{
g_iToolsVelocity = FindSendPropInfo("CBasePlayer", "m_vecVelocity[0]");
g_iToolsVelocity = FindSendPropInfo("CBasePlayer", "m_vecVelocity[0]");
HookEvent("round_prestart", Event_RoundStart);
HookEvent("round_prestart", Event_RoundStart);
HookEvent("round_start", Event_RoundStartFix);
HookEvent("round_start", Event_RoundStartFix);
HookEvent("round_end", Event_End);
HookEvent("round_end", Event_End);
HookEvent("player_spawn", PlayerSpawn);
HookEvent("player_spawn", PlayerSpawn);
HookEvent("player_jump", Event_OnPlayerJump);
HookEvent("player_jump", Event_OnPlayerJump);
HookEvent("player_jump", Event_OnPlayerJumpPre, EventHookMode_Pre);
HookEvent("player_jump", Event_OnPlayerJumpPre, EventHookMode_Pre);
RegAdminCmd("sm_setthanos", Command_Set, ADMFLAG_ROOT);
RegAdminCmd("sm_setthanos", Command_Set, ADMFLAG_ROOT);
RegAdminCmd("sm_thanos", Command_Soccer, ADMFLAG_CUSTOM1);
RegAdminCmd("sm_thanos", Command_Soccer, ADMFLAG_CUSTOM1);
RegAdminCmd("sm_vengadores", Command_Soccer, ADMFLAG_CUSTOM1);
RegAdminCmd("sm_vengadores", Command_Soccer, ADMFLAG_CUSTOM1);
for (new i = 1; i <= MaxClients; i++)
for (new i = 1; i <= MaxClients; i++)
if (IsClientInGame(i))
if (IsClientInGame(i))
OnClientPutInServer(i);
OnClientPutInServer(i);
}
}


public Action:Command_Set(client, args)
public Action:Command_Set(client, args)
{
{
if(soccer)
if(soccer)
{
{
ReplyToCommand(client, "Thanos round in progress already.");
ReplyToCommand(client, "Thanos já em curso.");
return Plugin_Handled;
return Plugin_Handled;
}
}
if(args < 1) // Not enough parameters
if(args < 1) // Not enough parameters
{
{
ReplyToCommand(client, "[SM] use: smsetthanos <#userid|name>");
ReplyToCommand(client, "[SM] use: smsetthanos <#userid|name>");
return Plugin_Handled;
return Plugin_Handled;
}
}
decl String:arg[30];
decl String:arg[30];
GetCmdArg(1, arg, sizeof(arg));
GetCmdArg(1, arg, sizeof(arg));
new target;
new target;
if((target = FindTarget(client, arg, false, false)) == -1)
if((target = FindTarget(client, arg, false, false)) == -1)
{
{
ReplyToCommand(client, "No found");
ReplyToCommand(client, "Não encontrado");
thanos = 0;
thanos = 0;
return Plugin_Handled; // Target not found...
return Plugin_Handled; // Target not found...
}
}
ReplyToCommand(client, "%N will be the next Thanos", target);
ReplyToCommand(client, "%N será o próximo Thanos", target);
thanos = target;
thanos = target;
return Plugin_Handled;
return Plugin_Handled;
}
}


public OnMapStart()
public OnMapStart()
{
{
AddFileToDownloadsTable("models/player/custom_player/kaesar2018/thanos/thanos.dx90.vtx");
AddFileToDownloadsTable("models/player/custom_player/kaesar2018/thanos/thanos.dx90.vtx");
AddFileToDownloadsTable("models/player/custom_player/kaesar2018/thanos/thanos.mdl");
AddFileToDownloadsTable("models/player/custom_player/kaesar2018/thanos/thanos.mdl");
AddFileToDownloadsTable("models/player/custom_player/kaesar2018/thanos/thanos.phy");
AddFileToDownloadsTable("models/player/custom_player/kaesar2018/thanos/thanos.phy");
AddFileToDownloadsTable("models/player/custom_player/kaesar2018/thanos/thanos.vvd");
AddFileToDownloadsTable("models/player/custom_player/kaesar2018/thanos/thanos.vvd");


AddFileToDownloadsTable("materials/models/player/kaesar2018/thanos/t_m_lrg_jim_body_d.vmt");
AddFileToDownloadsTable("materials/models/player/kaesar2018/thanos/t_m_lrg_jim_body_d.vmt");
AddFileToDownloadsTable("materials/models/player/kaesar2018/thanos/t_m_lrg_jim_body_d.vtf");
AddFileToDownloadsTable("materials/models/player/kaesar2018/thanos/t_m_lrg_jim_body_d.vtf");
AddFileToDownloadsTable("materials/models/player/kaesar2018/thanos/t_m_lrg_jim_body_n.vtf");
AddFileToDownloadsTable("materials/models/player/kaesar2018/thanos/t_m_lrg_jim_body_n.vtf");
AddFileToDownloadsTable("materials/models/player/kaesar2018/thanos/t_m_lrg_jim_gauntlet_d.vmt");
AddFileToDownloadsTable("materials/models/player/kaesar2018/thanos/t_m_lrg_jim_gauntlet_d.vmt");
AddFileToDownloadsTable("materials/models/player/kaesar2018/thanos/t_m_lrg_jim_gauntlet_d.vtf");
AddFileToDownloadsTable("materials/models/player/kaesar2018/thanos/t_m_lrg_jim_gauntlet_d.vtf");
AddFileToDownloadsTable("materials/models/player/kaesar2018/thanos/t_m_lrg_jim_gauntlet_n.vtf");
AddFileToDownloadsTable("materials/models/player/kaesar2018/thanos/t_m_lrg_jim_gauntlet_n.vtf");
AddFileToDownloadsTable("materials/models/player/kaesar2018/thanos/t_m_lrg_jim_head_d.vmt");
AddFileToDownloadsTable("materials/models/player/kaesar2018/thanos/t_m_lrg_jim_head_d.vmt");
AddFileToDownloadsTable("materials/models/player/kaesar2018/thanos/t_m_lrg_jim_head_d.vtf");
AddFileToDownloadsTable("materials/models/player/kaesar2018/thanos/t_m_lrg_jim_head_d.vtf");
AddFileToDownloadsTable("materials/models/player/kaesar2018/thanos/t_m_lrg_jim_head_n.vtf");
AddFileToDownloadsTable("materials/models/player/kaesar2018/thanos/t_m_lrg_jim_head_n.vtf");
AddFileToDownloadsTable("materials/models/player/kaesar2018/thanos/t_m_lrg_jim_helmet_d.vmt");
AddFileToDownloadsTable("materials/models/player/kaesar2018/thanos/t_m_lrg_jim_helmet_d.vmt");
AddFileToDownloadsTable("materials/models/player/kaesar2018/thanos/t_m_lrg_jim_helmet_d.vtf");
AddFileToDownloadsTable("materials/models/player/kaesar2018/thanos/t_m_lrg_jim_helmet_d.vtf");
AddFileToDownloadsTable("materials/models/player/kaesar2018/thanos/t_m_lrg_jim_helmet_n.vtf");
AddFileToDownloadsTable("materials/models/player/kaesar2018/thanos/t_m_lrg_jim_helmet_n.vtf");


PrecacheModel("models/player/custom_player/kaesar2018/thanos/thanos.mdl");
PrecacheModel("models/player/custom_player/kaesar2018/thanos/thanos.mdl");
AddFileToDownloadsTable("sound/music/franug_rocket1.mp3");
AddFileToDownloadsTable("sound/music/franug_rocket1.mp3");
AddFileToDownloadsTable("materials/models/weapons/w_missile/missile side.vmt");
AddFileToDownloadsTable("materials/models/weapons/w_missile/missile side.vmt");
AddFileToDownloadsTable("models/weapons/W_missile_closed.dx80.vtx");
AddFileToDownloadsTable("models/weapons/W_missile_closed.dx80.vtx");
AddFileToDownloadsTable("models/weapons/W_missile_closed.dx90.vtx");
AddFileToDownloadsTable("models/weapons/W_missile_closed.dx90.vtx");
AddFileToDownloadsTable("models/weapons/W_missile_closed.mdl");
AddFileToDownloadsTable("models/weapons/W_missile_closed.mdl");
AddFileToDownloadsTable("models/weapons/W_missile_closed.phy");
AddFileToDownloadsTable("models/weapons/W_missile_closed.phy");
AddFileToDownloadsTable("models/weapons/W_missile_closed.sw.vtx");
AddFileToDownloadsTable("models/weapons/W_missile_closed.sw.vtx");
AddFileToDownloadsTable("models/weapons/W_missile_closed.vvd");
AddFileToDownloadsTable("models/weapons/W_missile_closed.vvd");
PrecacheModel("models/weapons/w_missile_closed.mdl");
PrecacheModel("models/weapons/w_missile_closed.mdl");
PrecacheSound("music/franug_rocket1.mp3");
PrecacheSound("music/franug_rocket1.mp3");
PrecacheSound("weapons/hegrenade/explode5.wav");
PrecacheSound("weapons/hegrenade/explode5.wav");
}
}


public OnPluginEnd()
public OnPluginEnd()
{
{
if (!soccer && !pending)return;
if (!soccer && !pending)return;
Terminar();
Terminar();
}
}


public Action Command_Soccer(int client, int args)
public Action Command_Soccer(int client, int args)
{
{
DoVoteMenu(client);
DoVoteMenu(client);
return Plugin_Handled;
return Plugin_Handled;
}
}


void DoVoteMenu(int client)
void DoVoteMenu(int client)
{
{
if (IsVoteInProgress())
if (IsVoteInProgress())
{
{
PrintToChat(client, " \x03Already a vote in progress, wait for the end.");
PrintToChat(client, " \x03Já uma votação em curso, aguarde o fim.");
return;
return;
}
}
if (MyJailbreak_IsEventDayPlanned())
if (MyJailbreak_IsEventDayPlanned())
{
{
PrintToChat(client, " \x03You cant use this if already a thanos day planned.");
PrintToChat(client, " \x03Não se pode usar isto se já estiver planeado um dia thanos.");
return;
return;
}
}
if (MyJailbreak_IsEventDayRunning())
if (MyJailbreak_IsEventDayRunning())
{
{
PrintToChat(client, " \x03You cant use this command when already a special day running.");
PrintToChat(client, " \x03Não se pode usar este comando quando já é um dia especial de corrida.");
return;
return;
}
}
if (!HasPermission(client, "z") && GetTime() < (g_iTime+(MINUTES*60)))
if (!HasPermission(client, "z") && GetTime() < (g_iTime+(MINUTES*60)))
{
{
PrintToChat(client, " \x03You cant use this, wait %i seconds more.", (g_iTime+(MINUTES*60)) - GetTime());
PrintToChat(client, " \x03Não pode usar isto, espere %i segundos mais.", (g_iTime+(MINUTES*60)) - GetTime());
return;
return;
}
}
g_iTime = GetTime();
g_iTime = GetTime();
Menu menu = new Menu(Handle_VoteMenu);
Menu menu = new Menu(Handle_VoteMenu);
menu.SetTitle("Start a Thanos day in the next round?");
menu.SetTitle("Start a Thanos day in the next round?");
menu.AddItem("yes", "Yes");
menu.AddItem("yes", "Yes");
menu.AddItem("no", "No");
menu.AddItem("no", "No");


menu.DisplayVoteToAll(20);
menu.DisplayVoteToAll(20);
}
}


public int Handle_VoteMenu(Menu menu, MenuAction action, int param1,int param2)
public int Handle_VoteMenu(Menu menu, MenuAction action, int param1,int param2)
{
{
if (action == MenuAction_End)
if (action == MenuAction_End)
{
{
/* This is called after VoteEnd */
/* This is called after VoteEnd */
delete menu;
delete menu;
} else if (action == MenuAction_VoteEnd) {
} else if (action == MenuAction_VoteEnd) {
/* 0=yes, 1=no */
/* 0=yes, 1=no */
if (param1 == 0)
if (param1 == 0)
{
{
pending = true;
pending = true;
ServerCommand("sm_ratio_enable 0");
ServerCommand("sm_ratio_enable 0");
ServerCommand("sm_ctbans_enable 0");
ServerCommand("sm_ctbans_enable 0");
MyJailbreak_SetEventDayName("Thanos");
MyJailbreak_SetEventDayName("Thanos");
MyJailbreak_SetEventDayPlanned(true);
MyJailbreak_SetEventDayPlanned(true);
PrintCenterTextAll("THANOS DAY START IN THE NEXT ROUND!");
PrintCenterTextAll("O DIA DE THANOS COMEÇA NA RONDA SEGUINTE!");
PrintToChatAll(" \x03THANOS DAY START IN THE NEXT ROUND!");
PrintToChatAll(" \x03O DIA DE THANOS COMEÇA NA RONDA SEGUINTE!");
}
}
else
else
{
{
PrintToChatAll(" \x03The thanos vote was negative.");
PrintToChatAll(" \x03O voto dos thanos foi negativo.");
}
}
}
}
}
}


public Action:PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
public Action:PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
{
if (!soccer)return;
if (!soccer)return;
int client = GetClientOfUserId(GetEventInt(event, "userid"));
int client = GetClientOfUserId(GetEventInt(event, "userid"));
CreateTimer(3.0, Timer_Thanos, GetClientUserId(client));
CreateTimer(3.0, Timer_Thanos, GetClientUserId(client));
}
}


public Action Timer_Thanos(Handle timer, int id)
public Action Timer_Thanos(Handle timer, int id)
{
{
int client = GetClientOfUserId(id);
int client = GetClientOfUserId(id);
if (!client || !IsClientInGame(client))return;
if (!client || !IsClientInGame(client))return;
if (thanos != client)
if (thanos != client)
{
{
if(GetClientTeam(client) == CS_TEAM_CT)
if(GetClientTeam(client) == CS_TEAM_CT)
{
{
ChangeClientTeam(client, CS_TEAM_T);
ChangeClientTeam(client, CS_TEAM_T);
CS_RespawnPlayer(client);
CS_RespawnPlayer(client);
}
}
return;
return;
}
}
SetEntityModel(thanos, "models/player/custom_player/kaesar2018/thanos/thanos.mdl");
SetEntityModel(thanos, "models/player/custom_player/kaesar2018/thanos/thanos.mdl");
SetEntityGravity(thanos, 0.3);
SetEntityGravity(thanos, 0.3);
SetEntProp(thanos, Prop_Data, "m_iHealth", usuarios * 1000);
SetEntProp(thanos, Prop_Data, "m_iHealth", usuarios * 1000);
GivePlayerItem(thanos, "weapon_hegrenade");
GivePlayerItem(thanos, "weapon_hegrenade");
SJD_OpenDoors();
SJD_OpenDoors();
PrintCenterTextAll("Thanos are there!");
PrintCenterTextAll("Thanos are there!");
}
}


Empezar()
Empezar()
{
{
if(thanos == 0 || !IsClientInGame(thanos) || GetClientTeam(thanos) < 2)
if(thanos == 0 || !IsClientInGame(thanos) || GetClientTeam(thanos) < 2)
thanos = GetRandomPlayer();
thanos = GetRandomPlayer();
if (!thanos)
if (!thanos)
{
{
Terminar();
Terminar();
return;
return;
}
}
usuarios = 0;
usuarios = 0;
for (int i = 1; i <= MaxClients; i++)
for (int i = 1; i <= MaxClients; i++)
{
{
if (!IsClientInGame(i) || GetClientTeam(i) < 2)
if (!IsClientInGame(i) || GetClientTeam(i) < 2)
continue;
continue;


usuarios++;
usuarios++;
if(i != thanos && GetClientTeam(i) == CS_TEAM_CT)
if(i != thanos && GetClientTeam(i) == CS_TEAM_CT)
{
{
CS_SwitchTeam(i, CS_TEAM_T);
CS_SwitchTeam(i, CS_TEAM_T);
//CS_RespawnPlayer(i);
//CS_RespawnPlayer(i);
}
}
else if(i == thanos && GetClientTeam(thanos) == CS_TEAM_T)
else if(i == thanos && GetClientTeam(thanos) == CS_TEAM_T)
{
{
CS_SwitchTeam(i, CS_TEAM_CT);
CS_SwitchTeam(i, CS_TEAM_CT);
}
}
}
}
soccer = true;
soccer = true;
if(warden_exist())
if(warden_exist())
{
{
warden_removed(warden_get());
warden_removed(warden_get());
}
}
SetCvar("sm_hosties_lr", 0);
SetCvar("sm_hosties_lr", 0);
SetCvar("sm_menu_enable", 0);
SetCvar("sm_menu_enable", 0);
SetCvar("mp_friendlyfire", 0);
SetCvar("mp_friendlyfire", 0);
MyWeapons_AllowTeam(CS_TEAM_T, true);
MyWeapons_AllowTeam(CS_TEAM_T, true);
MyWeapons_AllowTeam(CS_TEAM_CT, false);
MyWeapons_AllowTeam(CS_TEAM_CT, false);
warden_enable(false);
warden_enable(false);
}
}


Terminar()
Terminar()
{
{
thanos = 0;
thanos = 0;
soccer = false;
soccer = false;
MyJailbreak_SetEventDayRunning(false, 0);
MyJailbreak_SetEventDayRunning(false, 0);
MyJailbreak_SetEventDayName("none");
MyJailbreak_SetEventDayName("none");
SetCvar("sm_hosties_lr", 1);
SetCvar("sm_hosties_lr", 1);
SetCvar("sm_menu_enable", 1);
SetCvar("sm_menu_enable", 1);
ServerCommand("sm_ratio_enable 1");
ServerCommand("sm_ratio_enable 1");
ServerCommand("sm_ctbans_enable 1");
ServerCommand("sm_ctbans_enable 1");
MyWeapons_AllowTeam(CS_TEAM_T, false);
MyWeapons_AllowTeam(CS_TEAM_T, false);
MyWeapons_AllowTeam(CS_TEAM_CT, true);
MyWeapons_AllowTeam(CS_TEAM_CT, true);
warden_enable(true);
warden_enable(true);
}
}


public Action Event_RoundStart(Event event, const char[] szName, bool bDontBroadcast)
public Action Event_RoundStart(Event event, const char[] szName, bool bDontBroadcast)
{
{
if (!pending && !soccer)return;
if (!pending && !soccer)return;
Empezar();
Empezar();
MyJailbreak_SetEventDayPlanned(false);
MyJailbreak_SetEventDayPlanned(false);
MyJailbreak_SetEventDayRunning(true, 0);
MyJailbreak_SetEventDayRunning(true, 0);
pending = false;
pending = false;
ServerCommand("sm_ratio_enable 1");
ServerCommand("sm_ratio_enable 1");
}
}


public Action Event_RoundStartFix(Event event, const char[] szName, bool bDontBroadcast)
public Action Event_RoundStartFix(Event event, const char[] szName, bool bDontBroadcast)
{
{
if (!soccer)return;
if (!soccer)return;
SetCvar("mp_friendlyfire", 0);
SetCvar("mp_friendlyfire", 0);
}
}


public Action Event_End(Event event, const char[] szName, bool bDontBroadcast)
public Action Event_End(Event event, const char[] szName, bool bDontBroadcast)
{
{
if (!pending && soccer)
if (!pending && soccer)
{
{
Terminar();
Terminar();
}
}
}
}


public IsValidClient( client )
public IsValidClient( client )
{
{
if ( !( 1 <= client <= MaxClients ) || !IsClientInGame(client) )
if ( !( 1 <= client <= MaxClients ) || !IsClientInGame(client) )
return false;
return false;
return true;
return true;
}
}


stock void SetCvar(char cvarName[64], int value)
stock void SetCvar(char cvarName[64], int value)
{
{
Handle IntCvar = FindConVar(cvarName);
Handle IntCvar = FindConVar(cvarName);
if (IntCvar == null) return;
if (IntCvar == null) return;


int flags = GetConVarFlags(IntCvar);
int flags = GetConVarFlags(IntCvar);
flags &= ~FCVAR_NOTIFY;
flags &= ~FCVAR_NOTIFY;
SetConVarFlags(IntCvar, flags);
SetConVarFlags(IntCvar, flags);


SetConVarInt(IntCvar, value);
SetConVarInt(IntCvar, value);


flags |= FCVAR_NOTIFY;
flags |= FCVAR_NOTIFY;
SetConVarFlags(IntCvar, flags);
SetConVarFlags(IntCvar, flags);
}
}


stock void SetCvarString(char cvarName[64], char[] value)
stock void SetCvarString(char cvarName[64], char[] value)
{
{
Handle cvar = FindConVar(cvarName);
Handle cvar = FindConVar(cvarName);
SetConVarString(cvar, value, true);
SetConVarString(cvar, value, true);
}
}


public Action:OnWeaponCanUse(client, weapon)
public Action:OnWeaponCanUse(client, weapon)
{
{
if (soccer && client == thanos)
if (soccer && client == thanos)
{
{
// block switching to weapon other than knife
// block switching to weapon other than knife
decl String:sClassname[32];
decl String:sClassname[32];
GetEdictClassname(weapon, sClassname, sizeof(sClassname));
GetEdictClassname(weapon, sClassname, sizeof(sClassname));
if (StrContains(sClassname, "knife") == -1 && StrContains(sClassname, "bayonet") == -1 && StrContains(sClassname, "hegrenade") == -1)
if (StrContains(sClassname, "knife") == -1 && StrContains(sClassname, "bayonet") == -1 && StrContains(sClassname, "hegrenade") == -1)
return Plugin_Handled;
return Plugin_Handled;
}
}
return Plugin_Continue;
return Plugin_Continue;
}
}


public OnClientPutInServer(client)
public OnClientPutInServer(client)
{
{
SDKHook(client, SDKHook_WeaponCanUse, OnWeaponCanUse);
SDKHook(client, SDKHook_WeaponCanUse, OnWeaponCanUse);
SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
}
}


public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype, &weapon, Float:damageForce[3], Float:damagePosition[3]){
public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype, &weapon, Float:damageForce[3], Float:damagePosition[3]){
if(!soccer)return Plugin_Continue;
if(!soccer)return Plugin_Continue;
if(attacker == thanos && victim != thanos){
if(attacker == thanos && victim != thanos){
if (!IsValidEntity(weapon)) return Plugin_Continue;
if (!IsValidEntity(weapon)) return Plugin_Continue;
new String:weaponclassname[20];
new String:weaponclassname[20];
GetEntityClassname(weapon, weaponclassname, sizeof(weaponclassname));
GetEntityClassname(weapon, weaponclassname, sizeof(weaponclassname));
if (StrContains(weaponclassname, "knife") > -1 || StrContains(weaponclassname, "bayonet") > -1)
if (StrContains(weaponclassname, "knife") > -1 || StrContains(weaponclassname, "bayonet") > -1)
{
{
damage *= 60.0;
damage *= 60.0;
return Plugin_Changed;
return Plugin_Changed;
}
}
return Plugin_Continue;
return Plugin_Continue;
}
}
else{
else{
return Plugin_Continue;
return Plugin_Continue;
}
}
}
}


stock GetRandomPlayer() {
stock GetRandomPlayer() {


new clients[MaxClients+1], clientCount;
new clients[MaxClients+1], clientCount;
for (new i = 1; i <= MaxClients; i++)
for (new i = 1; i <= MaxClients; i++)
if (IsClientInGame(i) && GetClientTeam(i) > 1)
if (IsClientInGame(i) && GetClientTeam(i) > 1)
clients[clientCount++] = i;
clients[clientCount++] = i;
return (clientCount == 0) ? -1 : clients[GetRandomInt(0, clientCount-1)];
return (clientCount == 0) ? -1 : clients[GetRandomInt(0, clientCount-1)];
}
}




public OnEntityCreated(iEntity, const String:classname[])
public OnEntityCreated(iEntity, const String:classname[])
{
{
if (!soccer)return;
if (!soccer)return;
if (StrEqual(classname, "hegrenade_projectile", false))
if (StrEqual(classname, "hegrenade_projectile", false))
{
{
HookSingleEntityOutput(iEntity, "OnUser2", InitMissile, true);
HookSingleEntityOutput(iEntity, "OnUser2", InitMissile, true);
new String:OutputString[50] = "OnUser1 !self:FireUser2::0.0:1";
new String:OutputString[50] = "OnUser1 !self:FireUser2::0.0:1";
SetVariantString(OutputString);
SetVariantString(OutputString);
AcceptEntityInput(iEntity, "AddOutput");
AcceptEntityInput(iEntity, "AddOutput");
AcceptEntityInput(iEntity, "FireUser1");
AcceptEntityInput(iEntity, "FireUser1");
}
}
}
}


public Action Timer_ThanosGranada(Handle timer)
public Action Timer_ThanosGranada(Handle timer)
{
{
if (!thanos || !IsClientInGame(thanos))return;
if (!thanos || !IsClientInGame(thanos))return;
GivePlayerItem(thanos, "weapon_hegrenade");
GivePlayerItem(thanos, "weapon_hegrenade");
}
}


public InitMissile(const String:output[], caller, activator, Float:delay)
public InitMissile(const String:output[], caller, activator, Float:delay)
{
{
new NadeOwner = GetEntPropEnt(caller, Prop_Send, "m_hThrower");
new NadeOwner = GetEntPropEnt(caller, Prop_Send, "m_hThrower");
// assume other plugins don't set this on any projectiles they create, this avoids conflicts.
// assume other plugins don't set this on any projectiles they create, this avoids conflicts.
if (NadeOwner == -1 || thanos != NadeOwner)
if (NadeOwner == -1 || thanos != NadeOwner)
{
{
return;
return;
}
}
//ignore the projectile if this team can't use missiles.
//ignore the projectile if this team can't use missiles.
//new NadeTeam = GetEntProp(caller, Prop_Send, "m_iTeamNum");
//new NadeTeam = GetEntProp(caller, Prop_Send, "m_iTeamNum");
// stop the projectile thinking so it doesn't detonate.
// stop the projectile thinking so it doesn't detonate.
SetEntProp(caller, Prop_Data, "m_nNextThinkTick", -1);
SetEntProp(caller, Prop_Data, "m_nNextThinkTick", -1);
SetEntityMoveType(caller, MOVETYPE_FLY);
SetEntityMoveType(caller, MOVETYPE_FLY);
SetEntityModel(caller, "models/weapons/w_missile_closed.mdl");
SetEntityModel(caller, "models/weapons/w_missile_closed.mdl");
// make it spin correctly.
// make it spin correctly.
SetEntPropVector(caller, Prop_Data, "m_vecAngVelocity", SpinVel);
SetEntPropVector(caller, Prop_Data, "m_vecAngVelocity", SpinVel);
// stop it bouncing when it hits something
// stop it bouncing when it hits something
SetEntPropFloat(caller, Prop_Send, "m_flElasticity", 0.0);
SetEntPropFloat(caller, Prop_Send, "m_flElasticity", 0.0);
SetEntPropVector(caller, Prop_Send, "m_vecMins", MinNadeHull);
SetEntPropVector(caller, Prop_Send, "m_vecMins", MinNadeHull);
SetEntPropVector(caller, Prop_Send, "m_vecMaxs", MaxNadeHull);
SetEntPropVector(caller, Prop_Send, "m_vecMaxs", MaxNadeHull);
new SmokeIndex = CreateEntityByName("env_rockettrail");
new SmokeIndex = CreateEntityByName("env_rockettrail");
if (SmokeIndex != -1)
if (SmokeIndex != -1)
{
{
SetEntPropFloat(SmokeIndex, Prop_Send, "m_Opacity", 0.5);
SetEntPropFloat(SmokeIndex, Prop_Send, "m_Opacity", 0.5);
SetEntPropFloat(SmokeIndex, Prop_Send, "m_SpawnRate", 100.0);
SetEntPropFloat(SmokeIndex, Prop_Send, "m_SpawnRate", 100.0);
SetEntPropFloat(SmokeIndex, Prop_Send, "m_ParticleLifetime", 0.5);
SetEntPropFloat(SmokeIndex, Prop_Send, "m_ParticleLifetime", 0.5);
SetEntPropFloat(SmokeIndex, Prop_Send, "m_StartSize", 5.0);
SetEntPropFloat(SmokeIndex, Prop_Send, "m_StartSize", 5.0);
SetEntPropFloat(SmokeIndex, Prop_Send, "m_EndSize", 30.0);
SetEntPropFloat(SmokeIndex, Prop_Send, "m_EndSize", 30.0);
SetEntPropFloat(SmokeIndex, Prop_Send, "m_SpawnRadius", 0.0);
SetEntPropFloat(SmokeIndex, Prop_Send, "m_SpawnRadius", 0.0);
SetEntPropFloat(SmokeIndex, Prop_Send, "m_MinSpeed", 0.0);
SetEntPropFloat(SmokeIndex, Prop_Send, "m_MinSpeed", 0.0);
SetEntPropFloat(SmokeIndex, Prop_Send, "m_MaxSpeed", 10.0);
SetEntPropFloat(SmokeIndex, Prop_Send, "m_MaxSpeed", 10.0);
SetEntPropFloat(SmokeIndex, Prop_Send, "m_flFlareScale", 1.0);
SetEntPropFloat(SmokeIndex, Prop_Send, "m_flFlareScale", 1.0);
DispatchSpawn(SmokeIndex);
DispatchSpawn(SmokeIndex);
ActivateEntity(SmokeIndex);
ActivateEntity(SmokeIndex);
new String:NadeName[20];
new String:NadeName[20];
Format(NadeName, sizeof(NadeName), "Nade_%i", caller);
Format(NadeName, sizeof(NadeName), "Nade_%i", caller);
DispatchKeyValue(caller, "targetname", NadeName);
DispatchKeyValue(caller, "targetname", NadeName);
SetVariantString(NadeName);
SetVariantString(NadeName);
AcceptEntityInput(SmokeIndex, "SetParent");
AcceptEntityInput(SmokeIndex, "SetParent");
TeleportEntity(SmokeIndex, SmokeOrigin, SmokeAngle, NULL_VECTOR);
TeleportEntity(SmokeIndex, SmokeOrigin, SmokeAngle, NULL_VECTOR);
}
}
// make the missile go towards the coordinates the player is looking at.
// make the missile go towards the coordinates the player is looking at.
new Float:NadePos[3];
new Float:NadePos[3];
GetEntPropVector(caller, Prop_Send, "m_vecOrigin", NadePos);
GetEntPropVector(caller, Prop_Send, "m_vecOrigin", NadePos);
new Float:OwnerAng[3];
new Float:OwnerAng[3];
GetClientEyeAngles(NadeOwner, OwnerAng);
GetClientEyeAngles(NadeOwner, OwnerAng);
new Float:OwnerPos[3];
new Float:OwnerPos[3];
GetClientEyePosition(NadeOwner, OwnerPos);
GetClientEyePosition(NadeOwner, OwnerPos);
TR_TraceRayFilter(OwnerPos, OwnerAng, MASK_SOLID, RayType_Infinite, DontHitOwnerOrNade, caller);
TR_TraceRayFilter(OwnerPos, OwnerAng, MASK_SOLID, RayType_Infinite, DontHitOwnerOrNade, caller);
new Float:InitialPos[3];
new Float:InitialPos[3];
TR_GetEndPosition(InitialPos);
TR_GetEndPosition(InitialPos);
new Float:InitialVec[3];
new Float:InitialVec[3];
MakeVectorFromPoints(NadePos, InitialPos, InitialVec);
MakeVectorFromPoints(NadePos, InitialPos, InitialVec);
NormalizeVector(InitialVec, InitialVec);
NormalizeVector(InitialVec, InitialVec);
ScaleVector(InitialVec, NadeSpeed);
ScaleVector(InitialVec, NadeSpeed);
new Float:InitialAng[3];
new Float:InitialAng[3];
GetVectorAngles(InitialVec, InitialAng);
GetVectorAngles(InitialVec, InitialAng);
TeleportEntity(caller, NULL_VECTOR, InitialAng, InitialVec);
TeleportEntity(caller, NULL_VECTOR, InitialAng, InitialVec);
EmitSoundToAll("music/franug_rocket1.mp3", caller, 1, 90);
EmitSoundToAll("music/franug_rocket1.mp3", caller, 1, 90);
HookSingleEntityOutput(caller, "OnUser2", MissileThink);
HookSingleEntityOutput(caller, "OnUser2", MissileThink);
new String:OutputString[50] = "OnUser1 !self:FireUser2::0.1:-1";
new String:OutputString[50] = "OnUser1 !self:FireUser2::0.1:-1";
SetVariantString(OutputString);
SetVariantString(OutputString);
AcceptEntityInput(caller, "AddOutput");
AcceptEntityInput(caller, "AddOutput");
AcceptEntityInput(caller, "FireUser1");
AcceptEntityInput(caller, "FireUser1");
SDKHook(caller, SDKHook_StartTouchPost, OnStartTouchPost);
SDKHook(caller, SDKHook_StartTouchPost, OnStartTouchPost);
CreateTimer(3.0, Timer_ThanosGranada);
CreateTimer(3.0, Timer_ThanosGranada);


}
}


public MissileThink(const String:output[], caller, activator, Float:delay)
public MissileThink(const String:output[], caller, activator, Float:delay)
{
{
// detonate any missiles that stopped for any reason but didn't detonate.
// detonate any missiles that stopped for any reason but didn't detonate.
decl Float:CheckVec[3];
decl Float:CheckVec[3];
GetEntPropVector(caller, Prop_Send, "m_vecVelocity", CheckVec);
GetEntPropVector(caller, Prop_Send, "m_vecVelocity", CheckVec);
if (((CheckVec[0] == 0.0) && (CheckVec[1] == 0.0) && (CheckVec[2] == 0.0)))
if (((CheckVec[0] == 0.0) && (CheckVec[1] == 0.0) && (CheckVec[2] == 0.0)))
{
{
StopSound(caller, 1, "music/franug_rocket1.mp3");
StopSound(caller, 1, "music/franug_rocket1.mp3");
CreateExplosion(caller);
CreateExplosion(caller);
return;
return;
}
}
//decl Float:NadePos[3];
//decl Float:NadePos[3];
//GetEntPropVector(caller, Prop_Send, "m_vecOrigin", NadePos);
//GetEntPropVector(caller, Prop_Send, "m_vecOrigin", NadePos);
//new client = GetEntPropEnt(data, Prop_Send, "m_hThrower");
//new client = GetEntPropEnt(data, Prop_Send, "m_hThrower");
/* new dado = GetTraceHullEntityIndex(NadePos, caller);
/* new dado = GetTraceHullEntityIndex(NadePos, caller);
if(IsClientIndex(dado) && ZR_IsClientZombie(dado))
if(IsClientIndex(dado) && ZR_IsClientZombie(dado))
{
{
StopSound(caller, 1, "music/franug_rocket1.mp3");
StopSound(caller, 1, "music/franug_rocket1.mp3");
CreateExplosion(caller);
CreateExplosion(caller);
return;
return;
} */
} */
AcceptEntityInput(caller, "FireUser1");
AcceptEntityInput(caller, "FireUser1");
}
}


/* GetTraceHullEntityIndex(Float:pos[3], xindex) {
/* GetTraceHullEntityIndex(Float:pos[3], xindex) {


TR_TraceHullFilter(pos, pos, g_fMinS, g_fMaxS, MASK_SHOT, THFilter, xindex);
TR_TraceHullFilter(pos, pos, g_fMinS, g_fMaxS, MASK_SHOT, THFilter, xindex);
return TR_GetEntityIndex();
return TR_GetEntityIndex();
}
}


public bool:THFilter(entity, contentsMask, any:data) {
public bool:THFilter(entity, contentsMask, any:data) {


return IsClientIndex(entity) && (entity != data);
return IsClientIndex(entity) && (entity != data);
}
}


bool:IsClientIndex(index) {
bool:IsClientIndex(index) {


return (index > 0) && (index <= MaxClients);
return (index > 0) && (index <= MaxClients);
}*/
}*/


public bool:DontHitOwnerOrNade(entity, contentsMask, any:data)
public bool:DontHitOwnerOrNade(entity, contentsMask, any:data)
{
{
new NadeOwner = GetEntPropEnt(data, Prop_Send, "m_hThrower");
new NadeOwner = GetEntPropEnt(data, Prop_Send, "m_hThrower");
return ((entity != data) && (entity != NadeOwner));
return ((entity != data) && (entity != NadeOwner));
}
}


public OnStartTouchPost(entity, other)
public OnStartTouchPost(entity, other)
{
{
// detonate if the missile hits something solid.
// detonate if the missile hits something solid.
if ((GetEntProp(other, Prop_Data, "m_nSolidType") != SOLID_NONE) && (!(GetEntProp(other, Prop_Data, "m_usSolidFlags") & FSOLID_NOT_SOLID)))
if ((GetEntProp(other, Prop_Data, "m_nSolidType") != SOLID_NONE) && (!(GetEntProp(other, Prop_Data, "m_usSolidFlags") & FSOLID_NOT_SOLID)))
{
{
StopSound(entity, 1, "music/franug_rocket1.mp3");
StopSound(entity, 1, "music/franug_rocket1.mp3");
CreateExplosion(entity);
CreateExplosion(entity);
}
}
}
}


CreateExplosion(entity)
CreateExplosion(entity)
{
{
UnhookSingleEntityOutput(entity, "OnUser2", MissileThink);
UnhookSingleEntityOutput(entity, "OnUser2", MissileThink);
new Float:MissilePos[3];
new Float:MissilePos[3];
GetEntPropVector(entity, Prop_Send, "m_vecOrigin", MissilePos);
GetEntPropVector(entity, Prop_Send, "m_vecOrigin", MissilePos);
new MissileOwner = GetEntPropEnt(entity, Prop_Send, "m_hThrower");
new MissileOwner = GetEntPropEnt(entity, Prop_Send, "m_hThrower");
new MissileOwnerTeam = GetEntProp(entity, Prop_Send, "m_iTeamNum");
new MissileOwnerTeam = GetEntProp(entity, Prop_Send, "m_iTeamNum");
AcceptEntityInput(entity, "Kill");
AcceptEntityInput(entity, "Kill");
new ExplosionIndex = CreateEntityByName("env_explosion");
new ExplosionIndex = CreateEntityByName("env_explosion");
if (ExplosionIndex != -1)
if (ExplosionIndex != -1)
{
{
DispatchKeyValue(ExplosionIndex,"classname","hegrenade_projectile");
DispatchKeyValue(ExplosionIndex,"classname","hegrenade_projectile");
SetEntProp(ExplosionIndex, Prop_Data, "m_spawnflags", 6146);
SetEntProp(ExplosionIndex, Prop_Data, "m_spawnflags", 6146);
SetEntProp(ExplosionIndex, Prop_Data, "m_iMagnitude", NadeDamage);
SetEntProp(ExplosionIndex, Prop_Data, "m_iMagnitude", NadeDamage);
SetEntProp(ExplosionIndex, Prop_Data, "m_iRadiusOverride", NadeRadius);
SetEntProp(ExplosionIndex, Prop_Data, "m_iRadiusOverride", NadeRadius);
DispatchSpawn(ExplosionIndex);
DispatchSpawn(ExplosionIndex);
ActivateEntity(ExplosionIndex);
ActivateEntity(ExplosionIndex);
TeleportEntity(ExplosionIndex, MissilePos, NULL_VECTOR, NULL_VECTOR);
TeleportEntity(ExplosionIndex, MissilePos, NULL_VECTOR, NULL_VECTOR);
SetEntPropEnt(ExplosionIndex, Prop_Send, "m_hOwnerEntity", MissileOwner);
SetEntPropEnt(ExplosionIndex, Prop_Send, "m_hOwnerEntity", MissileOwner);
SetEntProp(ExplosionIndex, Prop_Send, "m_iTeamNum", MissileOwnerTeam);
SetEntProp(ExplosionIndex, Prop_Send, "m_iTeamNum", MissileOwnerTeam);
EmitSoundToAll("weapons/hegrenade/explode5.wav", ExplosionIndex, 1, 90);
EmitSoundToAll("weapons/hegrenade/explode5.wav", ExplosionIndex, 1, 90);
AcceptEntityInput(ExplosionIndex, "Explode");
AcceptEntityInput(ExplosionIndex, "Explode");
DispatchKeyValue(ExplosionIndex,"classname","env_explosion");
DispatchKeyValue(ExplosionIndex,"classname","env_explosion");
AcceptEntityInput(ExplosionIndex, "Kill");
AcceptEntityInput(ExplosionIndex, "Kill");
}
}
/* new Float:SmokeOrigin2[3];
/* new Float:SmokeOrigin2[3];
GetEntPropVector(entity, Prop_Send, "m_vecOrigin", SmokeOrigin2);
GetEntPropVector(entity, Prop_Send, "m_vecOrigin", SmokeOrigin2);
new client = GetEntPropEnt(entity, Prop_Send, "m_hThrower");
new client = GetEntPropEnt(entity, Prop_Send, "m_hThrower");
new userid = GetClientUserId(client);
new userid = GetClientUserId(client);
new Handle:event = CreateEvent("hegrenade_detonate");
new Handle:event = CreateEvent("hegrenade_detonate");
SetEventInt(event, "userid", userid);
SetEventInt(event, "userid", userid);
SetEventFloat(event, "x", SmokeOrigin2[0]);
SetEventFloat(event, "x", SmokeOrigin2[0]);
SetEventFloat(event, "y", SmokeOrigin2[1]);
SetEventFloat(event, "y", SmokeOrigin2[1]);
SetEventFloat(event, "z", SmokeOrigin2[2]);
SetEventFloat(event, "z", SmokeOrigin2[2]);
FireEvent(event); */
FireEvent(event); */
}
}


#define HEIGHT 2.0
#define HEIGHT 2.0
#define LENGTH 1.0
#define LENGTH 1.0


public Action:Event_OnPlayerJumpPre(Handle:event, const String:name[], bool:dontBroadcast)
public Action:Event_OnPlayerJumpPre(Handle:event, const String:name[], bool:dontBroadcast)
{
{
if (!soccer)return;
if (!soccer)return;
new client = GetClientOfUserId(GetEventInt(event, "userid"));
new client = GetClientOfUserId(GetEventInt(event, "userid"));
if (client != thanos)return;
if (client != thanos)return;
SetEntityGravity(thanos, 0.3);
SetEntityGravity(thanos, 0.3);
}
}


public Action:Event_OnPlayerJump(Handle:event, const String:name[], bool:dontBroadcast)
public Action:Event_OnPlayerJump(Handle:event, const String:name[], bool:dontBroadcast)
{
{
if (!soccer)return;
if (!soccer)return;
new client = GetClientOfUserId(GetEventInt(event, "userid"));
new client = GetClientOfUserId(GetEventInt(event, "userid"));
if (client != thanos)return;
if (client != thanos)return;
CreateTimer(0.0, EventPlayerJumpPost, client);
CreateTimer(0.0, EventPlayerJumpPost, client);
}
}


public Action:EventPlayerJumpPost(Handle:timer, any:client)
public Action:EventPlayerJumpPost(Handle:timer, any:client)
{
{
// If client isn't in-game, then stop.
// If client isn't in-game, then stop.
if (!IsClientInGame(client))
if (!IsClientInGame(client))
{
{
return;
return;
}
}
// Forward event to modules.
// Forward event to modules.
JumpBoostOnClientJumpPost(client);
JumpBoostOnClientJumpPost(client);
}
}


/**
/**
* Client is jumping.
* Client is jumping.
*
*
* @param client The client index.
* @param client The client index.
*/
*/
JumpBoostOnClientJumpPost(client)
JumpBoostOnClientJumpPost(client)
{
{
// Get class jump multipliers.
// Get class jump multipliers.
new Float:distancemultiplier = LENGTH;
new Float:distancemultiplier = LENGTH;
new Float:heightmultiplier = HEIGHT;
new Float:heightmultiplier = HEIGHT;
// If both are set to 1.0, then stop here to save some work.
// If both are set to 1.0, then stop here to save some work.
if (distancemultiplier == 1.0 && heightmultiplier == 1.0)
if (distancemultiplier == 1.0 && heightmultiplier == 1.0)
{
{
return;
return;
}
}
new Float:vecVelocity[3];
new Float:vecVelocity[3];
// Get client's current velocity.
// Get client's current velocity.
ToolsClientVelocity(client, vecVelocity, false);
ToolsClientVelocity(client, vecVelocity, false);
// Only apply horizontal multiplier if it's not a bhop.
// Only apply horizontal multiplier if it's not a bhop.
if (!JumpBoostIsBHop(vecVelocity))
if (!JumpBoostIsBHop(vecVelocity))
{
{
// Apply horizontal multipliers to jump vector.
// Apply horizontal multipliers to jump vector.
vecVelocity[0] *= distancemultiplier;
vecVelocity[0] *= distancemultiplier;
vecVelocity[1] *= distancemultiplier;
vecVelocity[1] *= distancemultiplier;
}
}
// Apply height multiplier to jump vector.
// Apply height multiplier to jump vector.
vecVelocity[2] *= heightmultiplier;
vecVelocity[2] *= heightmultiplier;
// Set new velocity.
// Set new velocity.
ToolsClientVelocity(client, vecVelocity, true, false);
ToolsClientVelocity(client, vecVelocity, true, false);
}
}


/**
/**
* This function detects excessive bunnyhopping.
* This function detects excessive bunnyhopping.
* Note: This ONLY catches bunnyhopping that is worse than CS:S already allows.
* Note: This ONLY catches bunnyhopping that is worse than CS:S already allows.
*
*
* @param vecVelocity The velocity of the client jumping.
* @param vecVelocity The velocity of the client jumping.
* @return True if the client is bunnyhopping, false if not.
* @return True if the client is bunnyhopping, false if not.
*/
*/
stock bool:JumpBoostIsBHop(const Float:vecVelocity[])
stock bool:JumpBoostIsBHop(const Float:vecVelocity[])
{
{
// Calculate the magnitude of jump on the xy plane.
// Calculate the magnitude of jump on the xy plane.
new Float:magnitude = SquareRoot(Pow(vecVelocity[0], 2.0) + Pow(vecVelocity[1], 2.0));
new Float:magnitude = SquareRoot(Pow(vecVelocity[0], 2.0) + Pow(vecVelocity[1], 2.0));
// Return true if the magnitude exceeds the max.
// Return true if the magnitude exceeds the max.
new Float:bunnyhopmax = 300.0;
new Float:bunnyhopmax = 300.0;
return (magnitude > bunnyhopmax);
return (magnitude > bunnyhopmax);
}
}


stock ToolsClientVelocity(client, Float:vecVelocity[3], bool:apply = true, bool:stack = true)
stock ToolsClientVelocity(client, Float:vecVelocity[3], bool:apply = true, bool:stack = true)
{
{
// If retrieve if true, then get client's velocity.
// If retrieve if true, then get client's velocity.
if (!apply)
if (!apply)
{
{
// x = vector component.
// x = vector component.
for (new x = 0; x < 3; x++)
for (new x = 0; x < 3; x++)
{
{
vecVelocity[x] = GetEntDataFloat(client, g_iToolsVelocity + (x*4));
vecVelocity[x] = GetEntDataFloat(client, g_iToolsVelocity + (x*4));
}
}
// Stop here.
// Stop here.
return;
return;
}
}
// If stack is true, then add client's velocity.
// If stack is true, then add client's velocity.
if (stack)
if (stack)
{
{
// Get client's velocity.
// Get client's velocity.
new Float:vecClientVelocity[3];
new Float:vecClientVelocity[3];
// x = vector component.
// x = vector component.
for (new x = 0; x < 3; x++)
for (new x = 0; x < 3; x++)
{
{
vecClientVelocity[x] = GetEntDataFloat(client, g_iToolsVelocity + (x*4));
vecClientVelocity[x] = GetEntDataFloat(client, g_iToolsVelocity + (x*4));
}
}
AddVectors(vecClientVelocity, vecVelocity, vecVelocity);
AddVectors(vecClientVelocity, vecVelocity, vecVelocity);
}
}
// Apply velocity on client.
// Apply velocity on client.
TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, vecVelocity);
TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, vecVelocity);
}
}


stock bool HasPermission(int iClient, char[] flagString)
stock bool HasPermission(int iClient, char[] flagString)
{
{
if (StrEqual(flagString, ""))
if (StrEqual(flagString, ""))
{
{
return true;
return true;
}
}
AdminId admin = GetUserAdmin(iClient);
AdminId admin = GetUserAdmin(iClient);
if (admin != INVALID_ADMIN_ID)
if (admin != INVALID_ADMIN_ID)
{
{
int count, found, flags = ReadFlagString(flagString);
int count, found, flags = ReadFlagString(flagString);
for (int i = 0; i <= 20; i++)
for (int i = 0; i <= 20; i++)
{
{
if (flags & (1<<i))
if (flags & (1<<i))
{
{
count++;
count++;
if (GetAdminFlag(admin, view_as<AdminFlag>(i)))
if (GetAdminFlag(admin, view_as<AdminFlag>(i)))
{
{
found++;
found++;
}
}
}
}
}
}


if (count == found) {
if (count == found) {
return true;
return true;
}
}
}
}


return false;
return false;
}
}