Advertisement
iFenomenal

Ore jucate

Mar 6th, 2019
363
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.00 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <nvault>
  3. #include <time>
  4. #include <colorchat>
  5.  
  6. new output[64], key[33][32], vault;
  7.  
  8. public plugin_init()
  9. {
  10.    register_plugin("Played Time", "9.0", "Hattrick");
  11.  
  12.    register_clcmd("say /orejucate", "getPlayTime");
  13.  
  14.    register_dictionary("time.txt");
  15.    vault = nvault_open("playtimes");
  16.  
  17.    if (vault == INVALID_HANDLE)
  18.    set_fail_state("Error opening nVault");
  19. }
  20.  
  21. public getPlayTime(id)
  22. {
  23.    get_time_length(id, (get_user_time(id) + nvault_get(vault, key[id])), timeunit_seconds , output, 63);
  24.    ColorChat(id, GREY, "[ InFo ]^x03 Orejucate:^x04 %s", output);
  25. }
  26.  
  27. public client_authorized(id)
  28. {
  29.    get_user_authid(id, key[id], 31);
  30.    nvault_touch(vault, key[id]);
  31. }
  32.  
  33. public client_disconnect(id)
  34. {
  35.    new value[33], timestamp;
  36.    nvault_lookup(vault, key[id], value, 32, timestamp);
  37.    formatex(value, 32, "%d", ((time() - timestamp) + nvault_get(vault, key[id])));
  38.    nvault_set(vault, key[id], value);
  39. }
  40.  
  41. public plugin_end()
  42. {
  43.    nvault_close(vault);
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement