Witamy w Nieoficjalnym polskim support'cie AMX Mod X
Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
|
Guest Message by DevFuse
Wklejka 1jrjffh7nsauj dodana przez peja222, 21.01.2020 18:13
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80. 81. 82. 83. 84. 85. 86. 87. 88. 89. 90. 91. 92. 93. 94. 95. 96. 97. 98. 99. 100. 101. 102. 103. 104. 105. 106. 107. 108. 109. 110. 111. 112. 113. 114. 115. 116. 117. 118. 119. 120. 121. 122. 123. 124. 125. 126. 127. 128. 129. 130. 131. 132. 133. 134. 135. 136. 137. 138. 139. 140. 141. 142. 143. 144. 145. 146. 147. 148. 149. 150. 151. 152. 153. 154. 155. 156. 157. 158. 159. 160. 161. 162. 163. 164. 165. 166. 167. 168. 169. 170. 171. 172. 173. 174. 175. 176. 177. 178. 179. 180. 181. 182. 183. 184. 185. 186. 187. 188. 189. 190. 191. 192. 193. 194. 195. 196. 197. 198. 199. 200. 201. 202. 203. 204. 205. 206. 207. 208. 209. 210. 211. 212. 213. 214. 215. 216. 217. 218. 219. 220. 221. 222. 223. 224. 225. 226. 227. 228. 229. 230. 231. 232.
#include <amxmodx>
#include <csgomod>
/** Global Variables **/
new g_maxplayers, g_loteria_num, SayTxT
new cvar_number_max, cvar_reward_ammos_for_win, cvar_bet_ammopacks, cvar_multiplier_ammos_for_win
new g_loteria_usernum[33], g_used[33], g_loteria_userammo[33]
new PlayersNum
/** Plugin Init **/
public plugin_init()
{
// Register Plugin
register_plugin("[ZP] Addon: Lottery", "2.3", "Kiske =D")
// Cvars
cvar_number_max = register_cvar("zp_lot_number_max", "200")
cvar_reward_ammos_for_win = register_cvar("csgo_add_money", "200")
cvar_bet_ammopacks = register_cvar("zp_lot_ammopacks_bet_on", "0")
cvar_multiplier_ammos_for_win = register_cvar("zp_lot_multiplier_ammos_for_win", "3.0")
// Events
register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
// Client Commands
register_clcmd("say /lot", "cmdlot")
register_clcmd("say /lottery", "cmdlot")
register_clcmd("say_team /lot", "cmdlot")
register_clcmd("say_team /lottery", "cmdlot")
register_clcmd("Type_Your_Number", "cmdEnter")
register_clcmd("Type_Your_Ammo_Pack", "cmdEnter")
register_clcmd("Type_Your_Number_For_Ammo_Pack", "cmdEnterNumForAmmo")
// Message IDs
SayTxT = get_user_msgid("SayText")
// Get MaxPlayers
g_maxplayers = get_maxplayers()
// Language files
register_dictionary("test.txt")
}
/** Bet Number **/
public cmdlot(id)
{
PlayersNum = GetAlive()
if(PlayersNum >= 2) // Bug Fix!
{
if(g_used[id])
{
chat_color(id, "%L", id, "ALREADY_BET")
return PLUGIN_HANDLED
}
else
{
if(get_pcvar_num(cvar_bet_ammopacks))
client_cmd(id, "messagemode Wybierz ilosc EURO:")
else
client_cmd(id, "messagemode Wybierz liczbe:")
}
}
else
{
chat_color(id, "%L", id, "LOTTERY_DISABLED")
}
return PLUGIN_HANDLED
}
/** Enter Number **/
public cmdEnter(id)
{
if(get_pcvar_num(cvar_bet_ammopacks))
{
new say[32]
read_args(say, charsmax(say))
remove_quotes(say), trim(say)
new oNum = str_to_num(say)
if(!oNum || oNum > csgo_get_money(id))
{
chat_color(id, "%L", id, "INVALID_AMMOPACK")
return PLUGIN_HANDLED
}
g_loteria_userammo[id] = oNum
chat_color(id, "%L", id, "AMMOPACK_BET", oNum)
client_cmd(id, "messagemode Type_Your_Number_For_Ammo_Pack")
return PLUGIN_CONTINUE
}
else
{
new say[32]
read_args(say, charsmax(say))
remove_quotes(say), trim(say)
new iNum = str_to_num(say)
if(!iNum || iNum >= get_pcvar_num(cvar_number_max))
{
chat_color(id, "%L", id, "INVALID_NUMBER", get_pcvar_num(cvar_number_max))
return PLUGIN_HANDLED
}
g_loteria_usernum[id] = iNum
g_loteria_num = random_num(1, get_pcvar_num(cvar_number_max))
chat_color(id, "%L", id, "NUMBER_BET", iNum)
g_used[id] = true
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}
/** Enter Number For AmmoPack **/
public cmdEnterNumForAmmo(id)
{
new say[32]
read_args(say, charsmax(say))
remove_quotes(say), trim(say)
new aNum = str_to_num(say)
if(!aNum || aNum >= get_pcvar_num(cvar_number_max))
{
chat_color(id, "%L", id, "INVALID_NUMBER", get_pcvar_num(cvar_number_max))
return PLUGIN_HANDLED
}
g_loteria_usernum[id] = aNum
csgo_set_money(id, csgo_get_money(id) - g_loteria_userammo[id])
g_loteria_num = random_num(1, get_pcvar_num(cvar_number_max))
chat_color(id, "%L", id, "NUMBER_BET", aNum)
g_used[id] = true
return PLUGIN_CONTINUE
}
/** Event Round Start **/
public event_round_start()
{
for(new id = 1; id <= g_maxplayers; id++)
{
PlayersNum = GetAlive()
if(PlayersNum >= 2)
{
g_loteria_usernum[id] = 0
g_loteria_userammo[id] = 0
g_used[id] = false
chat_color(id, "%L", id, "LOTTERY_RESET")
chat_color(id, "%L", id, "LOTTERY_RESET2")
}
}
}
/** Round End **/
public zp_round_ended(winteam)
{
PlayersNum = GetAlive()
if(PlayersNum >= 2)
{
for(new id = 1; id <= g_maxplayers; id++)
{
if(g_loteria_usernum[id] == g_loteria_num)
{
new name[32]; get_user_name(id, name, charsmax(name))
if(get_pcvar_num(cvar_bet_ammopacks))
{
set_hudmessage(0, 255, 255, -1.0, 0.40, 1, 0.0, 5.0, 5.0, 1.0, -1)
show_hudmessage(id, "%L", id, "WIN_PLAYER", g_loteria_num, name, g_loteria_userammo[id]*get_pcvar_num(cvar_multiplier_ammos_for_win))
csgo_set_money(id, csgo_get_money(id) + g_loteria_userammo[id]*get_pcvar_num(cvar_multiplier_ammos_for_win))
}
else
{
set_hudmessage(0, 255, 255, -1.0, 0.40, 1, 0.0, 5.0, 5.0, 1.0, -1)
show_hudmessage(id, "%L", id, "WIN_PLAYER", g_loteria_num, name, get_pcvar_num(cvar_reward_ammos_for_win))
csgo_set_money(id, csgo_get_money(id) + get_pcvar_num(cvar_reward_ammos_for_win))
}
}
else
{
set_hudmessage(0, 255, 255, -1.0, 0.40, 1, 0.0, 5.0, 5.0, 1.0, -1)
show_hudmessage(id, "%L", id, "ALL_LOSERS")
}
}
}
}
/** Stocks and Functions **/
// Color Chat!
stock chat_color(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4") // Green Color
replace_all(msg, 190, "!y", "^1") // Default Color
replace_all(msg, 190, "!team", "^3") // Team Color
replace_all(msg, 190, "!team2", "^0") // Team2 Color
if (id) players[0] = id; else get_players(players, count, "ch")
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, SayTxT, _, players[i])
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}
// GetAlive!
GetAlive()
{
new Alive
for (new id = 1; id <= g_maxplayers; id++)
if (is_user_alive(id)) Alive++
return Alive
}
Dodanych wklejek: 13379
Powered By (Pav32) Pastebin © 2011


Dodatki SourceMod


