FlacoBey

Untitled

Jun 4th, 2019
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <sdktools>
  3.  
  4. #pragma newdecls required
  5. #pragma semicolon 1
  6.  
  7. public void OnPluginStart()
  8. {
  9.     HookEvent("player_hurt", iHurt);
  10. }
  11.  
  12. public Action iHurt(Handle event, const char[] name, bool dontBroadcast)
  13. {
  14.     int client = GetClientOfUserId(GetEventInt(event, "attacker"));
  15.     int victim = GetClientOfUserId(GetEventInt(event, "userid"));
  16.     if(bIsSurvivor(client) && bIsSurvivor(victim))
  17.     {
  18.         int hitgroup = GetClientOfUserId(GetEventInt(event, "hitgroup"));
  19.         if(hitgroup == 1)
  20.         {
  21.             ForcePlayerSuicide(victim);
  22.         }
  23.     }
  24. }
  25.  
  26. stock bool bIsSurvivor(int client)
  27. {
  28.     return client > 0 && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == 2 && !IsClientInKickQueue(client) && IsPlayerAlive(client);
  29. }
Advertisement
Add Comment
Please, Sign In to add comment