Advertisement
ShomyScript

Untitled

Sep 30th, 2017
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.41 KB | None | 0 0
  1. /*
  2. Filterscript Zlato By Shomy
  3.  
  4. NAPOMENA: Morate imati u scriptfiles "Korisnici" Folder !
  5.  
  6. */
  7. //==== [ INCLUDE ] ====//
  8.  
  9. #include <a_samp>
  10. #include <sscanf2>
  11. #include <YSI\y_ini>
  12.  
  13. //==== [ DEFINE ] ====//
  14.  
  15. #define PATH "/Korisnici/%s.ini"
  16. #define COL_SERVER "{FF8000}"
  17. #define SCM SendClientMessage
  18. #define BELA "{FFFFFF}"
  19.  
  20. //==== [ ENUM ] ====//
  21.  
  22. enum pInfo
  23. {
  24. pZlato,
  25. pNovac
  26. }
  27.  
  28. //==== [ NEW ] ====//
  29.  
  30. new PlayerInfo[MAX_PLAYERS][pInfo];
  31.  
  32. //==== [ NEW TD ] ====//
  33.  
  34. new Text:ZlatoTD;
  35.  
  36. //==== [ STOCK ] ====//
  37.  
  38. stock UserPath(playerid)
  39. {
  40. new string[128],playername[MAX_PLAYER_NAME];
  41. GetPlayerName(playerid,playername,sizeof(playername));
  42. format(string,sizeof(string),PATH,playername);
  43. return string;
  44. }
  45. stock UpdateTD(playerid)
  46. {
  47. new zlato[128];
  48. format(zlato,sizeof(zlato), "Zlato: %dg", PlayerInfo[playerid][pZlato]);
  49. TextDrawSetString(ZlatoTD, zlato);
  50. return 1;
  51. }
  52. //==== [ PUBLIC ] ====//
  53.  
  54. public OnFilterScriptInit()
  55. {
  56. ZlatoTD = TextDrawCreate(497.411712, 101.500015, "Zlato: 5g");
  57. TextDrawLetterSize(ZlatoTD, 0.449999, 1.600000);
  58. TextDrawAlignment(ZlatoTD, 1);
  59. TextDrawColor(ZlatoTD, -5963521);
  60. TextDrawSetShadow(ZlatoTD, 0);
  61. TextDrawSetOutline(ZlatoTD, 1);
  62. TextDrawBackgroundColor(ZlatoTD, 51);
  63. TextDrawFont(ZlatoTD, 3);
  64. TextDrawSetProportional(ZlatoTD, 1);
  65. return 1;
  66. }
  67. forward LoadUser_data(playerid,name[],value[]);
  68. public LoadUser_data(playerid,name[],value[])
  69. {
  70. INI_Int("Zlato",PlayerInfo[playerid][pZlato]);
  71. INI_Int("Novac",PlayerInfo[playerid][pNovac]);
  72. return 1;
  73. }
  74.  
  75. public OnPlayerConnect(playerid)
  76. {
  77. INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  78. return 1;
  79. }
  80. public OnPlayerDisconnect(playerid, reason)
  81. {
  82. new INI:File = INI_Open(UserPath(playerid));
  83. INI_WriteInt(File, "Novac", GetPlayerMoney(playerid));
  84. INI_WriteInt(File, "Zlato", PlayerInfo[playerid][pZlato]);
  85. INI_Close(File);
  86. return 1;
  87. }
  88. public OnPlayerSpawn(playerid)
  89. {
  90. new zlato[128];
  91. new kolzlata = PlayerInfo[playerid][pZlato];
  92. PlayerInfo[playerid][pZlato] = kolzlata;
  93. TextDrawShowForPlayer(playerid, ZlatoTD);
  94. format(zlato,sizeof(zlato), "Zlato: %dg", PlayerInfo[playerid][pZlato]);
  95. TextDrawSetString(ZlatoTD, zlato);
  96. return 1;
  97. }
  98. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  99. {
  100. if(newkeys & KEY_YES)
  101. {
  102. new INI:File = INI_Open(UserPath(playerid));
  103. INI_WriteInt(File, "Novac", GetPlayerMoney(playerid));
  104. INI_Close(File);
  105. new novacdinari = GetPlayerMoney(playerid);
  106. new zlatocena;
  107. zlatocena = PlayerInfo[playerid][pNovac] = 1300;
  108. if(novacdinari < zlatocena) return SCM(playerid, -1, ""COL_SERVER"[SERVER] "BELA"Nemate dovoljno novca !");
  109. else
  110. {
  111. SCM(playerid, -1, ""COL_SERVER"[SERVER] "BELA"Kupili ste 1g zlata !");
  112. GivePlayerMoney(playerid, -1300);
  113. PlayerInfo[playerid][pZlato] += 1;
  114. PlayerInfo[playerid][pNovac] -= 1300;
  115. UpdateTD(playerid);
  116. }
  117. }
  118. if(newkeys & KEY_NO)
  119. {
  120. if(PlayerInfo[playerid][pZlato] == 0) return SCM(playerid, -1, ""COL_SERVER"[SERVER] "BELA"Nemate zlato !");
  121. else
  122. {
  123. SCM(playerid, -1, ""COL_SERVER"[SERVER] "BELA"Prodali ste 1g zlata !");
  124. GivePlayerMoney(playerid, 1250);
  125. PlayerInfo[playerid][pZlato] -= 1;
  126. PlayerInfo[playerid][pNovac] += 1250;
  127. UpdateTD(playerid);
  128. }
  129. }
  130. return 1;
  131. }
  132.  
  133. //======================= [ KRAJ FS ZLATO SYSTEM BY SHOMY ] ==================//
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement