FlacoBey

Untitled

Jan 10th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.50 KB | None | 0 0
  1. #include sdktools
  2. #include sdkhooks
  3.  
  4. new Handle:Range,
  5.     Handle:Power;
  6.  
  7. public OnPluginStart()
  8. {
  9.     HookEvent("player_incapacitated", incapacitated)
  10.     Range = CreateConVar("Range","5000.0",  ".", FCVAR_NONE);
  11.     Power = CreateConVar("Power","5000.0",  ".", FCVAR_NONE);
  12. }
  13.  
  14. public Action incapacitated(Event event, const char[] name, bool dontBroadcast)
  15. {
  16.     int victim = GetClientOfUserId(event.GetInt("userid"));
  17.     int attacker = GetClientOfUserId(event.GetInt("attacker"));
  18.     char weapon[32];
  19.     GetEventString(event, "weapon", weapon, sizeof(weapon))
  20.     PrintToChatAll("%s", weapon);
  21.     if(StrEqual(weapon, "tank_claw"))
  22.     {
  23.         TeleportPlayerView2(victim, GetConVarFloat(Range), GetConVarFloat(Power), attacker)
  24.     }
  25. }
  26.  
  27.  
  28. stock bool TeleportPlayerView2(int client, float distance, float jump_power, int attacker)
  29. {
  30.     float angle[3];
  31.     float dir[3];
  32.    
  33.     GetClientEyeAngles(attacker, angle);
  34.    
  35.     //dir[0] = Cosine(DegToRad(angle[1])) * distance;
  36.     //dir[1] = Sine(DegToRad(angle[1])) * distance;
  37.    
  38.     GetAngleVectors(angle, dir, NULL_VECTOR, NULL_VECTOR);
  39.     ScaleVector(dir, distance);
  40.    
  41.     float current[3];
  42.     //GetEntPropVector(client, Prop_Send, "m_vecVelocity", current);
  43.    
  44.     int g_iVelocity = FindSendPropInfo("CBasePlayer", "m_vecVelocity[0]");
  45.     GetEntDataVector(client, g_iVelocity, current);
  46.    
  47.     float resulting[3];
  48.    
  49.     resulting[0] = current[0] + dir[0];
  50.     resulting[1] = current[1] + dir[1];
  51.     resulting[2] = jump_power; // min. 251
  52.    
  53.     TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, resulting);
  54.     return true;
  55. }
Advertisement
Add Comment
Please, Sign In to add comment