Guest User

Untitled

a guest
May 22nd, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.20 KB | None | 0 0
  1. #pragma semicolon 1
  2.  
  3. #include <sourcemod>
  4. #include <gungame_const>
  5. #include <gungame>
  6.  
  7. /**
  8.  * This is a plugin for hlstatx logging of the winner of the gungame current level.
  9.  */
  10.  
  11. public Plugin:myinfo =
  12. {
  13.     name = "GunGame:SM Winner Logger",
  14.     author = GUNGAME_AUTHOR,
  15.     description = "Logging of winner for external stats plugin",
  16.     version = GUNGAME_VERSION,
  17.     url = GUNGAME_URL
  18. };
  19.  
  20. public GG_OnWinner(client, const String:Weapon[], victim)
  21. {
  22.     LogEventToGame("gg_win", client);
  23.  
  24.     new teamWin = GetClientTeam(client);
  25.     new teamLose = ( (teamWin == TEAM_CT) ? TEAM_T : TEAM_CT );
  26.     new team;
  27.     for ( new i = 1; i <= MaxClients; i++ ) {
  28.         if ( IsClientInGame(i) ) {
  29.             team = GetClientTeam(i);
  30.             if ( team == teamWin ) {
  31.                 LogEventToGame("gg_team_win", i);
  32.             } else if ( team == teamLose ) {
  33.                 LogEventToGame("gg_team_lose", i);
  34.             }
  35.         }
  36.     }
  37. }
  38.  
  39. public GG_OnTripleLevel(client)
  40. {
  41.     LogEventToGame("gg_triple_level", client);
  42. }
  43.  
  44. public GG_OnLeaderChange(client, level, totalLevels)
  45. {
  46.     if ( client && IsClientInGame(client) )
  47.     {
  48.         LogEventToGame("gg_leader", client);
  49.     }
  50. }
  51.  
  52. public Action:GG_OnClientLevelChange(client, level, difference, bool:steal, bool:last, bool:knife)
  53. {
  54.     if ( !difference )
  55.     {
  56.         return;
  57.     }
  58.     if ( difference > 0 )
  59.     {
  60.         LogEventToGame("gg_levelup", client);
  61.         if ( steal )
  62.         {
  63.             LogEventToGame("gg_knife_steal", client);
  64.         }
  65.         if ( last )
  66.         {
  67.             LogEventToGame("gg_last_level", client);
  68.         }
  69.         if ( knife )
  70.         {
  71.             LogEventToGame("gg_knife_level", client);
  72.         }
  73.     }
  74.     else
  75.     {
  76.         LogEventToGame("gg_leveldown", client);
  77.     }
  78. }
  79.  
  80. LogEventToGame(const String:event[], client)
  81. {
  82.     decl String:Name[64], String:Auth[64];
  83.  
  84.     GetClientName(client, Name, sizeof(Name));
  85.     GetClientAuthString(client, Auth, sizeof(Auth));
  86.  
  87.     new team = GetClientTeam(client), UserId = GetClientUserId(client);
  88.     LogToGame("\"%s<%d><%s><%s>\" triggered \"%s\"", Name, UserId, Auth, (team == TEAM_T) ? "TERRORIST" : "CT", event);
  89. }
Add Comment
Please, Sign In to add comment