Guest User

Untitled

a guest
Jun 22nd, 2016
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.53 KB | None | 0 0
  1. #define FILTERSCRIPT
  2.  
  3. #include <a_samp>
  4. #include <YSI\y_ini>
  5. #include <zcmd>
  6. #include <sscanf2>
  7. #define PATH "/Tokens/%s.ini"
  8. #define COLOR_RED 0xAA3333AA
  9. #define COLOR_WHITE 0xFFFFFFFF
  10. #define COLOR_GRAD2 0xBFC0C2FF
  11. #define COLOR_GREY 0xAFAFAFAA
  12. #define COLOR_RED 0xAA3333AA
  13.  
  14. #include <a_zones>
  15. #include <streamer>
  16. #include <foreach>
  17. #include <progress>
  18. #include <YSI/y_timers.inc>
  19. #include <yom_buttons>
  20. #include <audio>
  21.  
  22.  
  23.  
  24.  
  25. #define FIRSTMENU 400
  26.  
  27. public OnFilterScriptInit()
  28. {
  29.  
  30. // ******************************* [ Pick ups] *********************************
  31. // |--------------------------------------------------------------------------|* // |*
  32. // |*
  33. // |*
  34. // |--------------------------------------------------------------------------|*
  35. // *****************************************************************************
  36.  
  37. // ***************************** [ Checkpoints ] *******************************
  38. // |--------------------------------------------------------------------------|*
  39. // |*
  40. // |*
  41.  
  42. // |*
  43. // |*
  44. // |*
  45. // |*
  46. // |* // |* // |*
  47. // |--------------------------------------------------------------------------|*
  48. // *****************************************************************************
  49.  
  50. return 1;
  51. }
  52.  
  53. stock GetPlayerNameEx(playerid)
  54. {
  55. new name[MAX_PLAYER_NAME];
  56. GetPlayerName(playerid, name, sizeof(name));
  57. return name;
  58. }
  59.  
  60. enum pData
  61. {
  62. ptokens
  63. }
  64. new PlayerInfo[MAX_PLAYERS + 1][pData];
  65.  
  66. forward LoadUser_Data(playerid,TarID,name[],value[]);
  67. public LoadUser_Data(playerid,TarID,name[],value[])
  68. {
  69. INI_Int("Tokens:", PlayerInfo[TarID][ptokens]);
  70. return 1;
  71. }
  72.  
  73. stock UserPath(TarID)
  74. {
  75. new string[128],pName[MAX_PLAYER_NAME];
  76. GetPlayerName(TarID,pName,MAX_PLAYER_NAME);
  77. format(string,sizeof(string),PATH,pName);
  78. return string;
  79. }
  80.  
  81.  
  82. COMMAND:settokens(playerid, params[])
  83. {
  84. new TarID, amount;
  85. if(sscanf(params,"ui",TarID,amount)) return SendClientMessage(playerid,COLOR_RED,"Syntax: [Playerid] [tokens]");
  86. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_RED,"You're not authorized to use this command");
  87. if(!IsPlayerConnected(TarID)) return SendClientMessage(playerid,COLOR_RED,"Check your entry.Player is not Connected to the game");
  88. new currentok = PlayerInfo[TarID][ptokens];
  89. PlayerInfo[TarID][ptokens] = currentok + amount;
  90. new INI:File = INI_Open(UserPath(TarID));
  91. INI_SetTag(File, "VIP Tokens");
  92. INI_WriteInt(File,"Tokens:", currentok + amount);
  93. INI_Close(File);
  94. return 1;
  95. }
  96.  
  97.  
  98. COMMAND:givetokens(playerid, params[])
  99. {
  100. new string[128], TarID, amount;
  101. if(sscanf(params, "us[32]d", TarID, amount))
  102. {
  103. SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givetokens [playerid/partofname] [amount]");
  104. return 1;
  105. }
  106. if(TarID == playerid)
  107. {
  108. SendClientMessage(playerid, COLOR_GREY, "You can't use this command on yourself!");
  109. return 1;
  110. }
  111.  
  112. if(PlayerInfo[playerid][ptokens] >= amount)
  113. {
  114. PlayerInfo[TarID][ptokens] += amount;
  115. PlayerInfo[playerid][ptokens] -= amount;
  116. format(string, sizeof(string), "You have recieved %d Tokens from %s.", amount, GetPlayerNameEx(playerid));
  117. SendClientMessage(TarID, COLOR_GRAD2, string);
  118. format(string, sizeof(string), "You have given %s Tokens To %d.", amount, GetPlayerNameEx(TarID));
  119. SendClientMessage(playerid, COLOR_GRAD2, string);
  120. }
  121. if(PlayerInfo[playerid][ptokens] < amount)
  122. {
  123. SendClientMessage(playerid, COLOR_GREY, "You don't have that much!");
  124. }
  125. return 1;
  126. }
  127.  
  128. COMMAND:checktokens(playerid, params[])
  129. {
  130. new string[128];
  131. new currentok = PlayerInfo[playerid][ptokens];
  132. format(string, sizeof(string), "You have currently %d Tokens ", currentok);
  133. SendClientMessage(playerid, COLOR_GRAD2, string);
  134.  
  135. return 1;
  136. }
  137.  
  138. forward OnPlayerConnect(playerid);
  139. public OnPlayerConnect(playerid)
  140. {
  141. if(fexist(UserPath(playerid)))
  142. {
  143. INI_ParseFile(UserPath(playerid), "LoadUser_%s",.bExtra =true, .extra =playerid);
  144. }
  145. else if(!fexist(UserPath(playerid)))
  146. {
  147. new INI:File = INI_Open(UserPath(playerid));
  148. INI_SetTag(File,"VIP Tokens");
  149. INI_WriteInt(File,"Tokens:", 0);
  150. INI_Close(File);
  151. }
  152. return 1;
  153. }
  154.  
  155. COMMAND:buyweapons(playerid, params[])
  156. {
  157. if(IsPlayerConnected(playerid))
  158. {
  159. if(IsPlayerInRangeOfPoint(playerid, 3, 1720.9337, -1629.0479, 20.2135))
  160. {
  161. ShowPlayerDialog(playerid, FIRSTMENU, DIALOG_STYLE_LIST,
  162. "Weapons List",
  163. "MP5 5 Tokens\nShotgun 5 Tokens\nDesert Eagle 5 Tokens\nCombat Shotgun5 Tokens\nM4 5 Tokens\nAK-47 5 Tokens\nSniper Rifle 5 Tokens",
  164. "Select", "Exit");
  165. }
  166. else
  167. {
  168. SendClientMessage(playerid, COLOR_GREY, "You Are not at the weapon point!");
  169. }
  170. }
  171. return 1;
  172. }
  173.  
  174. forward CheckTokens(playerid);
  175. public CheckTokens(playerid)
  176. {
  177. new INI:File = INI_Open(UserPath(playerid));
  178. INI_SetTag(File, "VIP Tokens");
  179. INI_WriteInt(File,"Tokens:", PlayerInfo[playerid][ptokens]);
  180. INI_Close(File);
  181. return 1;
  182. }
  183.  
  184.  
  185. public OnPlayerDisconnect(playerid)
  186. {
  187. new INI:File = INI_Open(UserPath(playerid));
  188. INI_SetTag(File, "VIP Tokens");
  189. INI_WriteInt(File,"Tokens:", PlayerInfo[playerid][ptokens]);
  190. INI_Close(File);
  191. return 1;
  192. }
  193.  
  194.  
  195. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  196. {
  197.  
  198. if(dialogid == FIRSTMENU)
  199. {
  200.  
  201. if(response)
  202. {
  203. if(listitem == 0) // MP5
  204. {
  205.  
  206. if(PlayerInfo[playerid][ptokens] >= 5)
  207. {
  208. SendClientMessage(playerid, COLOR_GREY,"* Recieved your GUN, HAVE FUN ! ");
  209. PlayerInfo[playerid][ptokens] -= 5;
  210. GivePlayerWeapon(playerid, 29, 200);
  211. new INI:File = INI_Open(UserPath(playerid));
  212. INI_SetTag(File, "VIP Tokens");
  213. INI_WriteInt(File,"Tokens:", PlayerInfo[playerid][ptokens]);
  214. INI_Close(File);
  215. }
  216. else
  217. {
  218. SendClientMessage(playerid, COLOR_GREY,"* You cannot afford this!");
  219. }
  220. }
  221. }
  222.  
  223. if(listitem == 1) // Shotgun
  224. {
  225.  
  226. if(PlayerInfo[playerid][ptokens] >= 5)
  227. {
  228. SendClientMessage(playerid, COLOR_GREY,"* Recieved your GUN, HAVE FUN ! ");
  229. PlayerInfo[playerid][ptokens] -= 5;
  230. GivePlayerWeapon(playerid, 25, 50);
  231. new INI:File = INI_Open(UserPath(playerid));
  232. INI_SetTag(File, "VIP Tokens");
  233. INI_WriteInt(File,"Tokens:", PlayerInfo[playerid][ptokens]);
  234. INI_Close(File);
  235. }
  236. else
  237. {
  238. SendClientMessage(playerid, COLOR_GREY,"* You cannot afford this!");
  239. }
  240. }
  241. }
  242.  
  243. if(listitem == 2) // Deagle
  244. {
  245.  
  246. if(PlayerInfo[playerid][ptokens] >= 5)
  247. {
  248. SendClientMessage(playerid, COLOR_GREY,"* Recieved your GUN, HAVE FUN ! ");
  249. PlayerInfo[playerid][ptokens] -= 5;
  250. GivePlayerWeapon(playerid, 24, 100);
  251. }
  252. else
  253. {
  254. SendClientMessage(playerid, COLOR_GREY,"* You cannot afford this!");
  255. }
  256. }
  257.  
  258. if(listitem == 3) // Combat Shotgun
  259. {
  260.  
  261. if(PlayerInfo[playerid][ptokens] >= 5)
  262. {
  263. SendClientMessage(playerid, COLOR_GREY,"* Recieved your GUN, HAVE FUN ! ");
  264. PlayerInfo[playerid][ptokens] -= 5;
  265. GivePlayerWeapon(playerid, 27, 200);
  266. new INI:File = INI_Open(UserPath(playerid));
  267. INI_SetTag(File, "VIP Tokens");
  268. INI_WriteInt(File,"Tokens:", PlayerInfo[playerid][ptokens]);
  269. INI_Close(File);
  270. }
  271. else
  272. {
  273. SendClientMessage(playerid, COLOR_GREY,"* You cannot afford this!");
  274. }
  275. }
  276.  
  277. if(listitem == 4) //M4
  278. {
  279.  
  280. if(PlayerInfo[playerid][ptokens] >= 5)
  281. {
  282. SendClientMessage(playerid, COLOR_GREY,"* Recieved your GUN, HAVE FUN ! ");
  283. PlayerInfo[playerid][ptokens] -= 5;
  284. GivePlayerWeapon(playerid, 31, 50);
  285. new INI:File = INI_Open(UserPath(playerid));
  286. INI_SetTag(File, "VIP Tokens");
  287. INI_WriteInt(File,"Tokens:", PlayerInfo[playerid][ptokens]);
  288. INI_Close(File);
  289. }
  290. else
  291. {
  292. SendClientMessage(playerid, COLOR_GREY,"* You cannot afford this!");
  293. }
  294. }
  295.  
  296. if(listitem == 5) // AK
  297. {
  298.  
  299. if(PlayerInfo[playerid][ptokens] >= 5)
  300. {
  301. SendClientMessage(playerid, COLOR_GREY,"* Recieved your GUN, HAVE FUN ! ");
  302. PlayerInfo[playerid][ptokens] -= 5;
  303. GivePlayerWeapon(playerid, 30, 200);
  304. new INI:File = INI_Open(UserPath(playerid));
  305. INI_SetTag(File, "VIP Tokens");
  306. INI_WriteInt(File,"Tokens:", PlayerInfo[playerid][ptokens]);
  307. INI_Close(File);
  308. }
  309. else
  310. {
  311. SendClientMessage(playerid, COLOR_GREY,"* You cannot afford this!");
  312. }
  313. }
  314.  
  315. if(listitem == 6) // Sniper
  316. {
  317.  
  318. if(PlayerInfo[playerid][ptokens] >= 5)
  319. {
  320. SendClientMessage(playerid, COLOR_GREY,"* Recieved your GUN, HAVE FUN ! ");
  321. PlayerInfo[playerid][ptokens] -= 5;
  322. GivePlayerWeapon(playerid, 34, 50);
  323. new INI:File = INI_Open(UserPath(playerid));
  324. INI_SetTag(File, "VIP Tokens");
  325. INI_WriteInt(File,"Tokens:", PlayerInfo[playerid][ptokens]);
  326. INI_Close(File);
  327. }
  328. else
  329. {
  330. SendClientMessage(playerid, COLOR_GREY,"* You cannot afford this!");
  331. }
  332. }
  333. }
  334. return 1;
  335. }
Add Comment
Please, Sign In to add comment