Advertisement
FamiliaSAMP

FILTERSCRIPT - Sistema de Armas com Salvamento [FAMILIASAMP]

Mar 18th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.21 KB | None | 0 0
  1. #include <a_samp>
  2. #include <YSI\y_ini>
  3. #define DIALOGID 1337
  4. #define wPacks "Weapons/%s.ini"
  5. #define COLOR_YELLOW 0xFFFF00FF
  6. #define COLOR_RED 0xFF0000FF
  7. #define COLOR_GREEN 0x00FF00FF
  8. #define COLOR_BLUE 0x0080FFFF
  9. #define COLOR_LIGHTBLUE 0x00FFFFFF
  10.  
  11.  
  12. enum WeaponData
  13. {
  14. Meele,
  15. Ammo1,
  16. Pistol,
  17. Ammo2,
  18. Sub,
  19. Ammo3,
  20. Rifle,
  21. Ammo4,
  22. Assault,
  23. Ammo5,
  24. Shotgun,
  25. Ammo6,
  26. Heavy,
  27. Ammo7,
  28. Thrown,
  29. Ammo8,
  30. Other,
  31. Ammo9,
  32. }
  33.  
  34. new wData[MAX_PLAYERS][WeaponData];
  35.  
  36.  
  37. stock WeaponPath(playerid)
  38. {
  39. new string[128],playername[MAX_PLAYER_NAME];
  40. GetPlayerName(playerid,playername,sizeof(playername));
  41. format(string,sizeof(string),wPacks,playername);
  42. return string;
  43. }
  44.  
  45. public OnPlayerDisconnect(playerid,reason)
  46. {
  47. GetPlayerWeaponData(playerid, 1, wData[playerid][Meele], wData[playerid][Ammo1]);
  48. GetPlayerWeaponData(playerid, 2, wData[playerid][Pistol], wData[playerid][Ammo2]);
  49. GetPlayerWeaponData(playerid, 3, wData[playerid][Sub], wData[playerid][Ammo3]);
  50. GetPlayerWeaponData(playerid, 4, wData[playerid][Rifle], wData[playerid][Ammo4]);
  51. GetPlayerWeaponData(playerid, 5, wData[playerid][Assault], wData[playerid][Ammo5]);
  52. GetPlayerWeaponData(playerid, 6, wData[playerid][Shotgun], wData[playerid][Ammo6]);
  53. GetPlayerWeaponData(playerid, 7, wData[playerid][Heavy], wData[playerid][Ammo7]);
  54. GetPlayerWeaponData(playerid, 8, wData[playerid][Thrown], wData[playerid][Ammo8]);
  55. GetPlayerWeaponData(playerid, 9, wData[playerid][Other], wData[playerid][Ammo9]);
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62. if(fexist(WeaponPath(playerid)))
  63. {
  64. new INI:file = INI_Open(WeaponPath(playerid));
  65. INI_WriteInt(file, "Meele", wData[playerid][Meele]);
  66. INI_WriteInt(file, "Pistol", wData[playerid][Pistol]);
  67. INI_WriteInt(file, "Sub", wData[playerid][Sub]);
  68. INI_WriteInt(file, "Rifle", wData[playerid][Rifle]);
  69. INI_WriteInt(file, "Assault", wData[playerid][Assault]);
  70. INI_WriteInt(file, "Shotgun", wData[playerid][Shotgun]);
  71. INI_WriteInt(file, "Heavy", wData[playerid][Heavy]);
  72. INI_WriteInt(file, "Thrown", wData[playerid][Thrown]);
  73. INI_WriteInt(file, "Other", wData[playerid][Other]);
  74.  
  75.  
  76. INI_WriteInt(file, "Ammo1", wData[playerid][Ammo1]);
  77. INI_WriteInt(file, "Ammo2", wData[playerid][Ammo2]);
  78. INI_WriteInt(file, "Ammo3", wData[playerid][Ammo3]);
  79. INI_WriteInt(file, "Ammo4", wData[playerid][Ammo4]);
  80. INI_WriteInt(file, "Ammo5", wData[playerid][Ammo5]);
  81. INI_WriteInt(file, "Ammo6", wData[playerid][Ammo6]);
  82. INI_WriteInt(file, "Ammo7", wData[playerid][Ammo7]);
  83. INI_WriteInt(file, "Ammo8", wData[playerid][Ammo8]);
  84. INI_WriteInt(file, "Ammo9", wData[playerid][Ammo9]);
  85.  
  86.  
  87.  
  88.  
  89.  
  90. INI_Close(file);
  91. }
  92. return 1;
  93. }
  94.  
  95.  
  96. public OnPlayerConnect(playerid)
  97. {
  98. if(fexist(WeaponPath(playerid)))
  99. {
  100. INI_ParseFile(WeaponPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  101. }
  102. else
  103. {
  104. new INI:file = INI_Open(WeaponPath(playerid));
  105. INI_WriteInt(file, "Meele", wData[playerid][Meele]);
  106. INI_WriteInt(file, "Pistol", wData[playerid][Pistol]);
  107. INI_WriteInt(file, "Sub", wData[playerid][Sub]);
  108. INI_WriteInt(file, "Rifle", wData[playerid][Rifle]);
  109. INI_WriteInt(file, "Assault", wData[playerid][Assault]);
  110. INI_WriteInt(file, "Shotgun", wData[playerid][Shotgun]);
  111. INI_WriteInt(file, "Heavy", wData[playerid][Heavy]);
  112. INI_WriteInt(file, "Thrown", wData[playerid][Thrown]);
  113. INI_WriteInt(file, "Other", wData[playerid][Other]);
  114.  
  115.  
  116. INI_WriteInt(file, "Ammo1", wData[playerid][Ammo1]);
  117. INI_WriteInt(file, "Ammo2", wData[playerid][Ammo2]);
  118. INI_WriteInt(file, "Ammo3", wData[playerid][Ammo3]);
  119. INI_WriteInt(file, "Ammo4", wData[playerid][Ammo4]);
  120. INI_WriteInt(file, "Ammo5", wData[playerid][Ammo5]);
  121. INI_WriteInt(file, "Ammo6", wData[playerid][Ammo6]);
  122. INI_WriteInt(file, "Ammo7", wData[playerid][Ammo7]);
  123. INI_WriteInt(file, "Ammo8", wData[playerid][Ammo8]);
  124. INI_WriteInt(file, "Ammo9", wData[playerid][Ammo9]);
  125.  
  126.  
  127.  
  128. INI_ParseFile(WeaponPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  129. INI_Close(file);
  130. }
  131. return 1;
  132. }
  133.  
  134.  
  135. public OnPlayerSpawn(playerid)
  136. {
  137. SendClientMessage(playerid,COLOR_BLUE, "This server using Weapon System v1.0 by Sreyas");
  138. GivePlayerWeapon(playerid,wData[playerid][Meele],wData[playerid][Ammo1]);
  139. GivePlayerWeapon(playerid,wData[playerid][Pistol],wData[playerid][Ammo2]);
  140. GivePlayerWeapon(playerid,wData[playerid][Sub],wData[playerid][Ammo3]);
  141. GivePlayerWeapon(playerid,wData[playerid][Rifle],wData[playerid][Ammo4]);
  142. GivePlayerWeapon(playerid,wData[playerid][Assault],wData[playerid][Ammo5]);
  143. GivePlayerWeapon(playerid,wData[playerid][Shotgun],wData[playerid][Ammo6]);
  144. GivePlayerWeapon(playerid,wData[playerid][Heavy],wData[playerid][Ammo7]);
  145. GivePlayerWeapon(playerid,wData[playerid][Thrown],wData[playerid][Ammo8]);
  146. GivePlayerWeapon(playerid,wData[playerid][Other],wData[playerid][Ammo9]);
  147.  
  148.  
  149.  
  150.  
  151.  
  152. return 1;
  153. }
  154.  
  155. forward LoadUser_data(playerid, name[], value[]);
  156. public LoadUser_data(playerid, name[], value[])
  157. {
  158. INI_Int("Meele", wData[playerid][Meele]);
  159. INI_Int("Pistol", wData[playerid][Pistol]);
  160. INI_Int("Sub", wData[playerid][Sub]);
  161. INI_Int("Rifle", wData[playerid][Rifle]);
  162. INI_Int("Assault", wData[playerid][Assault]);
  163. INI_Int("Shotgun", wData[playerid][Shotgun]);
  164. INI_Int("Heavy", wData[playerid][Heavy]);
  165. INI_Int("Thrown", wData[playerid][Thrown]);
  166. INI_Int("Other", wData[playerid][Other]);
  167.  
  168.  
  169. INI_Int("Ammo1", wData[playerid][Ammo1]);
  170. INI_Int("Ammo2", wData[playerid][Ammo2]);
  171. INI_Int("Ammo3", wData[playerid][Ammo3]);
  172. INI_Int("Ammo4", wData[playerid][Ammo4]);
  173. INI_Int("Ammo5", wData[playerid][Ammo5]);
  174. INI_Int("Ammo6", wData[playerid][Ammo6]);
  175. INI_Int("Ammo7", wData[playerid][Ammo7]);
  176. INI_Int("Ammo8", wData[playerid][Ammo8]);
  177. INI_Int("Ammo9", wData[playerid][Ammo9]);
  178.  
  179. return 1;
  180. }
  181.  
  182. public OnFilterScriptInit()
  183. {
  184. print("\n--------------------------------------");
  185. print(" Unloaded Weapon Spawner with Save system by Sreyas");
  186. print("-----------------PLS Dont Remove credits-------------------\n");
  187.  
  188.  
  189.  
  190. return 1;
  191. }
  192.  
  193. public OnFilterScriptExit()
  194. {
  195. print("\n--------------------------------------");
  196. print("Unloaded Weapon Spawner with Save system by Sreyas ");
  197. print("-----------------PLS Dont Remove credits ---------------------\n");
  198.  
  199. return 1;
  200.  
  201.  
  202.  
  203. }
  204.  
  205.  
  206.  
  207.  
  208. public OnPlayerCommandText(playerid, cmdtext[])
  209. {
  210. if (strcmp("/w", cmdtext, true, 10) == 0)
  211. {
  212. ShowPlayerDialog(playerid, DIALOGID, DIALOG_STYLE_LIST, "Weapon Lists", "{00FF00}Melees\n{8000FF}Pistols\n{FF8000}Sub-Machine Guns\n{FF00FF}Rifle's\n{FF0080}Assault Rifle\n{DFFF00}Shotgun\n{800040}Heavy Weapon\n{8080FF}Thrown\n{1340F2}Other Melees", "Select", "Cancel");
  213. return 1;
  214. }
  215. return 0;
  216. }
  217.  
  218. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  219. {
  220. if(dialogid == DIALOGID)
  221. {
  222. if(response)
  223. {
  224. if(listitem == 0)
  225. {
  226. ShowPlayerDialog(playerid, DIALOGID+1, DIALOG_STYLE_LIST, "Weapon Menu", "Knuckle Dusters\nGolf Club\nNite Stick\nKnife\nBat\nShovel\nPool Cue\nKatana\nDildo\nSpray Can\n", "Select", "Cancel");
  227. }
  228. if(listitem == 1)
  229. {
  230. ShowPlayerDialog(playerid, DIALOGID+2, DIALOG_STYLE_LIST, "Weapon Menu", "9mm\nSilenced 9mm\nDesert Eagle", "Get", "Cancel");
  231. }
  232. if(listitem == 2)
  233. {
  234. ShowPlayerDialog(playerid, DIALOGID+3, DIALOG_STYLE_LIST, "Weapon Menu", "Uzi\nSMG\nTec9", "Get", "Cancel");
  235. }
  236. if(listitem == 3)
  237. {
  238. ShowPlayerDialog(playerid, DIALOGID+4, DIALOG_STYLE_LIST, "Weapon Menu", "Country Rifle\nSniper Rifle", "Get", "Cancel");
  239. }
  240. if(listitem == 4)
  241. {
  242. ShowPlayerDialog(playerid, DIALOGID+5, DIALOG_STYLE_LIST, "Weapon Menu", "AK-47\nM4", "Get", "Cancel");
  243. }
  244. if(listitem == 5)
  245. {
  246. ShowPlayerDialog(playerid, DIALOGID+6, DIALOG_STYLE_LIST, "Weapon Menu", "Standard Shotgun\nSawnoff Shotgun\nCombat Shotgun", "Get", "Cancel");
  247. }
  248. if(listitem == 6)
  249. {
  250. ShowPlayerDialog(playerid, DIALOGID+7, DIALOG_STYLE_LIST, "Weapon Menu", "Rocket Laucher\nHeat Seaker\nMinigun\nChain Saw", "Get", "Cancel");
  251. }
  252. if(listitem == 7)
  253. {
  254. ShowPlayerDialog(playerid, DIALOGID+8, DIALOG_STYLE_LIST, "Weapon Menu", "Granade\nTear Gas", "Get", "Cancel");
  255. }
  256. if(listitem == 8)
  257. {
  258. ShowPlayerDialog(playerid, DIALOGID+9, DIALOG_STYLE_LIST, "Weapon Menu", "Fire Extinguisher\nSatchel Charge\nParachute\nNightvision Goggles\nFlowers", "Get", "Cancel");
  259. }
  260. }
  261. return 1;
  262. }
  263.  
  264. if(dialogid == DIALOGID+1)
  265. {
  266. if(response)
  267. {
  268. if(listitem == 0)
  269. {
  270. GivePlayerWeapon(playerid, 1, 1);
  271. GivePlayerMoney(playerid,-500);
  272. wData[playerid][Meele]=1;
  273. wData[playerid][Ammo1]=1;
  274. }
  275. if(listitem == 1)
  276. {
  277. GivePlayerWeapon(playerid, 2, 1);
  278. GivePlayerMoney(playerid,-500);
  279. wData[playerid][Meele]=2;
  280. wData[playerid][Ammo1]=1;
  281.  
  282. }
  283. if(listitem == 2)
  284. {
  285. GivePlayerMoney(playerid,-500);
  286. GivePlayerWeapon(playerid, 3, 1);
  287. wData[playerid][Meele]=3;
  288. wData[playerid][Ammo1]=1;
  289.  
  290. }
  291. if(listitem == 3)
  292. {
  293. GivePlayerMoney(playerid,-500);
  294. GivePlayerWeapon(playerid, 4, 1);
  295. wData[playerid][Meele]=4;
  296. wData[playerid][Ammo1]=1;
  297. }
  298. if(listitem == 4)
  299. {
  300. GivePlayerMoney(playerid,-500);
  301. GivePlayerWeapon(playerid, 5, 1);
  302.  
  303. wData[playerid][Meele]=5;
  304. wData[playerid][Ammo1]=1;
  305. }
  306. if(listitem == 5)
  307. {
  308. GivePlayerMoney(playerid,-500);
  309. GivePlayerWeapon(playerid, 6, 1);
  310. wData[playerid][Meele]=6;
  311. wData[playerid][Ammo1]=1;
  312. }
  313. if(listitem == 6)
  314. {
  315. GivePlayerMoney(playerid,-500);
  316. GivePlayerWeapon(playerid, 7, 1);
  317. wData[playerid][Meele]=7;
  318. wData[playerid][Ammo1]=1;
  319. }
  320. if(listitem == 7)
  321. {
  322. GivePlayerMoney(playerid,-500);
  323. GivePlayerWeapon(playerid, 8, 1);
  324. wData[playerid][Meele]=8;
  325. wData[playerid][Ammo1]=1;
  326.  
  327. }
  328. if(listitem == 8)
  329. {
  330. GivePlayerMoney(playerid,-500);
  331. GivePlayerWeapon(playerid, 10, 1);
  332. wData[playerid][Meele]=10;
  333. wData[playerid][Ammo1]=1;
  334.  
  335. }
  336. if(listitem == 9)
  337. {
  338. GivePlayerMoney(playerid,-500);
  339. GivePlayerWeapon(playerid, 41, 9999);
  340. wData[playerid][Meele]=1;
  341. wData[playerid][Ammo1]=9999;
  342. }
  343. if(listitem == 10)
  344. {
  345. GivePlayerMoney(playerid,-500);
  346. GivePlayerWeapon(playerid, 15, 1);
  347. wData[playerid][Meele]=1;
  348. wData[playerid][Ammo1]=1;
  349. }
  350. }
  351. return 1;
  352. }
  353.  
  354. if(dialogid == DIALOGID+2)
  355. {
  356. if(response)
  357. {
  358. if(listitem == 0)
  359. {
  360. GivePlayerMoney(playerid,-5000);
  361. GivePlayerWeapon(playerid, 22, 9999);
  362. wData[playerid][Pistol]=22;
  363. wData[playerid][Ammo2]=9999;
  364. }
  365. if(listitem == 1)
  366. {
  367. GivePlayerMoney(playerid,-5000);
  368. GivePlayerWeapon(playerid, 23, 9999);
  369. wData[playerid][Pistol]=23;
  370. wData[playerid][Ammo2]=9999;
  371. }
  372. if(listitem == 2)
  373. {
  374. GivePlayerMoney(playerid,-5000);
  375. GivePlayerWeapon(playerid, 24, 9999);
  376. wData[playerid][Pistol]=24;
  377. wData[playerid][Ammo2]=9999;
  378. }
  379. }
  380. return 1;
  381. }
  382.  
  383. if(dialogid == DIALOGID+3)
  384. {
  385. if(response)
  386. {
  387. if(listitem == 0)
  388. {
  389. GivePlayerMoney(playerid,-5000);
  390. GivePlayerWeapon(playerid, 28, 9999);
  391. wData[playerid][Sub]=28;
  392. wData[playerid][Ammo3]=9999;
  393.  
  394. }
  395. if(listitem == 1)
  396. {
  397. GivePlayerMoney(playerid,-5000);
  398. GivePlayerWeapon(playerid, 29, 9999);
  399. wData[playerid][Sub]=29;
  400. wData[playerid][Ammo3]=9999;
  401. }
  402. if(listitem == 2)
  403. {
  404. GivePlayerMoney(playerid,-5000);
  405. GivePlayerWeapon(playerid, 32, 9999);
  406. wData[playerid][Sub]=32;
  407. wData[playerid][Ammo3]=9999;
  408. }
  409. }
  410. return 1;
  411. }
  412.  
  413. if(dialogid == DIALOGID+4)
  414. {
  415. if(response)
  416. {
  417. if(listitem == 0)
  418. {
  419. GivePlayerMoney(playerid,-5000);
  420. GivePlayerWeapon(playerid, 33, 9999);
  421. wData[playerid][Rifle]=33;
  422. wData[playerid][Ammo4]=9999;
  423.  
  424. }
  425. if(listitem == 1)
  426. {
  427. GivePlayerMoney(playerid,-5000);
  428. GivePlayerWeapon(playerid, 34, 9999);
  429. wData[playerid][Rifle]=34;
  430. wData[playerid][Ammo4]=9999;
  431. }
  432. }
  433. return 1;
  434. }
  435.  
  436. if(dialogid == DIALOGID+5)
  437. {
  438. if(response)
  439. {
  440. if(listitem == 0)
  441. {
  442. GivePlayerMoney(playerid,-5000);
  443. GivePlayerWeapon(playerid, 30, 9999);
  444. wData[playerid][Assault]=30;
  445. wData[playerid][Ammo5]=9999;
  446.  
  447. }
  448. if(listitem == 1)
  449. {
  450. GivePlayerMoney(playerid,-5000);
  451. GivePlayerWeapon(playerid, 31, 9999);
  452. wData[playerid][Assault]=31;
  453. wData[playerid][Ammo5]=9999;
  454. }
  455. }
  456. return 1;
  457. }
  458.  
  459. if(dialogid == DIALOGID+6)
  460. {
  461. if(response)
  462. {
  463. if(listitem == 0)
  464. {
  465. GivePlayerMoney(playerid,-5000);
  466. GivePlayerWeapon(playerid, 25, 9999);
  467. wData[playerid][Shotgun]=25;
  468. wData[playerid][Ammo6]=9999;
  469.  
  470.  
  471. }
  472. if(listitem == 1)
  473. {
  474. GivePlayerMoney(playerid,-5000);
  475. GivePlayerWeapon(playerid, 26, 9999);
  476. wData[playerid][Shotgun]=26;
  477. wData[playerid][Ammo6]=9999;
  478. }
  479. if(listitem == 2)
  480. {
  481. GivePlayerMoney(playerid,-5000);
  482. GivePlayerWeapon(playerid, 27, 9999);
  483. wData[playerid][Shotgun]=27;
  484. wData[playerid][Ammo6]=9999;
  485. }
  486. }
  487. return 1;
  488. }
  489.  
  490. if(dialogid == DIALOGID+7)
  491. {
  492. if(response)
  493. {
  494. if(listitem == 0)
  495. {
  496. GivePlayerMoney(playerid,-5000);
  497. GivePlayerWeapon(playerid, 35, 9999);
  498. wData[playerid][Heavy]=35;
  499. wData[playerid][Ammo7]=9999;
  500. }
  501. if(listitem == 1)
  502. {
  503. GivePlayerMoney(playerid,-5000);
  504. GivePlayerWeapon(playerid, 36, 9999);
  505. wData[playerid][Heavy]=36;
  506. wData[playerid][Ammo7]=9999;
  507. }
  508. if(listitem == 2)
  509. {
  510. GivePlayerMoney(playerid,-5000);
  511. GivePlayerWeapon(playerid, 38, 9999);
  512. wData[playerid][Heavy]=38;
  513. wData[playerid][Ammo7]=9999;
  514. }
  515. if(listitem == 3)
  516. {
  517. GivePlayerMoney(playerid,-5000);
  518. GivePlayerWeapon(playerid, 9, 9999);
  519. wData[playerid][Heavy]=9;
  520. wData[playerid][Ammo7]=9999;
  521. }
  522. }
  523. return 1;
  524. }
  525.  
  526. if(dialogid == DIALOGID+8)
  527. {
  528. if(response)
  529. {
  530. if(listitem == 0)
  531. {
  532. GivePlayerMoney(playerid,-5000);
  533. GivePlayerWeapon(playerid, 16, 9999);
  534. wData[playerid][Thrown]=16;
  535. wData[playerid][Ammo8]=9999;
  536. }
  537. if(listitem == 1)
  538. {
  539. GivePlayerMoney(playerid,-5000);
  540. GivePlayerWeapon(playerid, 17, 9999);
  541. wData[playerid][Thrown]=17;
  542. wData[playerid][Ammo8]=9999;
  543. }
  544. }
  545. return 1;
  546. }
  547.  
  548. if(dialogid == DIALOGID+9)
  549. {
  550. if(response)
  551. {
  552. if(listitem == 0)
  553. {
  554. GivePlayerMoney(playerid,-5000);
  555. GivePlayerWeapon(playerid, 42, 9999);
  556. wData[playerid][Other]=42;
  557. wData[playerid][Ammo9]=9999;
  558. }
  559. if(listitem == 1)
  560. {
  561. GivePlayerMoney(playerid,-5000);
  562. GivePlayerWeapon(playerid, 39, 1);
  563. GivePlayerWeapon(playerid, 40, 1);
  564. wData[playerid][Other]=40;
  565. wData[playerid][Ammo9]=1;
  566. }
  567. if(listitem == 2)
  568. {
  569. GivePlayerMoney(playerid,-5000);
  570. GivePlayerWeapon(playerid, 46, 1);
  571. wData[playerid][Other]=46;
  572. wData[playerid][Ammo9]=1;
  573. }
  574. if(listitem == 3)
  575. {
  576. GivePlayerMoney(playerid,-5000);
  577. GivePlayerWeapon(playerid, 44, 1);
  578. wData[playerid][Other]=44;
  579. wData[playerid][Ammo9]=1;
  580. }
  581. if(listitem == 4)
  582. {
  583. GivePlayerMoney(playerid,-5000);
  584. GivePlayerWeapon(playerid, 14, 1);
  585. wData[playerid][Other]=14;
  586. wData[playerid][Ammo9]=1;
  587. }
  588. }
  589. return 1;
  590. }
  591.  
  592. return 0;
  593. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement