FlacoBey

Untitled

May 24th, 2019
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.84 KB | None | 0 0
  1. #include sdktools
  2.  
  3. public OnPluginStart()
  4. {
  5.     HookEvent("player_hurt", EventHurt);
  6. }
  7.  
  8. public Action EventHurt(Event event, const char[] name, bool dontBroadcast)
  9. {
  10.     int client = GetClientOfUserId(GetEventInt(event, "userid"))
  11.     if(bIsSurvivor(client))
  12.     {
  13.         for(int i = 1; i <= GetRandomInt(4, 20); ++i)
  14.         {
  15.             BloodSpray(client)
  16.         }
  17.     }
  18. }
  19.  
  20. stock BloodSpray(iClient)
  21. {
  22.     new iEnt = CreateEntityByName("env_blood");
  23.     if (iEnt == -1)
  24.     DispatchSpawn(iEnt);
  25.     DispatchKeyValue(iEnt, "spawnflags", "13");
  26.     DispatchKeyValue(iEnt, "amount", "100");
  27.     AcceptEntityInput(iEnt, "EmitBlood", iClient);
  28.     RemoveEdict(iEnt);
  29. }
  30.  
  31. stock bool bIsSurvivor(int client)
  32. {
  33.     return client > 0 && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == 2 && !IsClientInKickQueue(client) && IsPlayerAlive(client);
  34. }
Advertisement
Add Comment
Please, Sign In to add comment