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 2e2fvaav0131 dodana przez patryQ1997, 30.09.2014 19:10
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. 306. 307. 308. 309. 310. 311. 312. 313. 314. 315. 316. 317. 318. 319. 320. 321. 322. 323. 324. 325. 326. 327. 328. 329. 330. 331. 332. 333. 334. 335. 336. 337. 338. 339. 340. 341. 342. 343. 344. 345. 346. 347. 348. 349. 350. 351. 352. 353. 354. 355. 356. 357. 358. 359. 360. 361. 362. 363. 364. 365. 366. 367. 368. 369. 370. 371. 372. 373. 374. 375. 376. 377. 378. 379. 380. 381. 382. 383. 384. 385. 386. 387. 388. 389. 390.
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <tutor> #include <colorchat> #define PLUGIN "RoundSound" #define VERSION "2.0 BETA" #define AUTHOR "speedkill" new Array:g_PathCT, Array:g_PathTT, Array:g_SoundNameCT, Array:g_SoundNameTT; new bool:g_RoundSound[33], bool:g_ShowAds[33], bool:g_FirstPlay, bool:g_MusicPlaying; new g_LastSong[96], g_Prefix[64], g_ShowInfo[33], g_ArraySize[4], g_Pcvar[4], g_ValueTeam[2], g_ShowType, g_MaxPlayers, g_PlaylistType, g_RandomMusic; new const g_ShowNames[][]={ "Brak", "Tutor", "Czat" }; new const g_CvarName[][]={ "Roundsound_ads_time", "Roundsound_prefix", "Roundsound_random_music", "Roundsound_show_type" }; new const g_CvarValue[][]={ "0", "", "0", "1" }; new const g_LangCmd[][]={ "say /roundsound", "say_team /roundsound" }; new const g_LastLangCmd[][]={ "say /last", "say_team /last" }; enum{ Chat_Msg = 1, Tutor_Msg }; public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR); for(new i = 0; i < sizeof g_LangCmd; i++){ register_clcmd(g_LangCmd[i], "ShowRsMenu"); } for(new i = 0; i < sizeof g_LastLangCmd; i++){ register_clcmd(g_LastLangCmd[i], "ShowLastSong"); } register_event("SendAudio", "PlaySoundTT", "a", "2&%!MRAD_terwin"); register_event("SendAudio", "PlaySoundCT", "a", "2&%!MRAD_ctwin"); register_logevent("RoundStart", 2, "1=Round_Start"); tutorInit(); for(new i = 0; i < sizeof g_CvarName; i++){ g_Pcvar[i] = register_cvar(g_CvarName[i], g_CvarValue[i]); } } public plugin_precache(){ g_PathCT = ArrayCreate(128); g_PathTT = ArrayCreate(128); g_SoundNameCT = ArrayCreate(96); g_SoundNameTT = ArrayCreate(96); LoadSounds(); tutorPrecache(); } public plugin_cfg(){ get_pcvar_string(g_Pcvar[1], g_Prefix, charsmax(g_Prefix)); g_ShowType = get_pcvar_num(g_Pcvar[3]); g_RandomMusic = get_cvar_num(g_Pcvar[2]); g_MaxPlayers = get_maxplayers(); g_ValueTeam[0] = g_ValueTeam[1] = -1; } public client_authorized(id){ g_RoundSound[id] = true; g_ShowAds[id] = true; g_ShowInfo[id] = g_ShowType; } public LoadSounds(){ new g_Path[128]; formatex(g_Path[ get_configsdir(g_Path, charsmax(g_Path)) ], charsmax(g_Path), "/RoundSound.ini"); if(file_exists(g_Path)){ new g_Line[256], g_SoundPath[128], g_Name[96], g_Team[3], g_Len; for(new i = 0; read_file(g_Path, i, g_Line, charsmax(g_Line), g_Len); i++){ if(!g_Len || !g_Line[0] || g_Line[0] == ';'){ continue; } parse(g_Line, g_SoundPath, charsmax(g_SoundPath), g_Name, charsmax(g_Name), g_Team, charsmax(g_Team)); new g_Value = strlen(g_SoundPath) - 4; log_amx("Path: %s | Title: %s | Team: %s | Format: %s", g_SoundPath, g_Name, g_Team, g_SoundPath[ g_Value ]); if(equal(g_SoundPath[ g_Value ], ".mp3") || equal(g_SoundPath[ g_Value ], ".wav")){ if(equal(g_SoundPath[ g_Value ], ".mp3")){ format(g_SoundPath, charsmax(g_SoundPath), "sound/%s", g_SoundPath); precache_generic(g_SoundPath); } else{ precache_sound(g_SoundPath); } /* Check team */ if(equal(g_Team, "CT")){ ArrayPushString(g_PathCT, g_SoundPath); ArrayPushString(g_SoundNameCT, g_Name); } else if(equal(g_Team, "TT")){ ArrayPushString(g_PathTT, g_SoundPath); ArrayPushString(g_SoundNameTT, g_Name); } log_amx("File %s has a good format", g_SoundPath); } else{ log_amx("File %s has a bad format", g_SoundPath); } } } else{ /* Houston, We've Got a Problem. */ set_fail_state("File RoundSound.ini not exist in configs/"); } GetArraySize(); } public GetArraySize(){ g_ArraySize[0] = ArraySize(g_PathCT); g_ArraySize[1] = ArraySize(g_PathTT); g_ArraySize[2] = ArraySize(g_SoundNameCT); g_ArraySize[3] = ArraySize(g_SoundNameTT); } public ShowRsMenu(id){ new g_FormatText[64]; new g_Menu = menu_create("wUstawienia RoundSound", "MenuChoose"); formatex(g_FormatText, charsmax(g_FormatText), "yRoundsound: y[d%sy]", g_RoundSound[id] ? "ON" : "OFF"); menu_additem(g_Menu, g_FormatText); menu_additem(g_Menu, "yOdsluchaj utwory CT y[dPlaylistay]"); menu_additem(g_Menu, "yOdsluchaj utwory TT y[dPlaylistay]"); menu_setprop(g_Menu, MPROP_EXITNAME, "Wyjscie"); menu_display(id, g_Menu); } public MenuChoose(id, g_Menu, g_Item){ if(g_Item == MENU_EXIT){ menu_destroy(g_Menu); return PLUGIN_HANDLED; } switch(g_Item){ case 0:{ g_RoundSound[id] = !g_RoundSound[id]; ColorChat(id, GREEN, "de_dust2^x01 # Roundsound zostal^x03 %s^x01.", g_RoundSound[id] ? "wlaczony" : "wylaczony"); ShowRsMenu(id); } case 1..2:{ ShowPlaylist(id, g_Item); } } menu_destroy(g_Menu); return PLUGIN_HANDLED; } public ShowPlaylist(id, g_Type){ new g_FormatText[64], g_Name[96]; formatex(g_FormatText, charsmax(g_FormatText), "Playlista d%s", g_Type == 1 ? "CT" : "TT"); new g_Menu = menu_create(g_FormatText, "PlaylistChoose"); switch(g_Type){ case 1:{ for(new g_Item = 0; g_Item < g_ArraySize[2]; g_Item++){ ArrayGetString(g_SoundNameCT, g_Item, g_Name, charsmax(g_Name)); menu_additem(g_Menu, g_Name); } } case 2:{ for(new g_Item = 0; g_Item < g_ArraySize[3]; g_Item++){ ArrayGetString(g_SoundNameTT, g_Item, g_Name, charsmax(g_Name)); menu_additem(g_Menu, g_Name); } } } g_PlaylistType = g_Type; menu_setprop(g_Menu, MPROP_BACKNAME, "Powrot"); menu_setprop(g_Menu, MPROP_NEXTNAME, "Dalej"); menu_setprop(g_Menu, MPROP_EXITNAME, "Wyjscie"); menu_setprop(g_Menu, MPROP_NUMBER_COLOR, "r"); menu_display(id, g_Menu); } public PlaylistChoose(id, g_Menu, g_Item){ if(g_Item == MENU_EXIT){ menu_destroy(g_Menu); return PLUGIN_HANDLED; } new g_SoundPath[128]; ArrayGetString(g_PlaylistType == 1 ? g_PathCT : g_PathTT, g_Item, g_SoundPath, charsmax(g_SoundPath)); new g_Format = strlen(g_SoundPath) - 4; if(equal(g_SoundPath[ g_Format ], ".mp3")){ client_cmd(id, "mp3 play %s", g_SoundPath); } else{ client_cmd(id, "spk %s", g_SoundPath); } ShowPlaylist(id, g_PlaylistType); return PLUGIN_CONTINUE; } public ShowLastSong(id){ if(g_FirstPlay){ ShowColorMsg(id, "de_dust2^x01 # Ostani utwor: %s", g_LastSong); } else{ ColorChat(id, GREEN, "de_dust2^x01 # Nie zostala odegrana^x03 zadna piosenka^x01."); } } public RoundStart(){ g_MusicPlaying = false; } public PlaySoundTT(){ CheckMusic(1); } public PlaySoundCT(){ CheckMusic(2); } public CheckMusic(g_Type){ if(!g_MusicPlaying){ RandMusic(g_Type); g_MusicPlaying = true; } } public RandMusic(g_Type){ if(!g_FirstPlay){ g_FirstPlay = true; } new g_SoundPath[128], g_SoundName[128], g_Name[96], g_Format, g_FileFormat; switch(g_Type){ case 1:{ if(g_RandomMusic){ g_ValueTeam[0] = random(g_ArraySize[1]); } else{ g_ValueTeam[0]++; if(g_ValueTeam[0] >= g_ArraySize[1]){ g_ValueTeam[0] = 0; } } ArrayGetString(g_PathTT, g_ValueTeam[0], g_SoundPath, charsmax(g_SoundPath)); ArrayGetString(g_SoundNameTT, g_ValueTeam[0], g_Name, charsmax(g_Name)); } case 2:{ if(g_RandomMusic){ g_ValueTeam[1] = random(g_ArraySize[0]); } else{ g_ValueTeam[1]++; if(g_ValueTeam[1] >= g_ArraySize[0]){ g_ValueTeam[1] = 0; } } ArrayGetString(g_PathCT, g_ValueTeam[1], g_SoundPath, charsmax(g_SoundPath)); ArrayGetString(g_SoundNameCT, g_ValueTeam[1], g_Name, charsmax(g_Name)); } } /* if(equal(g_LastSoundPath, g_SoundPath)){ RandMusic(g_Type); return PLUGIN_HANDLED; } */ copy(g_LastSong, charsmax(g_LastSong), g_Name); g_Format = strlen(g_SoundPath) - 4; if(equal(g_SoundPath[ g_Format ], ".mp3")){ g_FileFormat = 1; } else{ g_FileFormat = 2; } if(g_RoundSound[id]){ replace(g_Name, sizeof(g_Name), "-", "^x01 -"); ColorChat(0, GREEN, "de_dust2^x01 # Teraz gramy: ^x03 %s", g_Name); } for(new i = 1; i <= g_MaxPlayers; i++){ if(is_user_connected(i) && g_RoundSound[i]){ switch(g_FileFormat){ case 1:{ client_cmd(i, "mp3 play %s", g_SoundPath); } case 2:{ client_cmd(i, "spk %s", g_SoundPath); } } switch(g_ShowInfo[i]){ case Tutor_Msg:{ tutorMake(i, TUTOR_GREEN, 10.0, g_SoundName); } } } } return PLUGIN_CONTINUE; } public plugin_end(){ ArrayDestroy(g_PathCT); ArrayDestroy(g_PathTT); ArrayDestroy(g_SoundNameCT); ArrayDestroy(g_SoundNameTT); }
Dodanych wklejek: 11179
Powered By (Pav32) Pastebin © 2011