Guest User

Money Drop FS

a guest
Jul 17th, 2013
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.94 KB | None | 0 0
  1. #if defined MoneyDropFilterscript
  2.  
  3. Just the filterscript have a command /dropmoney and drop money that's all :yaoming:
  4.  
  5. Money Drop Filterscript by xGanyx
  6.  
  7. Pawn compiler 3.2.3664 Copyright (c) 2013, ITB CompuPhase
  8.  
  9. #endif
  10. //includes
  11. #include <a_samp>
  12. #include <zcmd>
  13.  
  14. //dialog
  15. #define DIALOG_MAIN 1554
  16. #define DIALOG_CASH 1555
  17. #define DIALOG_ICON 1556
  18. #define DIALOG_BAG 1557
  19. //Colors
  20. #define Red 0xFF0000FF
  21. #define Green 0x00FF40FF
  22. #define Yellow 0xFFFF00FF
  23. //defines
  24. #define cmoneycp 1
  25. #define imoneycp 2
  26. #define bmoneycp 3
  27. //pragma
  28. #pragma tabsize 0
  29.  
  30. //to make the money
  31. new cmoney;
  32. new imoney;
  33. new bmoney;
  34. //Pickups
  35. new cmoneypick;
  36. new imoneypick;
  37. new bmoneypick;
  38. //Others
  39. new fmoney[MAX_PLAYERS];
  40. new pname[MAX_PLAYERS][MAX_PLAYER_NAME];
  41. //Float
  42. new Float:cmoneyx,Float:cmoneyy,Float:cmoneyz;
  43. new Float:imoneyx,Float:imoneyy,Float:imoneyz;
  44. new Float:bmoneyx,Float:bmoneyy,Float:bmoneyz;
  45.  
  46. enum cPickinfo
  47. {
  48. Float:cPickX,
  49. Float:cPickY,
  50. Float:cPickZ,
  51. chavefmoney
  52. }
  53. new cPickupInfo[MAX_PICKUPS][cPickinfo];
  54.  
  55. enum iPickinfo
  56. {
  57. Float:iPickX,
  58. Float:iPickY,
  59. Float:iPickZ,
  60. ihavefmoney
  61. }
  62. new iPickupInfo[MAX_PICKUPS][iPickinfo];
  63.  
  64. enum bPickinfo
  65. {
  66. Float:bPickX,
  67. Float:bPickY,
  68. Float:bPickZ,
  69. bhavefmoney
  70. }
  71. new bPickupInfo[MAX_PICKUPS][bPickinfo];
  72.  
  73. public OnFilterScriptInit()
  74. {
  75. print(" Money Drop FilterScript Loaded");
  76. return 1;
  77. }
  78.  
  79. public OnPlayerPickUpPickup(playerid,pickupid)
  80. {
  81. if(pickupid == cmoneypick)
  82. {
  83. if(cPickupInfo[cmoneypick][chavefmoney] == 1)
  84. {
  85. new string[128];
  86. GivePlayerMoney(playerid,cmoney);
  87. DestroyPickup(cmoneypick);
  88. format(string,sizeof(string),"%s has pickup the drop money",pname[playerid]);
  89. SendClientMessageToAll(Yellow,string);
  90. cPickupInfo[cmoneypick][chavefmoney] = 0;
  91. }
  92. }
  93. if(pickupid == imoneypick)
  94. {
  95. if(iPickupInfo[imoneypick][ihavefmoney] == 1)
  96. {
  97. new string[128];
  98. GivePlayerMoney(playerid,imoney);
  99. DestroyPickup(imoneypick);
  100. format(string,sizeof(string),"%s has pickup the drop money",pname[playerid]);
  101. SendClientMessageToAll(Yellow,string);
  102. iPickupInfo[imoneypick][ihavefmoney] = 0;
  103. }
  104. }
  105. if(pickupid == bmoneypick)
  106. {
  107. if(bPickupInfo[bmoneypick][bhavefmoney] == 1)
  108. {
  109. new string[128];
  110. GivePlayerMoney(playerid,bmoney);
  111. DestroyPickup(bmoneypick);
  112. format(string,sizeof(string),"%s has pickup the drop money",pname[playerid]);
  113. SendClientMessageToAll(Yellow,string);
  114. bPickupInfo[bmoneypick][bhavefmoney] = 0;
  115. }
  116. }
  117. return 1;
  118. }
  119.  
  120. public OnPlayerEnterCheckpoint(playerid)
  121. {
  122. if(fmoney[playerid] == cmoneycp)
  123. {
  124. DisablePlayerCheckpoint(playerid);
  125. }
  126. if(fmoney[playerid] == imoneycp)
  127. {
  128. DisablePlayerCheckpoint(playerid);
  129. }
  130. return 1;
  131. }
  132.  
  133. COMMAND:dropmoney(playerid,params[])
  134. {
  135. ShowPlayerDialog(playerid,DIALOG_MAIN,DIALOG_STYLE_LIST,"Please Choose Pay","Cash = 1 - 1000$\nicon = 1001 - 4000$\n Money Bag = 4000$ >>>","Choose","Cancel");
  136. return 1;
  137. }
  138.  
  139. COMMAND:testdropmoney(playerid,params[])
  140. {
  141. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,Red,"You not authorized to use this command");
  142. GivePlayerMoney(playerid,10000);
  143. return 1;
  144. }
  145.  
  146. COMMAND:findmoney(playerid,params[])
  147. {
  148. if(cPickupInfo[cmoneypick][chavefmoney] == 1)
  149. {
  150. fmoney[playerid] = cmoneycp;
  151. SetPlayerCheckpoint(playerid,cmoneyx,cmoneyy,cmoneyz,3.0);
  152. }
  153. if(iPickupInfo[imoneypick][ihavefmoney] == 1)
  154. {
  155. fmoney[playerid] = imoneycp;
  156. SetPlayerCheckpoint(playerid,imoneyx,cmoneyy,cmoneyz,3.0);
  157. }
  158. if(bPickupInfo[bmoneypick][bhavefmoney] == 1)
  159. {
  160. fmoney[playerid] = bmoneycp;
  161. SetPlayerCheckpoint(playerid,bmoneyx,bmoneyy,bmoneyz,3.0);
  162. }
  163. else return SendClientMessage(playerid,Red,"Don't have any drop money to find");
  164. return 1;
  165. }
  166.  
  167. public OnDialogResponse(playerid,dialogid,response,listitem,inputtext[])
  168. {
  169. switch(dialogid)
  170. {
  171. case DIALOG_MAIN:
  172. {
  173. if(response)
  174. {
  175. switch(listitem)
  176. {
  177. case 0:
  178. {
  179. if(GetPlayerMoney(playerid) >= 1)
  180. {
  181. ShowPlayerDialog(playerid,DIALOG_CASH,DIALOG_STYLE_INPUT,"Money Drop","Put the money you want to drop here","Done","Cancel");
  182. }
  183. else return SendClientMessage(playerid,Red,"You don't have enough money to use this");
  184. }
  185. case 1:
  186. {
  187. if(GetPlayerMoney(playerid) >= 1001)
  188. {
  189. ShowPlayerDialog(playerid,DIALOG_ICON,DIALOG_STYLE_INPUT,"Money Drop","Put the money you want to drop here","Done","Cancel");
  190. }
  191. else return SendClientMessage(playerid,Red,"You don't have enough money to use this");
  192. }
  193. case 2:
  194. {
  195. if(GetPlayerMoney(playerid) >= 4000)
  196. {
  197. ShowPlayerDialog(playerid,DIALOG_BAG,DIALOG_STYLE_INPUT,"Money Drop","Put the money you want to drop here","Done","Cancel");
  198. }
  199. else return SendClientMessage(playerid,Red,"You don't have enough money to use this");
  200. }
  201. }
  202. }
  203. }
  204. case DIALOG_CASH:
  205. {
  206. if(response)
  207. {
  208. if(response)
  209. {
  210. if(strval(inputtext) < 1000)
  211. {
  212. new string[128];
  213. cmoney = strval(inputtext);
  214. cPickupInfo[cmoneypick][chavefmoney] = 1;
  215. cPickupInfo[cmoneypick][cPickX] = cmoneyx;
  216. cPickupInfo[cmoneypick][cPickY] = cmoneyy;
  217. cPickupInfo[cmoneypick][cPickZ] = cmoneyz;
  218. if(strval(inputtext) > GetPlayerMoney(playerid)) return SendClientMessage(playerid,Red,"You don't have enough money");
  219. if(strval(inputtext) > 1000) return SendClientMessage(playerid,Red,"Money cannot higher than 1000$ if you want more use icon");
  220. GetPlayerName(playerid,pname[playerid],MAX_PLAYER_NAME);
  221. GivePlayerMoney(playerid,-strval(inputtext));
  222. GetPlayerPos(playerid,cmoneyx,cmoneyy,cmoneyz);
  223. cmoneypick = CreatePickup(1212,1,cmoneyx,cmoneyy+2,cmoneyz,0);
  224. format(string,sizeof(string),"%s has drop he or she money. /findmoney to find it.",pname[playerid]);
  225. SendClientMessageToAll(Green,string);
  226. }
  227. }
  228. }
  229. }
  230. case DIALOG_ICON:
  231. {
  232. if(response)
  233. {
  234. if(strval(inputtext) < 4000 || strval(inputtext) > 1000)
  235. {
  236. new string[128];
  237. imoney = strval(inputtext);
  238. iPickupInfo[imoneypick][ihavefmoney] = 1;
  239. iPickupInfo[imoneypick][iPickX] = imoneyx;
  240. iPickupInfo[imoneypick][iPickY] = imoneyy;
  241. iPickupInfo[imoneypick][iPickZ] = imoneyz;
  242. if(strval(inputtext) > 4000) return SendClientMessage(playerid,Red,"Money cannot higher than 1000$ if you want more use Bag Money");
  243. if(strval(inputtext) > GetPlayerMoney(playerid)) return SendClientMessage(playerid,Red,"You don't have enough money");
  244. GetPlayerName(playerid,pname[playerid],MAX_PLAYER_NAME);
  245. GetPlayerPos(playerid,imoneyx,imoneyy,imoneyz);
  246. imoneypick = CreatePickup(1274,1,imoneyx,imoneyy,imoneyz,0);
  247. format(string,sizeof(string),"%s has drop he or she money. /findmoney to find it.",pname[playerid]);
  248. SendClientMessageToAll(Green,string);
  249. }
  250. }
  251. }
  252. case DIALOG_BAG:
  253. {
  254. if(response)
  255. {
  256. if(strval(inputtext) > 4000)
  257. {
  258. new string[128];
  259. bmoney = strval(inputtext);
  260. bPickupInfo[bmoneypick][bhavefmoney] = 1;
  261. bPickupInfo[bmoneypick][bPickX] = bmoneyx;
  262. bPickupInfo[bmoneypick][bPickY] = bmoneyy;
  263. bPickupInfo[bmoneypick][bPickZ] = bmoneyz;
  264. if(strval(inputtext) > GetPlayerMoney(playerid)) return SendClientMessage(playerid,Red,"You don't have enough money");
  265. GetPlayerName(playerid,pname[playerid],MAX_PLAYER_NAME);
  266. GetPlayerPos(playerid,bmoneyx,bmoneyy,bmoneyz);
  267. bmoneypick = CreatePickup(1276,1,bmoneyx,bmoneyy,bmoneyz,0);
  268. format(string,sizeof(string),"%s has drop he or she money. /findmoney to find it.",pname[playerid]);
  269. SendClientMessageToAll(Green,string);
  270. }
  271. }
  272. }
  273. }
  274. return 1;
  275. }
  276.  
  277. stock IsNumeric( string[ ] ) { for (new i = 0, j = strlen( string); i < j; i++) if ( string[i] > '9' || string[i] < '0') return 0; return 1; }
Add Comment
Please, Sign In to add comment