hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.05.14. 07:19



Jelenlévő felhasználók

Jelenleg 768 felhasználó van jelen :: 0 regisztrált, 0 rejtett és 768 vendég

A legtöbb felhasználó (1565 fő) 2020.11.21. 11:26-kor tartózkodott itt.

Regisztrált felhasználók: nincs regisztrált felhasználó az elmúlt 5 percben aktív felhasználók alapján

Utoljára aktív
Ahhoz hogy lásd ki volt utoljára aktív, be kell jelentkezned.



Az oldal teljeskörű
használatához regisztrálj.

Regisztráció

Kereső


Új téma nyitása  Hozzászólás a témához  [ 5 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: VoteBan színezés
HozzászólásElküldve: 2014.08.17. 15:51 
Offline
Jómunkásember
Avatar

Csatlakozott: 2013.12.18. 17:35
Hozzászólások: 365
Megköszönt másnak: 152 alkalommal
Megköszönték neki: 31 alkalommal
Hali!
Próbáltam színezi a szövegeket, de valami okból kifolyólag nem engedi, valaki kitudná esetleg javítani?


SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <colorchat>
  4.  
  5. #define MAX_players 32
  6. #define MAX_menudata 1024
  7.  
  8. new ga_PlayerName[MAX_players][32]
  9. new ga_PlayerAuthID[MAX_players][35]
  10. new ga_PlayerID[MAX_players]
  11. new ga_PlayerIP[MAX_players][16]
  12. new ga_MenuData[MAX_menudata]
  13. new ga_Choice[2]
  14. new gi_VoteStarter
  15. new gi_MenuPosition
  16. new gi_Sellection
  17. new gi_TotalPlayers
  18. new gi_SysTimeOffset = 0
  19. new i
  20. //pcvars
  21. new gi_LastTime
  22. new gi_DelayTime
  23. new gf_Ratio
  24. new gf_MinVoters
  25. new gf_BF_Ratio
  26. new gi_BanTime
  27. new gi_Disable
  28. new gi_BanType
  29.  
  30.  
  31. public plugin_init()
  32. {
  33. register_plugin("VoteBANN","1.0","PHP")
  34. register_clcmd("say voteban","SayIt" )
  35. register_menucmd(register_menuid("ChoosePlayer"), 1023, "ChooseMenu")
  36. register_menucmd(register_menuid("VoteMenu"), 1023, "CountVotes")
  37.  
  38. gi_LastTime=register_cvar("amx_voteban_lasttime","0")
  39. gi_DelayTime=register_cvar("amxx_voteban_delaytime","600")
  40. gf_Ratio=register_cvar("amxx_voteban_ratio","0.50")
  41. gf_MinVoters=register_cvar("amxx_voteban_minvoters","4.0")
  42. gf_BF_Ratio=register_cvar("amxx_voteban_bf_ratio","4.0")
  43. gi_BanTime=register_cvar("amxx_voteban_bantime","2")
  44. gi_Disable=register_cvar("amxx_voteban_disable","0")
  45. gi_BanType=register_cvar("amxx_voteban_type","1")
  46. }
  47.  
  48. public SayIt(id)
  49. {
  50. if(get_pcvar_num(gi_Disable))
  51. {
  52. ColorChat(id, GREEN,"[BS] VoteBan Kikapcsolva")
  53. return 0
  54. }
  55.  
  56. new Elapsed=get_systime(gi_SysTimeOffset) - get_pcvar_num(gi_LastTime)
  57. new Delay=get_pcvar_num(gi_DelayTime)
  58.  
  59. if( (Delay > Elapsed) && !is_user_admin(id) )
  60. {
  61. new seconds = Delay - Elapsed
  62. ColorChat(id, GREEN,"[BS] Varnod kell %d masodpercet az uj Szavazashoz!", seconds)
  63. return 0
  64. }
  65.  
  66. get_players( ga_PlayerID, gi_TotalPlayers )
  67. for(i=0; i<gi_TotalPlayers; i++)
  68. {
  69. new TempID = ga_PlayerID[i]
  70. if( is_user_admin(TempID))
  71. {
  72. if(!is_user_admin(id))
  73. {
  74. ColorChat(id, GREEN,"[BS] A Serveren van Admin,szavazas Kikapcsolva!")
  75. return 0
  76. }
  77. }
  78.  
  79. if(TempID == id)
  80. gi_VoteStarter=i
  81.  
  82. get_user_name( TempID, ga_PlayerName[i], 31 )
  83. get_user_authid( TempID, ga_PlayerAuthID[i], 34 )
  84. get_user_ip( TempID, ga_PlayerIP[i], 15, 1 )
  85. }
  86.  
  87. gi_MenuPosition = 0
  88. ShowPlayerMenu(id)
  89. return 0
  90. }
  91.  
  92. public ShowPlayerMenu(id)
  93. {
  94. new arrayloc = 0
  95. new keys = (1<<9)
  96.  
  97. arrayloc = format(ga_MenuData,(MAX_menudata-1),"[BS] VoteBan Menu ^n")
  98. for(i=0; i<8; i++)
  99. if( gi_TotalPlayers>(gi_MenuPosition+i) )
  100. {
  101. arrayloc += format(ga_MenuData[arrayloc],(MAX_menudata-1-arrayloc),"\r%d. %s^n", i+1, ga_PlayerName[gi_MenuPosition+i])
  102. keys |= (1<<i)
  103. }
  104. if( gi_TotalPlayers>(gi_MenuPosition+8) )
  105. {
  106. arrayloc += format(ga_MenuData[arrayloc],(MAX_menudata-1-arrayloc),"^n9. \yTovabb")
  107. keys |= (1<<8)
  108. }
  109. arrayloc += format(ga_MenuData[arrayloc],(MAX_menudata-1-arrayloc),"^n0. \yVissza/Kilep")
  110.  
  111. show_menu(id, keys, ga_MenuData, 20, "ChoosePlayer")
  112. return PLUGIN_HANDLED
  113. }
  114.  
  115. public ChooseMenu(id, key)
  116. {
  117. switch(key)
  118. {
  119. case 8:
  120. {
  121. gi_MenuPosition=gi_MenuPosition+8
  122. ShowPlayerMenu(id)
  123. }
  124. case 9:
  125. {
  126. if(gi_MenuPosition>=8)
  127. {
  128. gi_MenuPosition=gi_MenuPosition-8
  129. ShowPlayerMenu(id)
  130. }
  131. else
  132. return 0
  133. }
  134. default:
  135. {
  136. gi_Sellection=gi_MenuPosition+key
  137. new Now=get_systime(gi_SysTimeOffset)
  138. set_pcvar_num(gi_LastTime, Now)
  139.  
  140. run_vote()
  141. return 0
  142. }
  143. }
  144. return PLUGIN_HANDLED
  145. }
  146.  
  147. public run_vote()
  148. {
  149. log_amx("Bann Szavazas Inditva by %s %s %s -ellen", ga_PlayerName[gi_VoteStarter], ga_PlayerName[gi_Sellection], ga_PlayerAuthID[gi_Sellection])
  150. format(ga_MenuData,(MAX_menudata-1),"Bannoljuk %s-t %d percre?^n1. Igen^n2. Nem",ga_PlayerName[gi_Sellection], get_pcvar_num(gi_BanTime))
  151. ga_Choice[0] = 0
  152. ga_Choice[1] = 0
  153. show_menu( 0, (1<<0)|(1<<1), ga_MenuData, 15, "VoteMenu" )
  154. set_task(15.0,"outcom")
  155. return 0
  156. }
  157.  
  158. public CountVotes(id, key)
  159. {
  160. ++ga_Choice[key]
  161. return PLUGIN_HANDLED
  162. }
  163.  
  164. public outcom()
  165. {
  166. new TotalVotes = ga_Choice[0] + ga_Choice[1]
  167. new Float:result = (float(ga_Choice[0]) / float(TotalVotes))
  168.  
  169. if( get_pcvar_float(gf_MinVoters) >= ( float(TotalVotes) / float(gi_TotalPlayers) ) )
  170. {
  171. ColorChat(id, GREEN,"[BS] Nincs eleg szavazat a Bannolashoz %s!", ga_PlayerName[gi_Sellection])
  172. return 0
  173. }
  174. else
  175. {
  176. if( result < get_pcvar_float(gf_BF_Ratio) )
  177. {
  178. ColorChat(id, GREEN,"[BS] %s %d perc es bannolasa lejart!", ga_PlayerName[gi_VoteStarter], get_pcvar_num(gi_BanTime))
  179. ActualBan(gi_VoteStarter)
  180. log_amx("[AMXX] The vote back fired at %s, he is banned for %d minutes", ga_PlayerName[gi_VoteStarter], get_pcvar_num(gi_BanTime))
  181. }
  182.  
  183. if( result >= get_pcvar_float(gf_Ratio) )
  184. {
  185. ColorChat(id, GREEN,"[BS] Szavazas sikeres, %s bannolva %d percre", ga_PlayerName[gi_Sellection], get_pcvar_num(gi_BanTime))
  186. log_amx("[AMXX] The vote succeeded: %s is banned for %d minutes", ga_PlayerAuthID[gi_Sellection], get_pcvar_num(gi_BanTime))
  187. ActualBan(gi_Sellection)
  188. }
  189. else
  190. {
  191. ColorChat(id, GREEN,"[BS] Szavazas nem sikerult!")
  192. log_amx("Szavazas nem sikerult!")
  193. }
  194. }
  195. ColorChat(id, GREEN,"[BS] A %d j?t?kosbol , %d szavazott igennel!", gi_TotalPlayers, ga_Choice[0])
  196.  
  197. return 0
  198. }
  199.  
  200. public ActualBan(Selected)
  201. {
  202. new Type = get_pcvar_num(gi_BanType)
  203. switch(Type)
  204. {
  205. case 1:
  206. server_cmd("addip %d %s", get_pcvar_num(gi_BanTime), ga_PlayerIP[Selected])
  207. case 2:
  208. server_cmd("amx_ban %d %s Voteban", get_pcvar_num(gi_BanTime), ga_PlayerAuthID[Selected])
  209. default:
  210. server_cmd("banid %d %s kick", get_pcvar_num(gi_BanTime), ga_PlayerAuthID[Selected])
  211. }
  212. return 0
  213. }
  214.  

_________________
Ha segítettem használd a gombot!

Kép
KépKép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: VoteBan színezés
HozzászólásElküldve: 2014.08.17. 22:59 
Mien színre akkarod?
és akkor meg csínálom neked


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: VoteBan színezés
HozzászólásElküldve: 2014.08.17. 23:39 
Offline
Nagyúr
Avatar

Csatlakozott: 2014.07.22. 17:59
Hozzászólások: 667
Megköszönt másnak: 49 alkalommal
Megköszönték neki: 36 alkalommal
Az eredeti .sma-t add meg.

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: VoteBan színezés
HozzászólásElküldve: 2014.08.18. 13:50 
Offline
Jómunkásember
Avatar

Csatlakozott: 2013.12.18. 17:35
Hozzászólások: 365
Megköszönt másnak: 152 alkalommal
Megköszönték neki: 31 alkalommal
Csak ColorChat-esre kellene!:)

SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <amxmisc>
  3.  
  4. #define MAX_players 32
  5. #define MAX_menudata 1024
  6.  
  7. new ga_PlayerName[MAX_players][32]
  8. new ga_PlayerAuthID[MAX_players][35]
  9. new ga_PlayerID[MAX_players]
  10. new ga_PlayerIP[MAX_players][16]
  11. new ga_MenuData[MAX_menudata]
  12. new ga_Choice[2]
  13. new gi_VoteStarter
  14. new gi_MenuPosition
  15. new gi_Sellection
  16. new gi_TotalPlayers
  17. new gi_SysTimeOffset = 0
  18. new i
  19. //pcvars
  20. new gi_LastTime
  21. new gi_DelayTime
  22. new gf_Ratio
  23. new gf_MinVoters
  24. new gf_BF_Ratio
  25. new gi_BanTime
  26. new gi_Disable
  27. new gi_BanType
  28.  
  29.  
  30. public plugin_init()
  31. {
  32. register_plugin("VoteBANN","1.0","PHP")
  33. register_clcmd("say voteban","SayIt" )
  34. register_menucmd(register_menuid("ChoosePlayer"), 1023, "ChooseMenu")
  35. register_menucmd(register_menuid("VoteMenu"), 1023, "CountVotes")
  36.  
  37. gi_LastTime=register_cvar("amx_voteban_lasttime","0")
  38. gi_DelayTime=register_cvar("amxx_voteban_delaytime","600")
  39. gf_Ratio=register_cvar("amxx_voteban_ratio","0.50")
  40. gf_MinVoters=register_cvar("amxx_voteban_minvoters","4.0")
  41. gf_BF_Ratio=register_cvar("amxx_voteban_bf_ratio","4.0")
  42. gi_BanTime=register_cvar("amxx_voteban_bantime","2")
  43. gi_Disable=register_cvar("amxx_voteban_disable","0")
  44. gi_BanType=register_cvar("amxx_voteban_type","1")
  45. }
  46.  
  47. public SayIt(id)
  48. {
  49. if(get_pcvar_num(gi_Disable))
  50. {
  51. client_print(id,print_chat,"VoteBann Kikapcsolva")
  52. return 0
  53. }
  54.  
  55. new Elapsed=get_systime(gi_SysTimeOffset) - get_pcvar_num(gi_LastTime)
  56. new Delay=get_pcvar_num(gi_DelayTime)
  57.  
  58. if( (Delay > Elapsed) && !is_user_admin(id) )
  59. {
  60. new seconds = Delay - Elapsed
  61. client_print(id,print_chat,"Varnod kell %d masodpercet az uj Szavazashoz!", seconds)
  62. return 0
  63. }
  64.  
  65. get_players( ga_PlayerID, gi_TotalPlayers )
  66. for(i=0; i<gi_TotalPlayers; i++)
  67. {
  68. new TempID = ga_PlayerID[i]
  69. if( is_user_admin(TempID))
  70. {
  71. if(!is_user_admin(id))
  72. {
  73. client_print(id,print_chat,"A Serveren van Admin,szavazas Kikapcsolva!")
  74. return 0
  75. }
  76. }
  77.  
  78. if(TempID == id)
  79. gi_VoteStarter=i
  80.  
  81. get_user_name( TempID, ga_PlayerName[i], 31 )
  82. get_user_authid( TempID, ga_PlayerAuthID[i], 34 )
  83. get_user_ip( TempID, ga_PlayerIP[i], 15, 1 )
  84. }
  85.  
  86. gi_MenuPosition = 0
  87. ShowPlayerMenu(id)
  88. return 0
  89. }
  90.  
  91. public ShowPlayerMenu(id)
  92. {
  93. new arrayloc = 0
  94. new keys = (1<<9)
  95.  
  96. arrayloc = format(ga_MenuData,(MAX_menudata-1),"voteban menu ^n")
  97. for(i=0; i<8; i++)
  98. if( gi_TotalPlayers>(gi_MenuPosition+i) )
  99. {
  100. arrayloc += format(ga_MenuData[arrayloc],(MAX_menudata-1-arrayloc),"%d. %s^n", i+1, ga_PlayerName[gi_MenuPosition+i])
  101. keys |= (1<<i)
  102. }
  103. if( gi_TotalPlayers>(gi_MenuPosition+8) )
  104. {
  105. arrayloc += format(ga_MenuData[arrayloc],(MAX_menudata-1-arrayloc),"^n9. Tovabb")
  106. keys |= (1<<8)
  107. }
  108. arrayloc += format(ga_MenuData[arrayloc],(MAX_menudata-1-arrayloc),"^n0. Vissza/Kilep")
  109.  
  110. show_menu(id, keys, ga_MenuData, 20, "ChoosePlayer")
  111. return PLUGIN_HANDLED
  112. }
  113.  
  114. public ChooseMenu(id, key)
  115. {
  116. switch(key)
  117. {
  118. case 8:
  119. {
  120. gi_MenuPosition=gi_MenuPosition+8
  121. ShowPlayerMenu(id)
  122. }
  123. case 9:
  124. {
  125. if(gi_MenuPosition>=8)
  126. {
  127. gi_MenuPosition=gi_MenuPosition-8
  128. ShowPlayerMenu(id)
  129. }
  130. else
  131. return 0
  132. }
  133. default:
  134. {
  135. gi_Sellection=gi_MenuPosition+key
  136. new Now=get_systime(gi_SysTimeOffset)
  137. set_pcvar_num(gi_LastTime, Now)
  138.  
  139. run_vote()
  140. return 0
  141. }
  142. }
  143. return PLUGIN_HANDLED
  144. }
  145.  
  146. public run_vote()
  147. {
  148. log_amx("Bann Szavazas Inditva by %s %s %s -ellen", ga_PlayerName[gi_VoteStarter], ga_PlayerName[gi_Sellection], ga_PlayerAuthID[gi_Sellection])
  149. format(ga_MenuData,(MAX_menudata-1),"Bannoljuk %s-t %d percre?^n1. Igen^n2. Nem",ga_PlayerName[gi_Sellection], get_pcvar_num(gi_BanTime))
  150. ga_Choice[0] = 0
  151. ga_Choice[1] = 0
  152. show_menu( 0, (1<<0)|(1<<1), ga_MenuData, 15, "VoteMenu" )
  153. set_task(15.0,"outcom")
  154. return 0
  155. }
  156.  
  157. public CountVotes(id, key)
  158. {
  159. ++ga_Choice[key]
  160. return PLUGIN_HANDLED
  161. }
  162.  
  163. public outcom()
  164. {
  165. new TotalVotes = ga_Choice[0] + ga_Choice[1]
  166. new Float:result = (float(ga_Choice[0]) / float(TotalVotes))
  167.  
  168. if( get_pcvar_float(gf_MinVoters) >= ( float(TotalVotes) / float(gi_TotalPlayers) ) )
  169. {
  170. client_print(0,print_chat,"Nincs eleg szavazat a Bannolashoz %s!", ga_PlayerName[gi_Sellection])
  171. return 0
  172. }
  173. else
  174. {
  175. if( result < get_pcvar_float(gf_BF_Ratio) )
  176. {
  177. client_print(0,print_chat,"[AMXX] %s %d perc es bannolasa lejart!", ga_PlayerName[gi_VoteStarter], get_pcvar_num(gi_BanTime))
  178. ActualBan(gi_VoteStarter)
  179. log_amx("[AMXX] The vote back fired at %s, he is banned for %d minutes", ga_PlayerName[gi_VoteStarter], get_pcvar_num(gi_BanTime))
  180. }
  181.  
  182. if( result >= get_pcvar_float(gf_Ratio) )
  183. {
  184. client_print(0,print_chat,"Szavazas sikeres, %s bannolva %d percre", ga_PlayerName[gi_Sellection], get_pcvar_num(gi_BanTime))
  185. log_amx("[AMXX] The vote succeeded: %s is banned for %d minutes", ga_PlayerAuthID[gi_Sellection], get_pcvar_num(gi_BanTime))
  186. ActualBan(gi_Sellection)
  187. }
  188. else
  189. {
  190. client_print(0,print_chat,"Szavazas nem sikerult!")
  191. log_amx("Szavazas nem sikerult!")
  192. }
  193. }
  194. client_print(0,print_chat,"A %d j�t�kosbol , %d szavazott igenel!.", gi_TotalPlayers, ga_Choice[0])
  195.  
  196. return 0
  197. }
  198.  
  199. public ActualBan(Selected)
  200. {
  201. new Type = get_pcvar_num(gi_BanType)
  202. switch(Type)
  203. {
  204. case 1:
  205. server_cmd("addip %d %s", get_pcvar_num(gi_BanTime), ga_PlayerIP[Selected])
  206. case 2:
  207. server_cmd("amx_ban %d %s Voteban", get_pcvar_num(gi_BanTime), ga_PlayerAuthID[Selected])
  208. default:
  209. server_cmd("banid %d %s kick", get_pcvar_num(gi_BanTime), ga_PlayerAuthID[Selected])
  210. }
  211. return 0
  212. }

_________________
Ha segítettem használd a gombot!

Kép
KépKép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: VoteBan színezés
HozzászólásElküldve: 2014.08.19. 09:36 
Offline
Nagyúr
Avatar

Csatlakozott: 2014.07.22. 17:59
Hozzászólások: 667
Megköszönt másnak: 49 alkalommal
Megköszönték neki: 36 alkalommal
Tessék:
SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <colorchat>
  4.  
  5. #define MAX_players 32
  6. #define MAX_menudata 1024
  7.  
  8. new ga_PlayerName[MAX_players][32]
  9. new ga_PlayerAuthID[MAX_players][35]
  10. new ga_PlayerID[MAX_players]
  11. new ga_PlayerIP[MAX_players][16]
  12. new ga_MenuData[MAX_menudata]
  13. new ga_Choice[2]
  14. new gi_VoteStarter
  15. new gi_MenuPosition
  16. new gi_Sellection
  17. new gi_TotalPlayers
  18. new gi_SysTimeOffset = 0
  19. new i
  20. //pcvars
  21. new gi_LastTime
  22. new gi_DelayTime
  23. new gf_Ratio
  24. new gf_MinVoters
  25. new gf_BF_Ratio
  26. new gi_BanTime
  27. new gi_Disable
  28. new gi_BanType
  29.  
  30.  
  31. public plugin_init()
  32. {
  33. register_plugin("VoteBANN","1.0","PHP")
  34. register_clcmd("say voteban","SayIt" )
  35. register_menucmd(register_menuid("ChoosePlayer"), 1023, "ChooseMenu")
  36. register_menucmd(register_menuid("VoteMenu"), 1023, "CountVotes")
  37.  
  38. gi_LastTime=register_cvar("amx_voteban_lasttime","0")
  39. gi_DelayTime=register_cvar("amxx_voteban_delaytime","600")
  40. gf_Ratio=register_cvar("amxx_voteban_ratio","0.50")
  41. gf_MinVoters=register_cvar("amxx_voteban_minvoters","4.0")
  42. gf_BF_Ratio=register_cvar("amxx_voteban_bf_ratio","4.0")
  43. gi_BanTime=register_cvar("amxx_voteban_bantime","2")
  44. gi_Disable=register_cvar("amxx_voteban_disable","0")
  45. gi_BanType=register_cvar("amxx_voteban_type","1")
  46. }
  47.  
  48. public SayIt(id)
  49. {
  50. if(get_pcvar_num(gi_Disable))
  51. {
  52. ColorChat(id, GREEN, "[BS] ^3VoteBan ^1Kikapcsolva")
  53. return 0
  54. }
  55.  
  56. new Elapsed=get_systime(gi_SysTimeOffset) - get_pcvar_num(gi_LastTime)
  57. new Delay=get_pcvar_num(gi_DelayTime)
  58.  
  59. if( (Delay > Elapsed) && !is_user_admin(id) )
  60. {
  61. new seconds = Delay - Elapsed
  62. ColorChat(id, GREEN, "[BS] ^1Varnod kell ^4%d masodpercet az uj ^3Szavazashoz!", seconds)
  63. return 0
  64. }
  65.  
  66. get_players( ga_PlayerID, gi_TotalPlayers )
  67. for(i=0; i<gi_TotalPlayers; i++)
  68. {
  69. new TempID = ga_PlayerID[i]
  70. if( is_user_admin(TempID))
  71. {
  72. if(!is_user_admin(id))
  73. {
  74. ColorChat(id, GREEN, "[BS] ^1A Szerveren van ^4Admin,szavazas ^3Kikapcsolva!")
  75. return 0
  76. }
  77. }
  78.  
  79. if(TempID == id)
  80. gi_VoteStarter=i
  81.  
  82. get_user_name( TempID, ga_PlayerName[i], 31 )
  83. get_user_authid( TempID, ga_PlayerAuthID[i], 34 )
  84. get_user_ip( TempID, ga_PlayerIP[i], 15, 1 )
  85. }
  86.  
  87. gi_MenuPosition = 0
  88. ShowPlayerMenu(id)
  89. return 0
  90. }
  91.  
  92. public ShowPlayerMenu(id)
  93. {
  94. new arrayloc = 0
  95. new keys = (1<<9)
  96.  
  97. arrayloc = format(ga_MenuData,(MAX_menudata-1),"voteban menu ^n")
  98. for(i=0; i<8; i++)
  99. if( gi_TotalPlayers>(gi_MenuPosition+i) )
  100. {
  101. arrayloc += format(ga_MenuData[arrayloc],(MAX_menudata-1-arrayloc),"%d. %s^n", i+1, ga_PlayerName[gi_MenuPosition+i])
  102. keys |= (1<<i)
  103. }
  104. if( gi_TotalPlayers>(gi_MenuPosition+8) )
  105. {
  106. arrayloc += format(ga_MenuData[arrayloc],(MAX_menudata-1-arrayloc),"^n9. Tovabb")
  107. keys |= (1<<8)
  108. }
  109. arrayloc += format(ga_MenuData[arrayloc],(MAX_menudata-1-arrayloc),"^n0. Vissza/Kilep")
  110.  
  111. show_menu(id, keys, ga_MenuData, 20, "ChoosePlayer")
  112. return PLUGIN_HANDLED
  113. }
  114.  
  115. public ChooseMenu(id, key)
  116. {
  117. switch(key)
  118. {
  119. case 8:
  120. {
  121. gi_MenuPosition=gi_MenuPosition+8
  122. ShowPlayerMenu(id)
  123. }
  124. case 9:
  125. {
  126. if(gi_MenuPosition>=8)
  127. {
  128. gi_MenuPosition=gi_MenuPosition-8
  129. ShowPlayerMenu(id)
  130. }
  131. else
  132. return 0
  133. }
  134. default:
  135. {
  136. gi_Sellection=gi_MenuPosition+key
  137. new Now=get_systime(gi_SysTimeOffset)
  138. set_pcvar_num(gi_LastTime, Now)
  139.  
  140. run_vote()
  141. return 0
  142. }
  143. }
  144. return PLUGIN_HANDLED
  145. }
  146.  
  147. public run_vote()
  148. {
  149. log_amx("Bann Szavazas Inditva by %s %s %s -ellen", ga_PlayerName[gi_VoteStarter], ga_PlayerName[gi_Sellection], ga_PlayerAuthID[gi_Sellection])
  150. format(ga_MenuData,(MAX_menudata-1),"Bannoljuk %s-t %d percre?^n1. Igen^n2. Nem",ga_PlayerName[gi_Sellection], get_pcvar_num(gi_BanTime))
  151. ga_Choice[0] = 0
  152. ga_Choice[1] = 0
  153. show_menu( 0, (1<<0)|(1<<1), ga_MenuData, 15, "VoteMenu" )
  154. set_task(15.0,"outcom")
  155. return 0
  156. }
  157.  
  158. public CountVotes(id, key)
  159. {
  160. ++ga_Choice[key]
  161. return PLUGIN_HANDLED
  162. }
  163.  
  164. public outcom()
  165. {
  166. new TotalVotes = ga_Choice[0] + ga_Choice[1]
  167. new Float:result = (float(ga_Choice[0]) / float(TotalVotes))
  168.  
  169. if( get_pcvar_float(gf_MinVoters) >= ( float(TotalVotes) / float(gi_TotalPlayers) ) )
  170. {
  171. ColorChat(0, GREEN, "[BS] ^1Nincs eleg szavazat a ^3Bannolashoz ^4%s!", ga_PlayerName[gi_Sellection])
  172. return 0
  173. }
  174. else
  175. {
  176. if( result < get_pcvar_float(gf_BF_Ratio) )
  177. {
  178. ColorChat(0, GREEN, "[BS] %s %d ^1perc-es ^3bannolasa ^1lejart!", ga_PlayerName[gi_VoteStarter], get_pcvar_num(gi_BanTime))
  179. ActualBan(gi_VoteStarter)
  180. log_amx("[AMXX] The vote back fired at %s, he is banned for %d minutes", ga_PlayerName[gi_VoteStarter], get_pcvar_num(gi_BanTime))
  181. }
  182.  
  183. if( result >= get_pcvar_float(gf_Ratio) )
  184. {
  185. ColorChat(0, GREEN, "[BS] ^1Szavazas sikeres, ^4%s ^3bannolva ^4%d ^1percre!", ga_PlayerName[gi_Sellection], get_pcvar_num(gi_BanTime))
  186. log_amx("[AMXX] The vote succeeded: %s is banned for %d minutes", ga_PlayerAuthID[gi_Sellection], get_pcvar_num(gi_BanTime))
  187. ActualBan(gi_Sellection)
  188. }
  189. else
  190. {
  191. ColorChat(0, GREEN, "[BS] ^3Szavazas ^1nem sikerult!")
  192. log_amx("Szavazas nem sikerult!")
  193. }
  194. }
  195. ColorChat(0, GREEN, "[BS] ^1A ^4%d ^1jatekosbol , ^4%d ^1szavazott ^3igennel!", gi_TotalPlayers, ga_Choice[0])
  196.  
  197. return 0
  198. }
  199.  
  200. public ActualBan(Selected)
  201. {
  202. new Type = get_pcvar_num(gi_BanType)
  203. switch(Type)
  204. {
  205. case 1:
  206. server_cmd("addip %d %s", get_pcvar_num(gi_BanTime), ga_PlayerIP[Selected])
  207. case 2:
  208. server_cmd("amx_ban %d %s Voteban", get_pcvar_num(gi_BanTime), ga_PlayerAuthID[Selected])
  209. default:
  210. server_cmd("banid %d %s kick", get_pcvar_num(gi_BanTime), ga_PlayerAuthID[Selected])
  211. }
  212. return 0
  213. }

Ha más színben akkarod szólj!

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
Hozzászólások megjelenítése:  Rendezés  
Új téma nyitása  Hozzászólás a témához  [ 5 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 27 vendég


Nyithatsz új témákat ebben a fórumban.
Válaszolhatsz egy témára ebben a fórumban.
Nem szerkesztheted a hozzászólásaidat ebben a fórumban.
Nem törölheted a hozzászólásaidat ebben a fórumban.
Nem küldhetsz csatolmányokat ebben a fórumban.

Keresés:
Ugrás:  
Powered by phpBB® Forum Software © phpBB Limited
Magyar fordítás © Magyar phpBB Közösség
Portal: Kiss Portal Extension © Michael O'Toole