FlacoBey

Untitled

Feb 16th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.69 KB | None | 0 0
  1. #include sourcemod
  2. #include sdktools
  3. #include sdkhooks
  4.  
  5. public OnPluginStart()
  6. {
  7.     AddCommandListener(CommandListener:Command_Block, "impulse");
  8. }
  9.  
  10. public Action:Command_Block(client, const String:command[], args)
  11. {
  12.     int slot = GetPlayerWeaponSlot(client, 0);
  13.     if (IsValidEntity(slot))
  14.     {
  15.         SDKCallWeaponDrop(client, slot);
  16.     }
  17.     return Plugin_Handled;
  18. }
  19.  
  20. stock bool bIsSurvivor(int client)
  21. {
  22.     return client > 0 && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == 2 && !IsClientInKickQueue(client) && IsPlayerAlive(client);
  23. }
  24.  
  25. stock SDKCallWeaponDrop(client, weapon)
  26. {
  27.     decl Float:vecAngles[3], Float:vecTarget[3], Float:vecVelocity[3];
  28.     if (GetPlayerEye(client, vecTarget))
  29.     {
  30.         GetClientEyeAngles(client, vecAngles);
  31.         GetAngleVectors(vecAngles, vecVelocity, NULL_VECTOR, NULL_VECTOR)
  32.         vecVelocity[0] *= 800.0;
  33.         vecVelocity[1] *= 800.0;
  34.         vecVelocity[2] *= 800.0;
  35.  
  36.         SDKHooks_DropWeapon(client, weapon, NULL_VECTOR, NULL_VECTOR);
  37.  
  38.         TeleportEntity(weapon, NULL_VECTOR, NULL_VECTOR, vecVelocity)
  39.     }
  40. }
  41.  
  42. stock bool:GetPlayerEye(client, Float:vecTarget[3])
  43. {
  44.     decl Float:Origin[3], Float:Angles[3];
  45.     GetClientEyePosition(client, Origin);
  46.     GetClientEyeAngles(client, Angles);
  47.  
  48.     new Handle:trace = TR_TraceRayFilterEx(Origin, Angles, MASK_SHOT, RayType_Infinite, TraceEntityFilterPlayer);
  49.     if (TR_DidHit(trace))
  50.     {
  51.         TR_GetEndPosition(vecTarget, trace);
  52.         CloseHandle(trace);
  53.         return true;
  54.     }
  55.     CloseHandle(trace);
  56.     return false;
  57. }
  58.  
  59. public bool:TraceEntityFilterPlayer(entity, contentsMask)
  60. {
  61.     return entity > GetMaxClients() || !entity;
  62. }
Advertisement
Add Comment
Please, Sign In to add comment