HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /* zp_lighting_vote v0.3 */
  2.  
  3. #include <amxmodx>
  4. #include <amxmisc>
  5.  
  6. #define PLUGIN "zp_lighting_vote"
  7. #define VERSION "0.3"
  8. #define AUTHOR "ZETA [M|E|N]/CHyC"
  9.  
  10. #define keys (1<<0)|(1<<1)|(1<<2)
  11.  
  12. new menu[121],players[32],player_name[32],item[4][21],vote[4],num,i
  13.  
  14. public plugin_init() {
  15. register_plugin(PLUGIN,VERSION,AUTHOR)
  16. register_cvar("zp_lighting_vote", VERSION, FCVAR_SERVER)
  17. register_menucmd(register_menuid("lighting_vote"),keys,"func_vote")
  18. register_dictionary("zp_lighting_vote.txt")
  19. }
  20.  
  21. public plugin_cfg() {
  22. format(item[0],20,"%L",LANG_PLAYER,"VOTE_QUESTION")
  23. format(item[1],20,"%L",LANG_PLAYER,"VOTE_NIGHT")
  24. format(item[2],20,"%L",LANG_PLAYER,"VOTE_EVENING")
  25. format(item[3],20,"%L",LANG_PLAYER,"VOTE_TWILIGHT")
  26. format(menu,120,"\y%s^n^n\r1. \w%s^n\r2. \w%s^n\r3. \w%s",item[0],item[1],item[2],item[3])
  27.  
  28. set_task(120.0,"func_menu_vote")
  29. }
  30.  
  31. public func_menu_vote() {
  32. get_players(players,num)
  33.  
  34. for(i=0;i<num;i++) {
  35. show_menu(players[i],keys,menu,10,"lighting_vote")
  36. set_task(10.0,"result_vote")
  37. }
  38. return PLUGIN_HANDLED
  39. }
  40.  
  41. public func_vote(id,key) {
  42. key++
  43.  
  44. get_user_name(id,player_name,31)
  45. client_print(0,print_chat,"%L", LANG_PLAYER, "VOTE_RESULT",player_name,item[key])
  46.  
  47. vote[key]++
  48. return PLUGIN_HANDLED
  49. }
  50.  
  51.  
  52. public result_vote() {
  53. set_hudmessage(255, 255, 255, 0.06, 0.70, 0, 6.0, 7.0,_,_,5)
  54.  
  55. if(vote[1]>vote[2]) {
  56. if(vote[1]>vote[3]) {
  57. server_cmd("zp_lighting a")
  58. show_hudmessage(0, "%L", LANG_PLAYER, "RESULT_NIGHT")
  59. }
  60. else {
  61. server_cmd("zp_lighting c")
  62. show_hudmessage(0, "%L", LANG_PLAYER, "RESULT_TWILIGHT")
  63. }
  64. }
  65. else if(vote[2]>vote[3]) {
  66. server_cmd("zp_lighting b")
  67. show_hudmessage(0, "%L", LANG_PLAYER, "RESULT_EVENING")
  68. }
  69. else {
  70. server_cmd("zp_lighting c")
  71. show_hudmessage(0, "%L", LANG_PLAYER, "RESULT_TWILIGHT")
  72. }
  73. return PLUGIN_HANDLED
  74. }
  75.  
  76.