Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Action:OnPlayerRunCmd(Client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon)
- {
- if(IsClientInGame(Client) && IsPlayerAlive(Client))
- {
- if(g_bKnockBack[Client])
- {
- if(!(GetEntityFlags(Client) & FL_ONGROUND))
- {
- vel[0] = 0.0;
- vel[1] = 0.0;
- vel[2] = 0.0;
- }
- else
- {
- new Float:Velocity[3], Float:Speed;
- GetEntPropVector(Client, Prop_Data, "m_vecVelocity", Velocity);
- Velocity[2] = 0.0;
- Speed = GetVectorLength(Velocity);
- NormalizeVector(Velocity, Velocity);
- ScaleVector(Velocity, 500.0);
- if(Speed == 0.0)
- {
- g_bKnockBack[Client] = false;
- }
- else
- {
- if(Speed >= 1000.0)
- {
- TeleportEntity(Client, NULL_VECTOR, NULL_VECTOR, Velocity);
- }
- vel[0] = 0.0;
- vel[1] = 0.0;
- vel[2] = 0.0;
- }
- }
- }
- }
- }
- public Action:Hook_OnTakeDamage(Client, &attacker, &inflictor, &Float:damage, &damagetype)
- {
- if(!(1 <= inflictor <= MaxClients && GetClientTeam(Client) != GetClientTeam(attacker)))
- {
- return Plugin_Continue;
- }
- new String:WeaponName[32];
- GetClientWeapon(inflictor, WeaponName, sizeof(WeaponName));
- if(StrContains(WeaponName, "knife", false) != -1 || StrContains(WeaponName, "bayonet", false) != -1)
- {
- GiveKnockback(attacker, Client);
- g_bKnockBack[Client] = true;
- damage = 0.0;
- return Plugin_Changed;
- }
- return Plugin_Continue;
- }
- GiveKnockback(Client, Target)
- {
- new Float:Pos01[3], Float:Pos02[3], Float:Vector[3];
- GetClientAbsOrigin(Client, Pos01);
- GetClientAbsOrigin(Target, Pos02);
- Pos01[2] = 0.0;
- Pos02[2] = 0.0;
- MakeVectorFromPoints(Pos01, Pos02, Vector);
- NormalizeVector(Vector, Vector);
- if(!(GetEntityFlags(Target) & FL_ONGROUND))
- {
- ScaleVector(Vector, 350.0);
- }
- else
- {
- ScaleVector(Vector, 1000.0);
- }
- KnifeSound(Client);
- TeleportEntity(Target, NULL_VECTOR, NULL_VECTOR, Vector);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement