FlacoBey

Untitled

Dec 25th, 2018
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.86 KB | None | 0 0
  1. #pragma semicolon 1
  2. #include <sourcemod>
  3. #include <sdktools>
  4.  
  5. public OnPluginStart()
  6. {
  7.     HookEvent("lunge_pounce", EventLungePounce);
  8. }
  9.  
  10. public Action:EventLungePounce(Handle:event, String:event_name[], bool:dontBroadcast)
  11. {
  12.     int distance = GetEventInt(event, "distance");
  13.     int victim  = GetClientOfUserId(GetEventInt(event, "victim"));
  14.     int attacker  = GetClientOfUserId(GetEventInt(event, "userid"));
  15.    
  16.     char victim_name[64];
  17.     Format(victim_name, sizeof(victim_name), "%N", victim);
  18.    
  19.     new String:config_path[PLATFORM_MAX_PATH];
  20.     BuildPath(Path_SM, config_path, sizeof(config_path), "data/tophunter1337.ini");
  21.     if (!FileExists(config_path))
  22.     {
  23.         new Handle:open_path = OpenFile(config_path, "w");
  24.         WriteFileLine(open_path, "");
  25.         CloseHandle(open_path);
  26.     }
  27.     new Handle:build_path = CreateKeyValues("topjump");
  28.     if (FileToKeyValues(build_path, config_path))
  29.     {
  30.         decl String:map[75];    
  31.         GetCurrentMap(map, 75);
  32.         if (KvJumpToKey(build_path, map, true))
  33.         {
  34.             new brutal_distance = KvGetNum(build_path, "distance", 0);
  35.             new String:hunter_name[32];
  36.             Format(hunter_name, sizeof(hunter_name), "%N", attacker);
  37.             KvGetString(build_path, "hunter_name", hunter_name, sizeof(hunter_name));
  38.             KvSetNum(build_path, "distance", brutal_distance);
  39.             KvSetString(build_path, "hunter_name", hunter_name);
  40.             KvRewind(build_path);
  41.             KeyValuesToFile(build_path, config_path);
  42.             if(KvJumpToKey(build_path, map, true))
  43.             {
  44.                 if (distance > brutal_distance)
  45.                 {
  46.                     KvSetNum(build_path, "distance", distance);
  47.                     KvSetString(build_path, "hunter_name", hunter_name);
  48.                     KeyValuesToFile(build_path, config_path);
  49.                     PrintHintTextToAll("Побил");
  50.                     KvRewind(build_path);
  51.                 }
  52.             }
  53.         }
  54.     }
  55.     CloseHandle(build_path);
  56.    
  57.     if(distance >= 1000)
  58.     {
  59.         PrintToChatAll("%i", distance);
  60.     }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment