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 uilqa6orpj4 dodana przez Kawon, 23.11.2012 22:04
ssban
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. 233. 234. 235. 236. 237. 238. 239. 240. 241. 242. 243. 244. 245. 246. 247. 248. 249. 250. 251. 252. 253. 254. 255. 256. 257. 258. 259. 260. 261. 262. 263. 264. 265. 266. 267. 268. 269. 270. 271. 272. 273. 274. 275. 276. 277. 278. 279. 280. 281. 282. 283. 284. 285. 286. 287. 288. 289. 290. 291. 292. 293. 294. 295. 296. 297. 298. 299. 300. 301. 302. 303. 304. 305.
#include <amxmodx> #include <amxmisc> #include <fakemeta> #include <sqlx> #include "include/amxbans/color_chat.inl" #define PLUGIN "AMXBans: Screens" #define VERSION "Gm 1.6" #define AUTHOR "Larte Team" #define PREFIX "!y[!tAMXBans!y]" new victim new CvarMaxss new CvarInterval new CvarTimestamptype new CvarHUDText new CvarBanTime new CvarBanReason new CountMenu new CvarCountScreens new g_max_players new g_user_ids[33] new g_player[33] new screeny[33] new Handle:g_SqlTuple public plugin_init () { register_plugin(PLUGIN, VERSION, AUTHOR) register_dictionary("amxbans_ssban.txt") register_clcmd("amx_ssban", "cmdScreen", ADMIN_BAN, "<authid, nick or #userid> <count of screens>") register_clcmd("amx_ssbanmenu", "cmdScreenMenu", ADMIN_BAN, " - display screens menu") CvarMaxss = register_cvar("amx_maxscreens", "10") CvarInterval = register_cvar("amx_interval", "1.0") CvarTimestamptype = register_cvar("amx_stamptype", "3") CvarHUDText = register_cvar("amx_hudtext", "Cheese! :)") CvarCountScreens = register_cvar("amx_screenscount", "1 2 3 4 5 6 7 8 9") CvarBanTime = register_cvar("amx_ssbantime", "0") CvarBanReason = register_cvar("amx_ssbanreason", "Screens, go gm-community.net") register_cvar("amxbans_ssversion", VERSION, FCVAR_SERVER | FCVAR_SPONLY) g_max_players = get_maxplayers() color_chat_init() new configsDir[64] get_configsdir(configsDir, 63) register_cvar("amx_sql_host", "127.0.0.1") register_cvar("amx_sql_user", "root") register_cvar("amx_sql_pass", "") register_cvar("amx_sql_db", "amx") server_cmd("exec %s/amxbans-ssban.cfg", configsDir) return server_cmd("exec %s/sql.cfg", configsDir) } public plugin_cfg() { sql_connect() new line[128], token[10] get_pcvar_string(CvarCountScreens, line, 127) new stemp[128] formatex(stemp, 127, "%L", LANG_SERVER, "SS_MENU_COUNT_HEADER") CountMenu = menu_create(stemp, "CountScreensMenu") while(contain (line, " ") != -1) { strbreak(line, token, 9, line, 127) formatex(stemp, 127, "%L", LANG_SERVER, "SS_MAKE_X_SCREENS", token) menu_additem(CountMenu, stemp, token) } formatex(stemp, 127, "%L", LANG_SERVER, "SS_MORE") menu_setprop(CountMenu, MPROP_NEXTNAME, stemp) formatex(stemp, 127, "%L", LANG_SERVER, "SS_BACK") menu_setprop(CountMenu, MPROP_BACKNAME, stemp) formatex(stemp, 127, "%L", LANG_SERVER, "SS_EXIT") menu_setprop(CountMenu, MPROP_EXITNAME, stemp) return set_task(5.0, "add_menu") } public sql_connect() { new Host[32], User[32], Pass[32], DB[32] get_cvar_string("amx_sql_host", Host, charsmax(Host)) get_cvar_string("amx_sql_user", User, charsmax(User)) get_cvar_string("amx_sql_pass", Pass, charsmax(Pass)) get_cvar_string("amx_sql_db", DB, charsmax(DB)) g_SqlTuple = SQL_MakeDbTuple(Host,User,Pass,DB) new error, szError[128] new Handle:hConn = SQL_Connect(g_SqlTuple,error,szError,charsmax(szError)) if(error) { log_amx("Error: %s", szError) return } new Handle:Queries = SQL_PrepareQuery(hConn,"CREATE TABLE IF NOT EXISTS `Screeny`(id int(12) NULL auto_increment, nick VARCHAR(64) NOT NULL, data VARCHAR(32) NOT NULL, admin_name VARCHAR(64) NOT NULL, mapa VARCHAR(32) NOT NULL, ip_player VARCHAR(32) NOT NULL,servers VARCHAR(32) NOT NULL, screens INT(11) NOT NULL DEFAULT 0, PRIMARY KEY(id))") SQL_Execute(Queries) SQL_FreeHandle(Queries) SQL_FreeHandle(hConn) } public add_menu() { new stemp[128] formatex(stemp, 127, "%L", LANG_SERVER, "SS_MENU_NAME") AddMenuItem(stemp, "amx_ssbanmenu", ADMIN_BAN, "AMXBans: Screens") return PLUGIN_CONTINUE } public cmdScreenMenu(id, level, cid) { if(!cmd_access(id, level, cid, 1)) { return PLUGIN_HANDLED } new stemp[128] formatex(stemp, 127, "%L", LANG_SERVER, "SS_MENU_PLAYER_HEADER") new menu = menu_create(stemp, "PlayersMenu") new i, name[32], tempid[10] for(i = 1; i <= g_max_players; i++) { if(is_user_connected(i)) { get_user_name(i, name, 31) num_to_str(i, tempid, 9) g_user_ids[i] = get_user_userid(i) menu_additem(menu, name, tempid, 0) } } formatex(stemp, 127, "%L", LANG_SERVER, "SS_MORE") menu_setprop(menu, MPROP_NEXTNAME, stemp) formatex(stemp, 127, "%L", LANG_SERVER, "SS_BACK") menu_setprop(menu, MPROP_BACKNAME, stemp) formatex(stemp, 127, "%L", LANG_SERVER, "SS_EXIT") menu_setprop(menu, MPROP_EXITNAME, stemp) return menu_display (id, menu, 0) } public PlayersMenu(id, menu, item) { if(item == MENU_EXIT) { return PLUGIN_HANDLED } new data[6], iName[64] new access, callback menu_item_getinfo(menu, item, access, data, 5, iName, 63, callback) g_player[id] = str_to_num (data) menu_display(id, CountMenu, 0) return PLUGIN_HANDLED } public CountScreensMenu(id, menu, item) { if(item == MENU_EXIT) { return PLUGIN_HANDLED } new data[6], iName[64] new access, callback new player = g_player[id] menu_item_getinfo(menu, item, access, data, 5, iName, 63, callback) if(g_user_ids[player] == get_user_userid(player)) { client_cmd(id, "amx_ssban #%d %s", g_user_ids[player], data) } return PLUGIN_HANDLED } public cmdScreen(id, level, cid) { if(!cmd_access(id, level, cid, 3)) { return PLUGIN_HANDLED } new arg1[24], arg2[4] read_argv(1, arg1, 23) read_argv(2, arg2, 3) new screens = str_to_num(arg2) victim = cmd_target(id, arg1, 1) if(!victim) { return PLUGIN_HANDLED } if(screens > get_pcvar_num(CvarMaxss)) { console_print(id, "%L", id, "SS_COUNT_NO") return PLUGIN_HANDLED } screeny[victim] = screens new Float:interval = get_pcvar_float(CvarInterval) new array[2] array[0] = id array[1] = victim set_task(interval, "takeScreen", 0, array, 2, "a", screens) set_task(interval * float(screens) + 1.0, "victimBan", _, array, 2) return PLUGIN_HANDLED } public takeScreen(array[2]) { new victim = array[1] new id = array[0] new timestamp[32], HUDText[32], name[32], adminname[32],admin_ip[32], player_ip[32], map[32] get_time("%d.%m.%Y - %H:%M:%S", timestamp, 31) get_user_name(victim, name, 31) get_user_name(id, adminname, 31) get_user_ip(id, admin_ip, charsmax(admin_ip)) get_user_ip(victim,player_ip, 31) get_mapname(map,charsmax(map)) get_pcvar_string(CvarHUDText, HUDText, 31) switch(get_pcvar_num(CvarTimestamptype)) { case 0: { ColorChat(id, RED, "%s %L", PREFIX, id, "SS_CHAT_INFO", name, adminname) client_cmd(victim, "snapshot") } case 1: { ColorChat(id, RED, "%s %L", PREFIX, id, "SS_CHAT_INFO2", name, adminname, timestamp) client_cmd(victim, "snapshot") } case 2: { set_hudmessage(225, 225, 225, 0.02, 0.90, 0, 1.0, 2.0) show_hudmessage(victim, HUDText) client_cmd(victim, "snapshot") } case 3: { set_hudmessage(225, 225, 225, 0.02, 0.90, 0, 1.0, 2.0) show_hudmessage(victim, HUDText) ColorChat(id, RED, "%s %L", PREFIX, id, "SS_CHAT_INFO2", name, adminname, timestamp) client_cmd(victim, "snapshot") } } return PLUGIN_CONTINUE } public victimBan(array[2]) { new timestamp[32],name[32],adminname[32],steam_id[32],player_ip[32],map[32],szTemp[512],hostname[32] new victim = array[1] new id = array[0] get_cvar_string("hostname", hostname, 31); get_time("%d.%m.%Y - %H:%M:%S", timestamp,charsmax(timestamp)) get_user_name(victim, name, 31) get_user_name(id, adminname,charsmax(adminname)) get_user_authid(victim,steam_id,charsmax(steam_id)) get_user_ip(victim,player_ip, 31) get_mapname(map,charsmax(map)) formatex(szTemp,charsmax(szTemp),"INSERT INTO `Screeny` (`id`,`nick`,`admin_name`,`data`,`mapa`,`ip_player`,`servers`,`screens`) VALUES ('','%s','%s','%s','%s','%s','%s','%d')",name,adminname,timestamp,map,player_ip,hostname,screeny[victim]) SQL_ThreadQuery(g_SqlTuple, "IgnoreHandle", szTemp) new Reason[50] new victimId = get_user_userid(array[1]) get_pcvar_string(CvarBanReason, Reason, 32) return client_cmd(array[0], "amx_ban %d #%d %s", get_pcvar_num(CvarBanTime), victimId, Reason) } public client_authorized(id) { screeny[id] = 0 } public IgnoreHandle(failstate, Handle:query, error[], errnum) { if(failstate != TQUERY_SUCCESS) { log_amx("<Query> Error: %s", error) return } }
Dodanych wklejek: 12215
Powered By (Pav32) Pastebin © 2011