Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2014
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. #include <a_samp>
  2. #include <sscanf2>
  3. #include <zcmd>
  4.  
  5. #define WSS_COLOR_RED 0xFF0000FF
  6. #define WSS_COLOR_GREEN 0x00FF00FF
  7. #define WSS_Dialog 0
  8.  
  9. new WSS_Id[35];
  10. new WSS_Name[35][32];
  11. new WSS_Ammo[35];
  12. new WSS_Price[35];
  13.  
  14. public OnFilterScriptInit()
  15. {
  16. new File:WSS_File;
  17. if(!fexist("WSS.cfg"))
  18. {
  19. WSS_File = fopen("WSS.cfg",io_write);
  20. fclose(WSS_File);
  21. }
  22. if(fexist("WSS.cfg"))
  23. {
  24. WSS_File = fopen("WSS.cfg",io_read);
  25. if(WSS_File)
  26. {
  27. new String[64];
  28. new A;
  29. while(fread(WSS_File,String))
  30. {
  31. sscanf(String,"p<|>is[32]ii",WSS_Id[A],WSS_Name[A],WSS_Ammo[A],WSS_Price[A]);
  32. A++;
  33. }
  34. fclose(WSS_File);
  35. }
  36. }
  37. return 1;
  38. }
  39.  
  40. public OnDialogResponse(playerid,dialogid,response,listitem,inputtext[])
  41. {
  42. switch(dialogid)
  43. {
  44. case WSS_Dialog:
  45. {
  46. if(response)
  47. {
  48. new String[128];
  49. if(GetPlayerMoney(playerid) < WSS_Price[listitem])
  50. {
  51. format(String,sizeof(String),"Ban Can %i$ de mua %s.",WSS_Price[listitem],WSS_Name[listitem]);
  52. SendClientMessage(playerid,WSS_COLOR_RED,String);
  53. return 1;
  54. }
  55. GivePlayerWeapon(playerid,WSS_Id[listitem],WSS_Ammo[listitem]);
  56. GivePlayerMoney(playerid,-WSS_Price[listitem]);
  57. format(String,sizeof(String),"Ban da mua %s voi %i dan cho %i$.",WSS_Name[listitem],WSS_Ammo[listitem],WSS_Price[listitem]);
  58. SendClientMessage(playerid,WSS_COLOR_GREEN,String);
  59. }
  60. }
  61. }
  62. return 1;
  63. }
  64.  
  65. COMMAND:wss(playerid,params[])
  66. {
  67. new String[1024];
  68. for(new A,B = 35; A < B; A++)
  69. {
  70. format(String,sizeof(String),"%s[%i] %s [%i$]\n",String,WSS_Ammo[A],WSS_Name[A],WSS_Price[A]);
  71. }
  72. ShowPlayerDialog(playerid,WSS_Dialog,DIALOG_STYLE_LIST,"He Thong Shop Sung",String,"Mua","Huy Bo");
  73. return 1;
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement