Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include sdktools
- #include sdkhooks
- new Handle:Range,
- Handle:Power;
- public OnPluginStart()
- {
- HookEvent("player_incapacitated", incapacitated)
- Range = CreateConVar("Range","5000.0", ".", FCVAR_NONE);
- Power = CreateConVar("Power","5000.0", ".", FCVAR_NONE);
- }
- public Action incapacitated(Event event, const char[] name, bool dontBroadcast)
- {
- int victim = GetClientOfUserId(event.GetInt("userid"));
- int attacker = GetClientOfUserId(event.GetInt("attacker"));
- char weapon[32];
- GetEventString(event, "weapon", weapon, sizeof(weapon))
- PrintToChatAll("%s", weapon);
- if(StrEqual(weapon, "tank_claw"))
- {
- TeleportPlayerView2(victim, GetConVarFloat(Range), GetConVarFloat(Power), attacker)
- }
- }
- stock bool TeleportPlayerView2(int client, float distance, float jump_power, int attacker)
- {
- float angle[3];
- float dir[3];
- GetClientEyeAngles(attacker, angle);
- //dir[0] = Cosine(DegToRad(angle[1])) * distance;
- //dir[1] = Sine(DegToRad(angle[1])) * distance;
- GetAngleVectors(angle, dir, NULL_VECTOR, NULL_VECTOR);
- ScaleVector(dir, distance);
- float current[3];
- //GetEntPropVector(client, Prop_Send, "m_vecVelocity", current);
- int g_iVelocity = FindSendPropInfo("CBasePlayer", "m_vecVelocity[0]");
- GetEntDataVector(client, g_iVelocity, current);
- float resulting[3];
- resulting[0] = current[0] + dir[0];
- resulting[1] = current[1] + dir[1];
- resulting[2] = jump_power; // min. 251
- TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, resulting);
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment