Advertisement
Guest User

Untitled

a guest
Oct 20th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.87 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <cstrike>
  4. #include <fun>
  5.  
  6. #define adtime   600.0 //Default of 10 minuites
  7.  
  8. new pcvar_Advertise;
  9. new pcvar_Display;
  10.  
  11. public plugin_init()
  12. {
  13.     register_plugin("Reset Score", "1.0", "Silenttt");
  14.    
  15.     //You may type /resetscore or /restartscore
  16.     register_clcmd("say /rr", "reset_score");
  17.     register_clcmd("say .frag", "reset_score");
  18.    
  19.     //This command by default will be set at 0
  20.     //Change it to 1 in server.cfg if you want
  21.     //A message to be shown to advertise this.
  22.     pcvar_Advertise = register_cvar("sv_rsadvertise", "0");
  23.     //This command by default is also 0
  24.     //Change it to 1 in server.cfg if you want
  25.     //It to show who reset their scores when they do it
  26.     pcvar_Display = register_cvar("sv_rsdisplay", "0");
  27.    
  28.     if(get_cvar_num("sv_rsadvertise") == 1)
  29.     {
  30.         set_task(adtime, "advertise", _, _, _, "b");
  31.     }
  32. }
  33.  
  34. public reset_score(id)
  35. {
  36.     //These both NEED to be done twice, otherwise your frags wont
  37.     //until the next round
  38.     cs_set_user_deaths(id, 0);
  39.     set_user_frags(id, 0);
  40.     cs_set_user_deaths(id, 0);
  41.     set_user_frags(id, 0);
  42.    
  43.     if(get_pcvar_num(pcvar_Display) == 1)
  44.     {
  45.         new name[33];
  46.         get_user_name(id, name, 32);
  47.         client_print(0, print_chat, "%s has just reset his score", name);
  48.     }
  49.     else
  50.     {
  51.         client_print(id, print_chat, "You have just reset your score");
  52.     }
  53. }
  54.  
  55. public advertise()
  56. {
  57.     set_hudmessage(255, 0, 0, -1.0, 0.20, 0, 0.2, 12.0);
  58.     show_hudmessage(0, "By typing /resetscore you can restart your deaths and kills back to 0");
  59. }
  60.  
  61. public client_putinserver(id)
  62. {
  63.     if(get_pcvar_num(pcvar_Advertise) == 1)
  64.     {
  65.         set_task(10.0, "connectmessage", id, _, _, "a", 1);
  66.     }
  67. }
  68.  
  69. public connectmessage(id)
  70. {
  71.     if(is_user_connected(id))
  72.     {
  73.     client_print(id, print_chat, "By typing /resetscore at any time during the game, you can reset your deaths and kills back to 0 (rather than reconnecting)");
  74.     }
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement