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

Moneybag System by ThatFag