Guest User

Moneybag System by ThatFag

a guest
Jan 29th, 2017
322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.11 KB | None | 0 0
  1. /*
  2. ----------------------------------------------[MONEYBAG SYSTEM MADE BY THATFAG - SAMP FORUMS]---------------------------------------------------------------------
  3. PLEASE FOR ANYONE THAT IS USING THIS SCRIPT DO NOT REMOVE THE CREDITS OR TAKE IT AS YOUR OWN WORK, THANK YOU.
  4. */
  5.  
  6. #include <a_samp>
  7. #include <zcmd>
  8. #include <dini>
  9. #include <streamer>
  10. #define MAX_BAGS 30
  11.  
  12. public OnFilterScriptInit()
  13. {
  14. print("\n--------------------------------------");
  15. print(" MONEYBAG SYSTEM BY THATFAG - SAMP FORUMS");
  16. print(" MONEYBAG SYSTEM BY THATFAG - SAMP FORUMS");
  17. print(" MONEYBAG SYSTEM BY THATFAG - SAMP FORUMS");
  18. print("--------------------------------------\n");
  19. return 1;
  20. }
  21.  
  22. public OnFilterScriptExit()
  23. {
  24. return 1;
  25. }
  26. enum eBags
  27. {
  28. BagAmount,
  29. BagPickup,
  30. Text3D:BagLabel,
  31. Float:BagX,
  32. Float:BagY,
  33. Float:BagZ,
  34. }
  35. new BagInfo[MAX_BAGS][eBags];
  36. stock ReturnNextUnusedBag()
  37. {
  38. new path[32];
  39. for(new a=0;a<MAX_BAGS;a++)
  40. {
  41. format(path,sizeof(path),"Bags/%d.txt",a);
  42. if(dini_Exists(path)) continue;
  43. return a;
  44. }
  45. return -1;
  46. }
  47. stock CreateBag(Float:x,Float:y,Float:z, Amount)
  48. {
  49. for(new e=0;e<MAX_BAGS;e++)
  50. {
  51. new bagid=ReturnNextUnusedBag();
  52. new path[32],string[50];
  53. format(path,sizeof(path),"Bags/%d.txt",e);
  54. dini_FloatSet(path,"X",x);
  55. dini_FloatSet(path,"Y",y);
  56. dini_FloatSet(path,"Z",z);
  57. dini_IntSet(path,"amount", Amount);
  58. BagInfo[bagid][BagX] = x;
  59. BagInfo[bagid][BagY] = y;
  60. BagInfo[bagid][BagZ] = z;
  61. format(string, sizeof(string), "Bag ID[%d] - BagAmount [%d]",bagid,dini_Int(path,"amount"));
  62. BagInfo[bagid][BagLabel]= CreateDynamic3DTextLabel(string, 0xFFFFFFFF, BagInfo[bagid][BagX],BagInfo[bagid][BagY],BagInfo[bagid][BagZ],10);
  63. BagInfo[bagid][BagPickup] = CreateDynamicPickup(1550,1,x,y,z-0.5);
  64. return bagid;
  65. }
  66. return 1;
  67. }
  68. COMMAND:createbag(playerid, params[])
  69. {
  70. new atmid=ReturnNextUnusedBag(), iamount;
  71. printf("%d",atmid);
  72. if( sscanf ( params, "d",iamount)) return SendClientMessage(playerid,-1, "/createbag [bag cash]");
  73. new hf[64];
  74. new Float: x, Float: y, Float: z, Float: a;
  75. GetPlayerPos(playerid,x,y,z);
  76. GetPlayerFacingAngle(playerid,a);
  77. format(hf,sizeof(hf),"Bags/%d.txt",atmid);
  78. if(!dini_Exists(hf))
  79. {
  80. dini_Create(hf);
  81. dini_FloatSet(hf,"X",x);
  82. dini_IntSet(hf,"amount",iamount);
  83. dini_FloatSet(hf,"Y",y);
  84. dini_FloatSet(hf,"Z",z);
  85. BagInfo[atmid][BagAmount] = iamount;
  86. CreateBag(x,y,z,iamount);
  87. return 1;
  88. }
  89. return 1;
  90. }
  91. stock LoadBags()
  92. {
  93. new file[64], string[50];
  94. for(new e=0;e<MAX_BAGS;e++)
  95. {
  96. format(file,sizeof(file),"Bags/%d.txt",e);
  97. new Float: X, Float: Y, Float: Z,Amount;
  98. X = dini_Float(file,"X");
  99. Y = dini_Float(file,"Y");
  100. Z = dini_Float(file,"Z");
  101. Amount = dini_Int(file,"amount");
  102. if(dini_Exists(file))
  103. {
  104. BagInfo[e][BagX]=X;
  105. BagInfo[e][BagY]=Y;
  106. BagInfo[e][BagZ]=Z;
  107. BagInfo[e][BagAmount] = Amount;
  108. BagInfo[e][BagPickup] = CreateDynamicPickup(1550,1,X,Y,Z);
  109. format(string, sizeof(string), "Bag ID[%d] - BagAmount [%d]",e,dini_Int(file,"amount"));
  110. BagInfo[e][BagLabel]= CreateDynamic3DTextLabel(string, 0xFFFFFFFF, BagInfo[e][BagX],BagInfo[e][BagY],BagInfo[e][BagZ],10);
  111. }
  112. }
  113. printf("Bags loaded successfully.");
  114. return 1;
  115. }
  116. COMMAND:pickbag(playerid, params[])
  117. {
  118. for(new e=0;e<MAX_BAGS;e++)
  119. {
  120. if(IsPlayerInRangeOfPoint(playerid,5, BagInfo[e][BagX],BagInfo[e][BagY],BagInfo[e][BagZ]))
  121. {
  122. new file[64],Amount;
  123. format(file,sizeof(file),"Bags/%d.txt",e);
  124. Amount = dini_Int(file,"amount");
  125. BagInfo[playerid][BagAmount] = Amount;
  126. GivePlayerMoney(playerid, BagInfo[playerid][BagAmount]);
  127. dini_Remove(file);
  128. DestroyDynamicPickup(BagInfo[e][BagPickup]);
  129. DestroyDynamic3DTextLabel(BagInfo[e][BagLabel]);
  130. }
  131. }
  132. return 1;
  133. }
  134. COMMAND:deletebag(playerid, params[])
  135. {
  136. new id;
  137. if( sscanf ( params, "d", id)) return SendClientMessage(playerid,-1, "[Bag ID]");
  138. new hf[64];
  139. format(hf,sizeof(hf),"Bags/%d.txt",id);
  140. if(!dini_Exists(hf)) return SendClientMessage(playerid,-1,"There is no bag with this ID");
  141. dini_Remove(hf);
  142. DestroyDynamicPickup(BagInfo[id][BagPickup]);
  143. DestroyDynamic3DTextLabel(BagInfo[id][BagLabel]);
  144. return 1;
  145. }
  146. main()
  147. {
  148. print("\n----------------------------------");
  149. print(" Blank Gamemode by your name here");
  150. print("----------------------------------\n");
  151. }
  152.  
  153. public OnGameModeInit()
  154. {
  155. // Don't use these lines if it's a filterscript
  156. SetGameModeText("Blank Script");
  157. LoadBags();
  158. AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  159. return 1;
  160. }
  161.  
  162. public OnGameModeExit()
  163. {
  164. return 1;
  165. }
  166.  
  167. public OnPlayerRequestClass(playerid, classid)
  168. {
  169. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  170. SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  171. SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  172. return 1;
  173. }
  174.  
  175. public OnPlayerConnect(playerid)
  176. {
  177. return 1;
  178. }
  179.  
  180. public OnPlayerDisconnect(playerid, reason)
  181. {
  182. return 1;
  183. }
  184.  
  185. public OnPlayerSpawn(playerid)
  186. {
  187. return 1;
  188. }
  189.  
  190. public OnPlayerDeath(playerid, killerid, reason)
  191. {
  192. return 1;
  193. }
  194.  
  195. public OnVehicleSpawn(vehicleid)
  196. {
  197. return 1;
  198. }
  199.  
  200. public OnVehicleDeath(vehicleid, killerid)
  201. {
  202. return 1;
  203. }
  204.  
  205. public OnPlayerText(playerid, text[])
  206. {
  207. return 1;
  208. }
  209.  
  210.  
  211. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  212. {
  213. return 1;
  214. }
  215.  
  216. public OnPlayerExitVehicle(playerid, vehicleid)
  217. {
  218. return 1;
  219. }
  220.  
  221. public OnPlayerStateChange(playerid, newstate, oldstate)
  222. {
  223. return 1;
  224. }
  225.  
  226. public OnPlayerEnterCheckpoint(playerid)
  227. {
  228. return 1;
  229. }
  230.  
  231. public OnPlayerLeaveCheckpoint(playerid)
  232. {
  233. return 1;
  234. }
  235.  
  236. public OnPlayerEnterRaceCheckpoint(playerid)
  237. {
  238. return 1;
  239. }
  240.  
  241. public OnPlayerLeaveRaceCheckpoint(playerid)
  242. {
  243. return 1;
  244. }
  245.  
  246. public OnRconCommand(cmd[])
  247. {
  248. return 1;
  249. }
  250.  
  251. public OnPlayerRequestSpawn(playerid)
  252. {
  253. return 1;
  254. }
  255.  
  256. public OnObjectMoved(objectid)
  257. {
  258. return 1;
  259. }
  260.  
  261. public OnPlayerObjectMoved(playerid, objectid)
  262. {
  263. return 1;
  264. }
  265.  
  266. public OnPlayerPickUpPickup(playerid, pickupid)
  267. {
  268. return 1;
  269. }
  270.  
  271. public OnVehicleMod(playerid, vehicleid, componentid)
  272. {
  273. return 1;
  274. }
  275.  
  276. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  277. {
  278. return 1;
  279. }
  280.  
  281. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  282. {
  283. return 1;
  284. }
  285.  
  286. public OnPlayerSelectedMenuRow(playerid, row)
  287. {
  288. return 1;
  289. }
  290.  
  291. public OnPlayerExitedMenu(playerid)
  292. {
  293. return 1;
  294. }
  295.  
  296. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  297. {
  298. return 1;
  299. }
  300.  
  301. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  302. {
  303. return 1;
  304. }
  305.  
  306. public OnRconLoginAttempt(ip[], password[], success)
  307. {
  308. return 1;
  309. }
  310.  
  311. public OnPlayerUpdate(playerid)
  312. {
  313. return 1;
  314. }
  315.  
  316. public OnPlayerStreamIn(playerid, forplayerid)
  317. {
  318. return 1;
  319. }
  320.  
  321. public OnPlayerStreamOut(playerid, forplayerid)
  322. {
  323. return 1;
  324. }
  325.  
  326. public OnVehicleStreamIn(vehicleid, forplayerid)
  327. {
  328. return 1;
  329. }
  330.  
  331. public OnVehicleStreamOut(vehicleid, forplayerid)
  332. {
  333. return 1;
  334. }
  335.  
  336. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  337. {
  338. return 1;
  339. }
  340.  
  341. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  342. {
  343. return 1;
  344. }
Add Comment
Please, Sign In to add comment