HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <cstrike>
  4. #include <fun>
  5. #include <nvault>
  6. #include <colorchat>
  7.  
  8.  
  9. new Advertise
  10. new Display
  11. new g_vault
  12. new Time
  13. new color
  14. new srv_name
  15.  
  16. public plugin_init()
  17. {
  18. register_plugin("ScoreOptions", "1.0", "Petrik")
  19.  
  20. //cmd*s
  21. register_clcmd("say /resetscore", "reset")
  22. register_clcmd("say /rs", "reset")
  23.  
  24. register_clcmd("say /savescore", "save")
  25. register_clcmd("say /ss", "save")
  26.  
  27. register_clcmd("say /loadscores", "load")
  28. register_clcmd("say /ls", "load")
  29.  
  30. register_clcmd("say /balancestat", "balance")
  31. register_clcmd("say /bs", "balance")
  32.  
  33. register_clcmd("say /SOhelp","motd")
  34.  
  35.  
  36. //cvars
  37. Display = register_cvar("sv_rsdisplay","1")
  38. Advertise = register_cvar("sv_rsAdvertise", "1")
  39. Time = register_cvar("sv_rsTime", "60.0")
  40. color = register_cvar("sv_rsColor", "1")
  41. srv_name = register_cvar( "srv_name", "[AMXX]" );
  42.  
  43. //nvault
  44. g_vault = nvault_open("score")
  45.  
  46. //
  47. set_task(20.0, "advertise")
  48. }
  49.  
  50. public motd(id)
  51. show_motd(id,"sohelp.txt","Score Options HELP")
  52.  
  53. public reset(id)
  54. {
  55. new srv_name2[ 8 ]
  56. get_pcvar_string( srv_name, srv_name2, charsmax(srv_name2));
  57. cs_set_user_deaths(id, 0)
  58. set_user_frags(id, 0)
  59. cs_set_user_deaths(id, 0)
  60. set_user_frags(id, 0)
  61.  
  62. if(get_pcvar_num(Display) == 1)
  63. {
  64. new name[33]
  65. get_user_name(id, name, 32)
  66. if(get_pcvar_num(color) == 1)
  67. ColorChat(0, GREEN, "%s ^x03%s ^x01 nullazta a statjat.",srv_name2 , name)
  68. else
  69. client_print(0, print_chat, "%s %s nullazta a statjat.",srv_name2 , name)
  70. return PLUGIN_HANDLED;
  71. }
  72. else
  73. {
  74. if(get_pcvar_num(color) == 1)
  75. ColorChat(0, GREEN, "%s ^x01 A statod sikeresen lenullazva!",srv_name2)
  76. else
  77. client_print(id, print_chat, "%s A statod sikeresen lenullazva!", srv_name2)
  78. }
  79. return PLUGIN_HANDLED;
  80. }
  81.  
  82.  
  83. public save(id)
  84. {
  85. new srv_name2[ 8 ]
  86. get_pcvar_string( srv_name, srv_name2, charsmax(srv_name2));
  87. new frags = get_user_frags(id)
  88. new deaths = cs_get_user_deaths(id)
  89.  
  90. new name[32]
  91. get_user_name(id, name, 31)
  92. new vaultkey[64],vaultdata[256]
  93. format(vaultkey,63,"%sscore", name)
  94. format(vaultdata,255,"%i#%i#",frags,deaths)
  95. nvault_set(g_vault,vaultkey,vaultdata)
  96.  
  97. if(get_pcvar_num(Display) == 1)
  98. {
  99. new name[33]
  100. get_user_name(id, name, 32)
  101. if(get_pcvar_num(color) == 1)
  102. ColorChat(0, GREEN, "%s ^x03%s ^x01 elmentette ezt a statot: %d-%d",srv_name2, name, frags, deaths)
  103. else
  104. client_print(0, print_chat, "%s %s elmentette ezt a statot: %d-%d",srv_name2, name, frags, deaths)
  105. return PLUGIN_HANDLED;
  106. }
  107. else
  108. {
  109. if(get_pcvar_num(color) == 1)
  110. ColorChat(0, GREEN, "%s ^x01Sikeresen elmentetted ezt a statot: %d-%d",srv_name2 ,frags, deaths)
  111. else
  112. client_print(id, print_chat, "%s Sikeresen elmentetted ezt a statot: %d-%d",srv_name2 ,frags, deaths)
  113. }
  114.  
  115.  
  116. return PLUGIN_HANDLED;
  117. }
  118.  
  119. public load(id)
  120. {
  121. new srv_name2[ 8 ]
  122. get_pcvar_string( srv_name, srv_name2, charsmax(srv_name2));
  123. new frags
  124. new deaths
  125.  
  126. new name[32]
  127. get_user_name(id, name, 31)
  128. new vaultkey[64],vaultdata[256]
  129. format(vaultkey,63,"%sscore", name)
  130. format(vaultdata,255,"%i#%i#",frags,deaths)
  131. nvault_get(g_vault,vaultkey,vaultdata,255)
  132. replace_all(vaultdata, 255, "#", " ")
  133. new playerdeaths[32], playerfrags[32]
  134. parse(vaultdata, playerfrags, 31, playerdeaths, 31)
  135.  
  136. cs_set_user_deaths(id, str_to_num(playerdeaths))
  137. set_user_frags(id, str_to_num(playerfrags))
  138. cs_set_user_deaths(id, str_to_num(playerdeaths))
  139. set_user_frags(id, str_to_num(playerfrags))
  140.  
  141. if(get_pcvar_num(Display) == 1)
  142. {
  143. new name[33]
  144. get_user_name(id, name, 32)
  145. if(get_pcvar_num(color) == 1)
  146. ColorChat(0, GREEN, "%s ^x03%s ^x01 betoltotte ezt a statot: %d-%d ",srv_name2, name , str_to_num(playerfrags) ,str_to_num(playerdeaths))
  147. else
  148. client_print(0, print_chat, "%s %s betoltotte ezt a statot: %d-%d ",srv_name2, name , str_to_num(playerfrags) ,str_to_num(playerdeaths))
  149. return PLUGIN_HANDLED;
  150. }
  151. else
  152. {
  153. if(get_pcvar_num(color) == 1)
  154. ColorChat(0, GREEN,"%s ^x01 Sikeresen betoltotted ezt a statot: %d-%d",srv_name2, str_to_num(playerfrags) ,str_to_num(playerdeaths))
  155. else
  156. client_print(id, print_chat, "%s Sikeresen betoltotted ezt a statot: %d-%d",srv_name2, str_to_num(playerfrags) ,str_to_num(playerdeaths))
  157. }
  158.  
  159. return PLUGIN_HANDLED;
  160. }
  161.  
  162. public balance(id)
  163. {
  164. new srv_name2[ 8 ]
  165. get_pcvar_string( srv_name, srv_name2, charsmax(srv_name2));
  166. new frags = get_user_frags(id);
  167. new deaths = cs_get_user_deaths(id)
  168. if(deaths > frags)
  169. {
  170. if(get_pcvar_num(color) == 1)
  171. ColorChat(0, GREEN,"%s ^x01 Nem egyenlitheted ki a statod mert tobbszor haltal meg mint ahany fragod van!",srv_name2)
  172. else
  173. client_print(id, print_chat, "%s Nem egyenlitheted ki a statod mert tobbszor haltal meg mint ahany fragod van!",srv_name2)
  174. return PLUGIN_HANDLED;
  175. }
  176. else
  177. {
  178. frags -= deaths;
  179. set_user_frags(id, frags)
  180. cs_set_user_deaths(id, 0);
  181.  
  182. if(get_pcvar_num(Display) == 1){
  183. new name[33]
  184. get_user_name(id, name, 32)
  185. if(get_pcvar_num(color) == 1)
  186. ColorChat(0, GREEN,"%s ^x03%s ^x01 kiegyenlitette a statjat.",srv_name2, name)
  187. else
  188. client_print(0, print_chat, "%s %s kiegyenlitette a statjat.",srv_name2, name)
  189. return PLUGIN_HANDLED;
  190. }
  191. else{
  192. if(get_pcvar_num(color) == 1)
  193. ColorChat(0, GREEN,"%s ^x01 Sikeresen kiegyenlitetted a statod!",srv_name2)
  194. else
  195. client_print(id, print_chat, "%s Sikeresen kiegyenlitetted a statod!",srv_name2)
  196. }
  197. }
  198. return PLUGIN_HANDLED;
  199. }
  200.  
  201. public advertise()
  202. {
  203. new srv_name2[ 8 ]
  204. get_pcvar_string( srv_name, srv_name2, charsmax(srv_name2));
  205.  
  206. if(get_pcvar_num(Advertise) == 0)
  207. return PLUGIN_HANDLED;
  208.  
  209. set_task(get_pcvar_float(Time), "advertise")
  210.  
  211. if(get_pcvar_num(Advertise) == 1){
  212. set_hudmessage(0, 255, 100, 0.01, 0.15, 0, 6.0, 15.0)
  213. show_hudmessage(0, "Ird chatbe: ^n/rs, hogy nullazd a statod^n/ss, hogy elmentsd a statod^n/ls, hogy vissza allitsd a statod^n/bs, hogy kiengyelitsd a statod")
  214. }
  215. if(get_pcvar_num(Advertise) == 2){
  216. if(get_pcvar_num(color) == 1)
  217. ColorChat(0, GREEN,"%s ^x01 Ird: /rs, hogy nullazd ,/ss hogy elmentsd, /ls hogy vissza allitsd, /bs hogy kiengyelitsd a statod",srv_name2)
  218. else
  219. client_print(0, print_chat, "%s Ird: /rs, hogy nullazd ,/ss hogy elmentsd, /ls hogy vissza allitsd, /bs hogy kiengyelitsd a statod",srv_name2)
  220. }
  221. if(get_pcvar_num(Advertise) == 3){
  222. set_hudmessage(0, 255, 100, 0.01, 0.15, 0, 0.2, 15.0)
  223. show_hudmessage(0, "Ird chatbe: ^n/rs, hogy nullazd a statod^n/ss, hogy elmentsd a statod^n/ls hogy vissza allitsd a statod^n/bs hogy kiengyelitsd a statod")
  224. if(get_pcvar_num(color) == 1)
  225. ColorChat(0, GREEN,"%s ^x01 Ird: /rs, hogy nullazd ,/ss hogy elmentsd, /ls hogy vissza allitsd, /bs hogy kiengyelitsd a statod",srv_name2)
  226. else
  227. client_print(0, print_chat, "%s Ird: /rs, hogy nullazd ,/ss hogy elmentsd, /ls hogy vissza allitsd, /bs hogy kiengyelitsd a statod",srv_name2)
  228. }
  229. set_task(30.0,"petrikadvertise")
  230. return PLUGIN_HANDLED;
  231. }
  232.  
  233. public petrikadvertise(){
  234. ColorChat(0, GREEN, "A szerveren ^x03score options ^x04plugin fut irta: ^x03Petrik")
  235. client_print(0, print_chat, "Ird /SOhelp hogy eligazodj a score options pluginon!")
  236. }
  237. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  238. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1038\\ f0\\ fs16 \n\\ par }
  239. */
  240.