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 3uwn5zi85i3z dodana przez freetu, 21.09.2013 23:26
cod_magazyn_
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. 391. 392. 393. 394. 395. 396. 397. 398. 399. 400. 401. 402. 403. 404. 405. 406. 407. 408. 409. 410. 411. 412. 413. 414. 415. 416. 417. 418. 419. 420. 421. 422. 423. 424. 425. 426. 427. 428. 429. 430. 431.
/* Script generated by Pawn Studio */ #include <amxmodx> #include <amxmisc> #include <colorchat> #include <nvault> #define PLUGIN "[CoD] Magazyn na perki" #define AUTHOR "Goliath" #define VERSION "2.2" /************************************* * KONFIGURACJA PLUGINU * **************************************/ /******************************** Zmieñ 32 na iloæ slotów na twoim serwerze *********************************/ #define MAX_PLAYERS 6 /******************************** Je¿eli u¿ywasz pluginu na wytrzyma³oæ perków, zmieñ poni¿sz¹ linijkê na: #define WYTRZYMALOSC Je¿eli nie, zmieñ j¹ na: //define WYTRZYMALOSC *********************************/ #define WYTRZYMALOSC /******************************** Je¿eli chcesz, aby perki w magazynie przechodzi³y na nastêpn¹ mapê, zmieñ poni¿sz¹ linijkê na: #define ZAPISUJ Je¿eli nie, zmieñ j¹ na: //define ZAPISUJ *********************************/ #define ZAPISUJ /******************************** Tutaj zmieñ 3 na iloæ slotów, jak¹ chcesz mieæ w magazynie. *********************************/ #define ILOSC_SLOTOW 3 /* UWAGA! * * Po jakiejkolwiek zmianie w konfiguracji * * musisz ponownie skompilowaæ plugin! * */ /************************************* * KONIEC KONFIGURACJI * **************************************/ native cod_get_user_perk(id, &wartosc=0); native cod_get_perk_name(perk, Return[], len); native cod_set_user_perk(id, perk, wartosc=-1, pokaz_info=1); native cod_get_perkid(const perk[]); #if defined WYTRZYMALOSC native cod_set_perk_durability(id, set); native cod_get_perk_durability(id); new cvar_max_wytrzymalosc, Array:aWytrzymalosc, max_wytrzymalosc; #endif new Array:aPerki, Array:aWartosc; new Uzyto[MAX_PLAYERS+1]; #if defined ZAPISUJ new cvar_typ_zapisu, typ_zapisu; new vault; #endif #if ILOSC_SLOTOW <= 0 #error Podano b³êdn¹ iloæ slotów w magazynie! #endif #if MAX_PLAYERS <= 0 || MAX_PLAYERS > 32 #error Podano b³êdn¹ iloæ slotów na serwerze! #endif public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) aPerki = ArrayCreate(); aWartosc = ArrayCreate(); #if defined WYTRZYMALOSC aWytrzymalosc = ArrayCreate(); cvar_max_wytrzymalosc = get_cvar_pointer("cod_maxperkdurability"); max_wytrzymalosc = get_pcvar_num(cvar_max_wytrzymalosc); #endif #if defined ZAPISUJ cvar_typ_zapisu = get_cvar_pointer("cod_savetype"); typ_zapisu = get_pcvar_num(cvar_typ_zapisu); vault = nvault_open("CodMagazyn"); #endif register_clcmd("say /magazyn", "Magazyn"); register_event("HLTV", "NowaRunda", "a", "1=0", "2=0"); for(new i=0; i<=ILOSC_SLOTOW; i++) { for(new id=0; id<=MAX_PLAYERS; id++) { ArrayPushCell(aPerki, 0); ArrayPushCell(aWartosc, -1); #if defined WYTRZYMALOSC ArrayPushCell(aWytrzymalosc, 0); #endif } } } public Magazyn(id) { if(!is_user_alive(id)) { client_print(id, print_chat, "[COD:MW] Musisz byc zywy!"); return 0; } #if defined ZAPISUJ Wczytaj(id); #endif new menu = menu_create("yMagazyn na perki dby rGoliath", "Magazyn_Handler"); new text[33], perk; for(new i=1; i<=ILOSC_SLOTOW; i++) { perk = ArrayGetCell(aPerki, id*ILOSC_SLOTOW+i) if(!perk) formatex(text, 32, "Pusty slot"); else { #if defined WYTRZYMALOSC cod_get_perk_name(perk, text, 32); format(text, 32, "%s %i/%i", text, ArrayGetCell(aWytrzymalosc, id*ILOSC_SLOTOW+i), max_wytrzymalosc); #else cod_get_perk_name(perk, text, 32); #endif } menu_additem(menu, text); } menu_setprop(menu, MPROP_NEXTNAME, "Dalej"); menu_setprop(menu, MPROP_EXITNAME, "Wyjdz"); menu_setprop(menu, MPROP_BACKNAME, "Wstecz"); menu_display(id, menu); return 1; } public Magazyn_Handler(id, menu, item) { if(item++ == MENU_EXIT) return 0; new perk = ArrayGetCell(aPerki, id*ILOSC_SLOTOW+item), wartosc = ArrayGetCell(aWartosc, id*ILOSC_SLOTOW+item); new wartosc_gracza, perk_gracza = cod_get_user_perk(id, wartosc_gracza); #if defined WYTRZYMALOSC new wytrzymalosc = ArrayGetCell(aWytrzymalosc, id*ILOSC_SLOTOW+item); new wytrzymalosc_gracza = cod_get_perk_durability(id); #endif if(perk) { if(Uzyto[id] & (1<<item)) { client_print(id, print_center, "Nie mozesz wyjac perku, ktory dopiero wlozyles!"); Magazyn(id); return 0; } #if defined WYTRZYMALOSC if(perk_gracza) { ArraySetCell(aPerki, id*ILOSC_SLOTOW+item, perk_gracza); ArraySetCell(aWartosc, id*ILOSC_SLOTOW+item, wartosc_gracza); ArraySetCell(aWytrzymalosc, id*ILOSC_SLOTOW+item, wytrzymalosc_gracza); cod_set_user_perk(id, perk, wartosc, 0); cod_set_perk_durability(id, wytrzymalosc); Uzyto[id] |= (1<<item); } else { cod_set_user_perk(id, perk, wartosc, 0); cod_set_perk_durability(id, wytrzymalosc); ArraySetCell(aPerki, id*ILOSC_SLOTOW+item, 0); ArraySetCell(aWartosc, id*ILOSC_SLOTOW+item, 0); ArraySetCell(aWytrzymalosc, id*ILOSC_SLOTOW+item, 0); } #else if(perk_gracza) { ArraySetCell(aPerki, id*ILOSC_SLOTOW+item, perk_gracza); ArraySetCell(aWartosc, id*ILOSC_SLOTOW+item, wartosc_gracza); cod_set_user_perk(id, perk, wartosc, 0); Uzyto[id] |= (1<<item); } else { cod_set_user_perk(id, perk, wartosc, 0); ArraySetCell(aPerki, id*ILOSC_SLOTOW+item, 0); ArraySetCell(aWartosc, id*ILOSC_SLOTOW+item, 0); } #endif } else { #if defined WYTRZYMALOSC if(!perk_gracza) { client_print(id, print_center, "Nie masz zadnego perku!"); Magazyn(id); return 0; } else { ArraySetCell(aPerki, id*ILOSC_SLOTOW+item, perk_gracza); ArraySetCell(aWartosc, id*ILOSC_SLOTOW+item, wartosc_gracza); ArraySetCell(aWytrzymalosc, id*ILOSC_SLOTOW+item, wytrzymalosc_gracza); cod_set_user_perk(id, 0, 0, 0); cod_set_perk_durability(id, 0); Uzyto[id] |= (1<<item); } #else if(!perk_gracza) { client_print(id, print_center, "Nie masz zadnego perku!"); Magazyn(id); return 0; } else { ArraySetCell(aPerki, id*ILOSC_SLOTOW+item, perk_gracza); ArraySetCell(aWartosc, id*ILOSC_SLOTOW+item, wartosc_gracza); cod_set_user_perk(id, 0, 0, 0); Uzyto[id] |= (1<<item); } #endif } #if defined ZAPISUJ Zapisz(id); #endif Magazyn(id); return 0; } #if defined ZAPISUJ && !defined WYTRZYMALOSC public Zapisz(id) { if(!is_user_connected(id)) return 0; new key[40], value[513], identyfikator[33], val_len = 0; switch(typ_zapisu) { case 1: get_user_name(id, identyfikator, charsmax(identyfikator)); case 2: get_user_authid(id, identyfikator, charsmax(identyfikator)); case 3: get_user_ip(id, identyfikator, charsmax(identyfikator)); } formatex(key, charsmax(key), "%s-%i", identyfikator, typ_zapisu); new text[33], perk, wartosc; for(new i=1; i<=ILOSC_SLOTOW; i++) { perk = ArrayGetCell(aPerki, id*ILOSC_SLOTOW+i); wartosc = ArrayGetCell(aWartosc, id*ILOSC_SLOTOW+i); if(perk) { cod_get_perk_name(perk, text, charsmax(text)); replace_all(text, charsmax(text), " ", "_"); val_len += formatex(value[val_len], charsmax(value)-val_len, "%s#%i#", text, wartosc); } else val_len += formatex(value[val_len], charsmax(value)-val_len, "Brak#-1#"); } nvault_set(vault, key, value); return 0; } public Wczytaj(id) { if(!is_user_connected(id)) return 0; new key[40], identyfikator[33]; switch(typ_zapisu) { case 1: get_user_name(id, identyfikator, charsmax(identyfikator)); case 2: get_user_authid(id, identyfikator, charsmax(identyfikator)); case 3: get_user_ip(id, identyfikator, charsmax(identyfikator)); } formatex(key, charsmax(key), "%s-%i", identyfikator, typ_zapisu); new text[2*ILOSC_SLOTOW+2][33], value[513]; nvault_get(vault, key, value, 512); explode(value, '#', text, 2*ILOSC_SLOTOW+1, 32); for(new i=0; i<ILOSC_SLOTOW; i++) { new perk, wartosc; replace_all(text[2*i], 32, "_", " "); perk = cod_get_perkid(text[2*i]); wartosc = str_to_num(text[2*i+1]); if(perk) { ArraySetCell(aPerki, id*ILOSC_SLOTOW+i+1, perk); ArraySetCell(aWartosc, id*ILOSC_SLOTOW+i+1, wartosc); } else { ArraySetCell(aPerki, id*ILOSC_SLOTOW+i+1, 0); ArraySetCell(aWartosc, id*ILOSC_SLOTOW+i+1, -1); } } return 0; } #endif #if defined ZAPISUJ && defined WYTRZYMALOSC public Zapisz(id) { if(!is_user_connected(id)) return 0; new key[40], value[513], identyfikator[33], val_len = 0; switch(typ_zapisu) { case 1: get_user_name(id, identyfikator, charsmax(identyfikator)); case 2: get_user_authid(id, identyfikator, charsmax(identyfikator)); case 3: get_user_ip(id, identyfikator, charsmax(identyfikator)); } formatex(key, charsmax(key), "%s-%i", identyfikator, typ_zapisu); new text[33], perk, wartosc, wytrzymalosc; for(new i=1; i<=ILOSC_SLOTOW; i++) { perk = ArrayGetCell(aPerki, id*ILOSC_SLOTOW+i); wartosc = ArrayGetCell(aWartosc, id*ILOSC_SLOTOW+i); wytrzymalosc = ArrayGetCell(aWytrzymalosc, id*ILOSC_SLOTOW+i); if(perk) { cod_get_perk_name(perk, text, charsmax(text)); replace_all(text, charsmax(text), " ", "_"); val_len += formatex(value[val_len], charsmax(value)-val_len, "%s#%i#%i#", text, wartosc, wytrzymalosc); } else val_len += formatex(value[val_len], charsmax(value)-val_len, "Brak#-1#0#"); } nvault_set(vault, key, value); return 0; } public Wczytaj(id) { if(!is_user_connected(id)) return 0; new key[40], identyfikator[33]; switch(typ_zapisu) { case 1: get_user_name(id, identyfikator, charsmax(identyfikator)); case 2: get_user_authid(id, identyfikator, charsmax(identyfikator)); case 3: get_user_ip(id, identyfikator, charsmax(identyfikator)); } formatex(key, charsmax(key), "%s-%i", identyfikator, typ_zapisu); new text[3*ILOSC_SLOTOW+2][33], value[513]; nvault_get(vault, key, value, 512); explode(value, '#', text, 3*ILOSC_SLOTOW+1, 32); new perk, wartosc, wytrzymalosc; for(new i=0; i<ILOSC_SLOTOW; i++) { replace_all(text[3*i], 32, "_", " "); perk = cod_get_perkid(text[3*i]); wartosc = str_to_num(text[3*i+1]); wytrzymalosc = str_to_num(text[3*i+2]); if(perk) { ArraySetCell(aPerki, id*ILOSC_SLOTOW+i+1, perk); ArraySetCell(aWartosc, id*ILOSC_SLOTOW+i+1, wartosc); ArraySetCell(aWytrzymalosc, id*ILOSC_SLOTOW+i+1, wytrzymalosc); } else { ArraySetCell(aPerki, id*ILOSC_SLOTOW+i+1, 0); ArraySetCell(aWartosc, id*ILOSC_SLOTOW+i+1, -1); ArraySetCell(aWytrzymalosc, id*ILOSC_SLOTOW+i+1, 0); } } return 0; } #endif public NowaRunda() { for(new i=0; i<=MAX_PLAYERS; i++) Uzyto[i] = 0; } public client_authorized(id) { Uzyto[id] = 0; for(new i=1; i<=ILOSC_SLOTOW; i++) { ArraySetCell(aPerki, id*ILOSC_SLOTOW+i, 0); ArraySetCell(aWartosc, id*ILOSC_SLOTOW+1, -1); #if defined WYTRZYMALOSC ArraySetCell(aWytrzymalosc, id*ILOSC_SLOTOW+1, 0); #endif } } //Stock by DarkGL stock explode(const string[],const character,output[][],const maxs,const maxlen){ new iDo = 0; new len = strlen(string); new oLen = 0; do { oLen += (1+copyc(output[iDo++],maxlen,string[oLen],character)) } while(oLen < len && iDo < maxs) }
Dodanych wklejek: 11179
Powered By (Pav32) Pastebin © 2011