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 17eb5ufg89two dodana przez Hiroshima, 24.02.2012 15:11
admin_gag
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.
#define VoiceCommMute 1 // 0 = Disabled ( no extra module required ) | 1 = Voicecomm muteing enabled. ( requires engine module) #define BlockNameChange 1 // 0 = Disabled | 1 = Block namechange on gagged clients #define LogAdminActions 1 // 0 = Disabled | 1 = Admin actions will be logged #define DefaultGagTime 600.0 // The std gag time if no other time was entered. ( this is 10 min ), Remember the value MUST contain a .0 #define PlaySound 1 // 0 = Disabled | 1 = Play a sound to gagged clients when their trying to talk #define GagReason 1 // 0 = Disabled | 1 = Gagged clients can see why there where gagged when they try to talk #define MaxPlayers 32 #define AllowOtherPlugin2Interface 1 #include <amxmodx> #include <amxmisc> #include <engine> new g_GagPlayers[MaxPlayers+1] // Used to check if a player is gagged #if GagReason == 1 new gs_GagReason[MaxPlayers+1][48] #endif public plugin_init() { register_plugin("Admin Gag","1.8.3","EKS") register_clcmd("say","block_gagged") register_clcmd("say_team","block_gagged") register_concmd("amx_gag","CMD_GagPlayer",ADMIN_KICK,"<nick or #userid> <a|b|c> <time>") register_concmd("amx_ungag","CMD_UnGagPlayer",ADMIN_KICK,"<nick or #userid>") } public block_gagged(id){ // This function is what check the say / team_say messages & block them if the client is blocked. if(!g_GagPlayers[id]) return PLUGIN_CONTINUE // Is true if the client is NOT blocked. new cmd[5] read_argv(0,cmd,4) if ( cmd[3] == '_' ) { if (g_GagPlayers[id] & 2){ #if GagReason == 1 client_print(id,print_chat,"* Dostaliscie mute dla twoich przyjacieli: %s",gs_GagReason[id]) #else client_print(id,print_chat,"* Dostałes Mute") #endif #if PlaySound == 1 client_cmd(id,"spk barney/youtalkmuch") #endif return PLUGIN_HANDLED } } else if (g_GagPlayers[id] & 1) { #if GagReason == 1 client_print(id,print_chat,"* Dostaliscie mute dla twoich przyjacieli: %s",gs_GagReason[id]) #else client_print(id,print_chat,"* Dostales Mute") #endif #if PlaySound == 1 client_cmd(id,"spk barney/youtalkmuch") #endif return PLUGIN_HANDLED } return PLUGIN_CONTINUE } public CMD_GagPlayer(id,level,cid) { if(!cmd_access (id,level,cid,1)) return PLUGIN_HANDLED new arg[32],VictimID read_argv(1,arg,31) // Arg contains Targets nick or Userid VictimID = cmd_target(id,arg,8) // This code here tryes to find out the player index. Either from a nick or #userid if ((get_user_flags(VictimID) & ADMIN_IMMUNITY) && VictimID != id || !cmd_access (id,level,cid,2) ) { return PLUGIN_HANDLED; } // This code is kind of "long", its job is to. Stop actions against admins with immunity, Stop actions action if the user lacks access, or is a bot/hltv new s_Flags[4],VictimName[32],AdminName[32],flags,ShowFlags[32],CountFlags,s_GagTime[8],Float:f_GagTime read_argv(2,arg,31) if (!arg[0]) // This means amx_gag <nick / userid> and no other flag or time was used. { f_GagTime = DefaultGagTime format(s_Flags,7,"abc") } else { if(contain(arg,"m")!=-1 && contain(arg,"!")==-1) // This means the time was entered in minuts and not seconds { copyc(s_GagTime,7,arg, 'm') f_GagTime = floatstr(s_GagTime) * 60 } else if(isdigit(arg[0])&& contain(arg,"!")==-1) // The value was entered in seconds { format(s_GagTime,7,arg) f_GagTime = floatstr(s_GagTime) } read_argv(3,arg,8) if (!arg[0]) // No flag has been entered format(s_Flags,7,"abc") else if(contain(arg,"!")==-1) // This means that arg did NOT contain the ! symbot format(s_Flags,7,arg) else if(contain(arg,"!")!=-1) // This means that arg did DOES contain the ! symbot format(s_Flags,7,"abc") if (f_GagTime == 0.0) { read_argv(2,arg,8) if(contain(arg,"!")!=-1) format(s_Flags,3,"abc") // Flag was entered. else format(s_Flags,3,arg) // Flag was entered. f_GagTime = DefaultGagTime } #if GagReason == 1 new GagReasonFound=0 for(new i=2;i<=4;i++) { read_argv(i,arg,31) if(contain(arg,"!")!=-1) { read_args(arg,31) new tmp[32] copyc(tmp,32,arg,33) copy(gs_GagReason[VictimID],47,arg[strlen(tmp)+1]) GagReasonFound = 1 } } if(GagReasonFound == 0) // If no reason was entered, add the std reason. format(gs_GagReason[VictimID],47,"Dostaliscie mute za zlamanie zasad") #endif } flags = read_flags(s_Flags) // Converts the string flags ( a,b or c ) into a int g_GagPlayers[VictimID] = flags #if VoiceCommMute == 1 if(flags & 4) // This code checks if the c flag was used ( reprisented by the number 4 ), If pressent it mutes his voicecomm. set_speak(VictimID, SPEAK_MUTED) #endif new TaskParm[1] // For some reason set_task requires a array. So i make a array :) TaskParm[0] = VictimID set_task( f_GagTime,"task_UnGagPlayer",VictimID,TaskParm,1) CountFlags = 0 if (flags & 1) { format(ShowFlags,31,"say") CountFlags++ } if (flags & 2) { if(CountFlags) format(ShowFlags,31,"%s / say_team",ShowFlags) if(!CountFlags) format(ShowFlags,31,"say_team") } #if VoiceCommMute != 0 if(flags & 4) { if(CountFlags) format(ShowFlags,31,"%s / voicecomm",ShowFlags) if(!CountFlags) format(ShowFlags,31,"voicecomm") } #endif get_user_name(id,AdminName,31) get_user_name(VictimID,VictimName,31) switch(get_cvar_num("amx_show_activity")) { #if GagReason == 1 case 2: client_print(0,print_chat,"ADMIN %s: Dal Mute %s na rozmawianie przez %0.0f Minut, For: %s ( %s )",AdminName,VictimName,(f_GagTime / 60),gs_GagReason[VictimID],ShowFlags) // debug added case 1: client_print(0,print_chat,"ADMIN: Dal mute %s na rozmawianie przez %0.0f Minut, For: %s ( %s )",VictimName,(f_GagTime / 60),gs_GagReason[VictimID],ShowFlags) #else case 2: client_print(0,print_chat,"ADMIN %s: Dal Mute %s na rozmawianie przez %0.0f Minut ( %s )",AdminName,VictimName,(f_GagTime / 60),ShowFlags) // debug added case 1: client_print(0,print_chat,"ADMIN: Dal mute %s na rozmaianie przez %0.0f Minut ( %s )",VictimName,(f_GagTime / 60),ShowFlags) #endif } #if LogAdminActions == 1 new parm[5] /*0 = Ofiara id | 1 = Admin id | 2 = uzywamy panelu kontrolnego jezeli dajemy Mute lub unMute | 3 = Flagi Mute | 4 = Dlugosc tego Mute */ parm[0] = VictimID parm[1] = id parm[2] = 0 parm[3] = flags parm[4] = floatround(Float:f_GagTime) LogAdminAction(parm) #endif return PLUGIN_HANDLED } public CMD_UnGagPlayer(id,level,cid) /// Removed gagged player ( done via console command ) { new arg[32],VictimID read_argv(1,arg,31) // Arg contains Targets nick VictimID = cmd_target(id,arg,8) // This code here tryes to find out the player index. Either from a nick or #userid if ((get_user_flags(VictimID) & ADMIN_IMMUNITY) && VictimID != id || !cmd_access (id,level,cid,2) ) { return PLUGIN_HANDLED; } // This code is kind of "long", its job is to. Stop actions against admins with immunity, Stop actions action if the user lacks access, or is a bot/hltv new AdminName[32],VictimName[32] get_user_name(id,AdminName,31) // Gets Admin name get_user_name(VictimID,VictimName,31) if(!g_GagPlayers[VictimID]) // Checks if player has gagged flag { console_print(id,"%s Nie ma Mute & moze nie jest od Mutowany.",arg) return PLUGIN_HANDLED } switch(get_cvar_num("amx_show_activity")) { case 2: client_print(0,print_chat,"ADMIN %s: Zdjal Mute %s",AdminName,VictimName) case 1: client_print(0,print_chat,"ADMIN: Zdjal Mute %s",VictimName) } #if LogAdminActions == 1 new parm[3] /*0 = Ofiara id | 1 = Admin id | 2 = uzywamy panelu kontrolnego jezeli dajemy Mute lub unMute| 3 = Flagi mute | 4 = Dlugosc tego mute */ parm[0] = VictimID parm[1] = id parm[2] = 1 LogAdminAction(parm) #endif remove_task(VictimID) // Removes the set_task set to ungag the player UnGagPlayer(VictimID) // This is the function that does the actual removal of the gag info return PLUGIN_HANDLED } public client_disconnect(id) { if(g_GagPlayers[id]) // Checks if disconnected player is gagged, and removes flags from his id. { new Nick[32],Authid[35] get_user_name(id,Nick,31) get_user_authid(id,Authid,34) client_print(0,print_chat,"[AMX] Mute Graczy jest Wylaczone ( %s <%s> )",Nick,Authid) remove_task(id) // Removes the set_task set to ungag the player UnGagPlayer(id) // This is the function that does the actual removal of the gag info } } #if BlockNameChange == 1 public client_infochanged(id) { if(g_GagPlayers[id]) { new newname[32], oldname[32] get_user_info(id, "name", newname,31) get_user_name(id,oldname,31) if (!equal(oldname,newname)) { client_print(id,print_chat,"* Mutowani Klienci nie moga zmienić nazwy") set_user_info(id,"name",oldname) } } } #endif public task_UnGagPlayer(TaskParm[]) // This function is called when the task expires { new VictimName[32] get_user_name(TaskParm[0],VictimName,31) client_print(0,print_chat,"ADMIN: %s jest juz nie mutowany",VictimName) UnGagPlayer(TaskParm[0]) } #if LogAdminActions == 1 stock LogAdminAction(parm[]) // This code is what logs the admin actions. { new VictimName[32],AdminName[32],AdminAuth[35],VictimAuth[35] get_user_name(parm[1],AdminName,31) get_user_name(parm[0],VictimName,31) get_user_authid(parm[1],AdminAuth,34) get_user_authid(parm[0],VictimAuth,34) #if GagReason == 1 if(parm[2] == 0) log_amx("Gag: ^"%s<%s>^" ma Mute %s <%s> dla %d ( %d ) Reason: %s",AdminName,AdminAuth,VictimName,VictimAuth,parm[4],parm[3],gs_GagReason[parm[0]]) #else if(parm[2] == 0) log_amx("Gag: ^"%s<%s>^" ma Mute %s <%s> dla %d ( %d )",AdminName,AdminAuth,VictimName,VictimAuth,parm[4],parm[3]) #endif if(parm[2] == 1) log_amx("UnGag: ^"%s<%s>^" nie ma Mute %s<%s>",AdminName,AdminAuth,VictimName,VictimAuth) } #endif stock UnGagPlayer(id) // This code is what removes the gag. { #if VoiceCommMute == 1 if(g_GagPlayers[id] & 4) // Unmutes the player if he had voicecomm muted. { if(get_cvar_num("sv_alltalk") == 1) set_speak(id, SPEAK_ALL) else set_speak(id, SPEAK_NORMAL) } #endif g_GagPlayers[id] = 0 #if GagReason == 1 setc(gs_GagReason[id],31,0) #endif } #if AllowOtherPlugin2Interface == 1 public func_AddGag(id) { g_GagPlayers[id] = 7 new TaskParm[1] // For some reason set_task requires a array. So i make a array :) TaskParm[0] = id #if VoiceCommMute == 1 set_speak(id, SPEAK_MUTED) #endif set_task( DefaultGagTime,"task_UnGagPlayer",id,TaskParm,1) } public func_RemoveGag(id) { remove_task(id) // Removes the set_task set to ungag the player UnGagPlayer(id) } #endif
Dodanych wklejek: 4031
Powered By (Pav32) Pastebin © 2011