Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include sdktools
- #include sdkhooks
- #pragma semicolon 1
- #pragma newdecls required
- public void OnPluginStart()
- {
- HookEvent("jockey_ride", Event_JockeyRide, EventHookMode_Post);
- HookEvent("charger_carry_start", Event_CarrySstart, EventHookMode_Post);
- HookEvent("lunge_pounce", Event_LungePounce, EventHookMode_Post);
- }
- public Action Event_JockeyRide(Handle event, const char[] name, bool dontBroadcast)
- {
- int iJockey = GetClientOfUserId(GetEventInt(event, "userid"));
- int client = GetClientOfUserId(GetEventInt(event, "victim"));
- int iCurrentWeapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
- if(!IsTargetInSightRange(client, iJockey, 107.0, 107.0, true))
- {
- iDropWeapon(client, iCurrentWeapon);
- }
- }
- public Action Event_CarrySstart(Handle event, const char[] name, bool dontBroadcast)
- {
- int client = GetClientOfUserId(GetEventInt(event, "victim"));
- int iCurrentWeapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
- iDropWeapon(client, iCurrentWeapon);
- }
- public Action Event_LungePounce(Handle event, const char[] name, bool dontBroadcast)
- {
- int client = GetClientOfUserId(GetEventInt(event, "victim"));
- int iCurrentWeapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
- iDropWeapon(client, iCurrentWeapon);
- }
- void iDropWeapon(int client, int iWeapon)
- {
- if(IsValidEntity(iWeapon))
- {
- SDKCallWeaponDrop(client, iWeapon);
- }
- }
- stock void SDKCallWeaponDrop(int client, int weapon)
- {
- float vecAngles[3], vecVelocity[3];
- GetClientEyeAngles(client, vecAngles);
- GetAngleVectors(vecAngles, vecVelocity, NULL_VECTOR, NULL_VECTOR);
- vecVelocity[0] = vecAngles[0] * GetRandomInt(2, 4);
- vecVelocity[1] = vecAngles[1] * GetRandomInt(2, 4);
- vecVelocity[2] = vecAngles[2] * GetRandomInt(2, 4);
- SDKHooks_DropWeapon(client, weapon, NULL_VECTOR, NULL_VECTOR);
- TeleportEntity(weapon, NULL_VECTOR, NULL_VECTOR, vecVelocity);
- }
- stock bool IsTargetInSightRange(int client, int target, float angle = 90.0, float distance = 0.0, bool heightcheck = true, bool negativeangle = false)
- {
- if(angle > 360.0 || angle < 0.0)
- ThrowError("Angle Max : 360 & Min : 0. %d isn't proper angle.", angle);
- if(!IsClientInGame(client) && !IsPlayerAlive(client))
- ThrowError("Client is not Alive.");
- if(!IsClientInGame(target) && !IsPlayerAlive(target))
- ThrowError("Target is not Alive.");
- float clientpos[3], targetpos[3], anglevector[3], targetvector[3], resultangle, resultdistance;
- GetClientEyeAngles(client, anglevector);
- anglevector[0] = anglevector[2] = 0.0;
- GetAngleVectors(anglevector, anglevector, NULL_VECTOR, NULL_VECTOR);
- NormalizeVector(anglevector, anglevector);
- if(negativeangle)
- NegateVector(anglevector);
- GetClientAbsOrigin(client, clientpos);
- GetClientAbsOrigin(target, targetpos);
- if(heightcheck && distance > 0)
- resultdistance = GetVectorDistance(clientpos, targetpos);
- clientpos[2] = targetpos[2] = 0.0;
- MakeVectorFromPoints(clientpos, targetpos, targetvector);
- NormalizeVector(targetvector, targetvector);
- resultangle = RadToDeg(ArcCosine(GetVectorDotProduct(targetvector, anglevector)));
- if(resultangle <= angle/2)
- {
- if(distance > 0)
- {
- if(!heightcheck)
- resultdistance = GetVectorDistance(clientpos, targetpos);
- if(distance >= resultdistance)
- return true;
- else
- return false;
- }
- else
- return true;
- }
- else
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment