Advertisement
Guest User

Untitled

a guest
Mar 19th, 2015
3,154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.72 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3. #define FILTERSCRIPT
  4. #define COLOR_ERROR 0xAA3333AA
  5. #define COLOR_NOTIFICATION 0x33CCFFAA
  6. #define DIALOG_FISHJUSTCAUGHT 3223
  7. #define Fish_Price 3
  8.  
  9. new
  10. FishingRod[MAX_PLAYERS],
  11. FishOnPlayer[MAX_PLAYERS],
  12. FishWeigh[MAX_PLAYERS];
  13.  
  14. new Float:FishingPosX[MAX_PLAYERS],Float:FishingPosY[MAX_PLAYERS],Float:FishingPosZ[MAX_PLAYERS];
  15.  
  16. #if defined FILTERSCRIPT
  17.  
  18. public OnFilterScriptInit()
  19. {
  20. print("\n--------------------------------------");
  21. print(" Blank Filterscript by your name here");
  22. print("--------------------------------------\n");
  23.  
  24. Create3DTextLabel("Pier Shop\n/Buyrod\n/sellfish", 0x008080FF, 378.6885,-2061.8040,7.8359, 40.0, 0, 1);
  25. Create3DTextLabel("Fishing Spot",0x008080FF, 403.9774,-2088.6292,7.8359, 40.0, 0, 1);
  26. Create3DTextLabel("Fishing Spot",0x008080FF, 383.0248,-2088.5334,7.8359, 40.0, 0, 1);
  27. Create3DTextLabel("Fishing Spot",0x008080FF, 356.4932,-2088.7969,7.8359, 40.0, 0, 1);
  28. Create3DTextLabel("Los Santos Fishing Pier",0x008080FF, 383.7704,-2048.6101,7.8359, 40.0, 0, 1);
  29.  
  30.  
  31. /* Fishing Pier */
  32. CreateObject(970, 379.95294, -2014.83093, 7.32475, 0.00000, 0.00000, 90.00000);
  33. CreateObject(970, 379.95575, -2018.95471, 7.32475, 0.00000, 0.00000, 90.00000);
  34. CreateObject(970, 379.54205, -2032.41858, 7.32475, 0.00000, 0.00000, 90.00000);
  35. CreateObject(970, 379.54211, -2036.54163, 7.32470, 0.00000, 0.00000, 90.00000);
  36. CreateObject(970, 379.54211, -2040.72363, 7.32470, 0.00000, 0.00000, 90.00000);
  37. CreateObject(970, 379.54211, -2044.90564, 7.32470, 0.00000, 0.00000, 90.00000);
  38. CreateObject(970, 379.54211, -2049.08765, 7.32470, 0.00000, 0.00000, 90.00000);
  39. CreateObject(970, 392.42929, -2049.80054, 7.32470, 0.00000, 0.00000, 0.00000);
  40. CreateObject(10183, 395.28754, -2034.53809, 6.83220, 0.00000, 0.00000, -45.00000);
  41. CreateObject(970, 387.01730, -2049.80054, 7.32470, 0.00000, 0.00000, 0.00000);
  42. CreateObject(970, 381.60529, -2049.80054, 7.32470, 0.00000, 0.00000, 0.00000);
  43. CreateObject(970, 355.20148, -2050.41016, 7.32470, 0.00000, 0.00000, 90.00000);
  44. CreateObject(1215, 379.90939, -2014.85681, 7.37500, 356.85840, 0.00000, 3.14159);
  45. CreateObject(1215, 379.90939, -2019.03882, 7.37500, 356.85840, 0.00000, 3.14160);
  46. CreateObject(1215, 379.90933, -2021.27283, 7.37500, 356.85840, 0.00000, 3.14160);
  47. CreateObject(8406, 379.88095, -2028.95129, 12.19460, 0.00000, 0.00000, 89.00000);
  48. CreateObject(19425, 379.99271, -2023.55029, 6.83330, 0.00000, 0.00000, 90.00000);
  49. CreateObject(19425, 379.99271, -2027.97827, 6.83330, 0.00000, 0.00000, 90.00000);
  50. CreateObject(970, 398.60422, -2049.38306, 7.32470, 0.00000, 0.00000, 76.00000);
  51. CreateObject(1280, 379.63022, -2017.23962, 7.21094, 3.14159, 0.00000, 3.13624);
  52. CreateObject(1280, 379.20010, -2032.44482, 7.21094, 3.14159, 0.00000, 3.13624);
  53. CreateObject(1280, 379.19434, -2037.98877, 7.21094, 3.14159, 0.00000, 3.13624);
  54. CreateObject(1280, 379.25299, -2044.29431, 7.21094, 3.14159, 0.00000, 3.13624);
  55. CreateObject(1522, 378.20685, -2062.60962, 6.81255, 0.00000, 0.00000, 90.00000);
  56. CreateObject(1232, 364.87814, -2047.01599, 9.50000, 356.85840, 0.00000, 3.14159);
  57. CreateObject(1232, 392.43045, -2049.78467, 9.50000, 356.85840, 0.00000, 3.14159);
  58. CreateObject(1232, 387.01849, -2049.66162, 9.50000, 356.85840, 0.00000, 3.14160);
  59. CreateObject(1232, 381.60651, -2049.66162, 9.50000, 356.85840, 0.00000, 3.14160);
  60.  
  61. return 1;
  62. }
  63.  
  64. public OnFilterScriptExit()
  65. {
  66. return 1;
  67. }
  68.  
  69. #else
  70. #endif
  71.  
  72.  
  73. public OnPlayerConnect(playerid)
  74. {
  75. /* Fishing Pier stuff removed */
  76. RemoveBuildingForPlayer(playerid, 6463, 389.7734, -2028.4688, 19.8047, 0.25);
  77. RemoveBuildingForPlayer(playerid, 3751, 389.8750, -2028.5000, 32.2266, 0.25);
  78. RemoveBuildingForPlayer(playerid, 3751, 389.8750, -2021.6406, 29.9297, 0.25);
  79. RemoveBuildingForPlayer(playerid, 3751, 389.8750, -2017.4531, 24.0313, 0.25);
  80. RemoveBuildingForPlayer(playerid, 3751, 389.8750, -2017.4297, 16.8516, 0.25);
  81. RemoveBuildingForPlayer(playerid, 3751, 389.8750, -2021.6328, 10.9844, 0.25);
  82. RemoveBuildingForPlayer(playerid, 3751, 389.8750, -2028.5156, 8.7813, 0.25);
  83. RemoveBuildingForPlayer(playerid, 3751, 389.8750, -2035.3984, 10.9453, 0.25);
  84. RemoveBuildingForPlayer(playerid, 3751, 389.8750, -2039.6406, 16.8438, 0.25);
  85. RemoveBuildingForPlayer(playerid, 3751, 389.8750, -2039.6563, 24.1094, 0.25);
  86. RemoveBuildingForPlayer(playerid, 3751, 389.8750, -2035.3828, 29.9531, 0.25);
  87. RemoveBuildingForPlayer(playerid, 1232, 364.6094, -2036.1797, 9.5000, 0.25);
  88. RemoveBuildingForPlayer(playerid, 1280, 378.4609, -2012.9297, 7.2109, 0.25);
  89. RemoveBuildingForPlayer(playerid, 1215, 386.5703, -2061.9531, 7.3750, 0.25);
  90. RemoveBuildingForPlayer(playerid, 1215, 379.5938, -2042.4922, 7.3750, 0.25);
  91. RemoveBuildingForPlayer(playerid, 1215, 379.5938, -2016.7500, 7.3750, 0.25);
  92. RemoveBuildingForPlayer(playerid, 1215, 386.5703, -2049.3516, 7.3750, 0.25);
  93. RemoveBuildingForPlayer(playerid, 1340, 388.8594, -2071.6641, 7.9453, 0.25);
  94. RemoveBuildingForPlayer(playerid, 3752, 389.8750, -2039.6406, 16.8438, 0.25);
  95. RemoveBuildingForPlayer(playerid, 3752, 389.8750, -2039.6563, 24.1094, 0.25);
  96. RemoveBuildingForPlayer(playerid, 6298, 389.7734, -2028.4688, 19.8047, 0.25);
  97. RemoveBuildingForPlayer(playerid, 6461, 389.7734, -2028.5000, 20.1094, 0.25);
  98. RemoveBuildingForPlayer(playerid, 3752, 389.8750, -2028.5000, 32.2266, 0.25);
  99. RemoveBuildingForPlayer(playerid, 3752, 389.8750, -2021.6406, 29.9297, 0.25);
  100. RemoveBuildingForPlayer(playerid, 3752, 389.8750, -2017.4531, 24.0313, 0.25);
  101. RemoveBuildingForPlayer(playerid, 3752, 389.8750, -2017.4297, 16.8516, 0.25);
  102. RemoveBuildingForPlayer(playerid, 3752, 389.8750, -2021.6328, 10.9844, 0.25);
  103. RemoveBuildingForPlayer(playerid, 3752, 389.8750, -2028.5156, 8.7813, 0.25);
  104. RemoveBuildingForPlayer(playerid, 3752, 389.8750, -2035.3984, 10.9453, 0.25);
  105. RemoveBuildingForPlayer(playerid, 3752, 389.8750, -2035.3828, 29.9531, 0.25);
  106.  
  107.  
  108. SendClientMessage(playerid,COLOR_NOTIFICATION,"Fishing job created by TwinkiDaBoss (Type /fishinghelp to find all commands for the job).");
  109. return 1;
  110. }
  111.  
  112. //Commands
  113.  
  114. CMD:fishinghelp(playerid,params[])
  115. {
  116. SendClientMessage(playerid,COLOR_NOTIFICATION,"Type /fish to start fishing. You must be near some of the fishing spots (LS Fishing Pier)");
  117. SendClientMessage(playerid,COLOR_NOTIFICATION,"Type /Sellfish to sell your fishes and get money from it");
  118. SendClientMessage(playerid,COLOR_NOTIFICATION,"Type /fishes to see how many Kilograms of fish you have on you");
  119. SendClientMessage(playerid,COLOR_NOTIFICATION,"Type /buyrod to buy a fishing rod");
  120. return true;
  121. }
  122.  
  123.  
  124. CMD:fish(playerid,params[])
  125. {
  126. new Float:x,Float:y,Float:z;
  127.  
  128. if(IsPlayerInRangeOfPoint(playerid,10.0,354.3251,-2088.7981,7.8359) || IsPlayerInRangeOfPoint(playerid,10.0,362.3351,-2088.7979,7.8359) ||
  129. IsPlayerInRangeOfPoint(playerid,10.0,367.0258,-2088.7979,7.8359) || IsPlayerInRangeOfPoint(playerid,10.0,369.7540,-2088.7981,7.8359) ||
  130. IsPlayerInRangeOfPoint(playerid,10.0,374.0645,-2088.7969,7.8359) || IsPlayerInRangeOfPoint(playerid,10.0,383.3422,-2088.7974,7.8359) ||
  131. IsPlayerInRangeOfPoint(playerid,10.0,390.2083,-2088.7983,7.8359) || IsPlayerInRangeOfPoint(playerid,10.0,396.6046,-2088.7979,7.8359) ||
  132. IsPlayerInRangeOfPoint(playerid,10.0,403.5682,-2088.7976,7.8359) || IsPlayerInRangeOfPoint(playerid,10.0,409.2429,-2088.6521,7.8359))
  133. {
  134. if(FishingRod[playerid] == 0)
  135. return SendClientMessage(playerid,COLOR_ERROR,"You must have a fishing rod in order to fish!");
  136.  
  137. if(IsPlayerInRangeOfPoint(playerid,5.0,FishingPosX[playerid],FishingPosY[playerid],FishingPosZ[playerid]))
  138. return SendClientMessage(playerid,COLOR_ERROR,"You cannot fish at the same place like before! Move little bit!");
  139.  
  140. if(FishOnPlayer[playerid] >= 10)
  141. return SendClientMessage(playerid,COLOR_ERROR,"You have already caught more than 10 fishes! Go sell them first.");
  142.  
  143. GetPlayerPos(playerid,x,y,z);
  144. FishingPosX[playerid] = x;
  145. FishingPosY[playerid] = y;
  146. FishingPosZ[playerid] = z;
  147. FishWeigh[playerid] = 0;
  148. ApplyAnimation(playerid,"SWORD","sword_block",50.0 ,0,1,0,1,1);
  149. SetPlayerAttachedObject(playerid, 0,18632,6,0.079376,0.037070,0.007706,181.482910,0.000000,0.000000,1.000000,1.000000,1.000000);
  150. SetTimerEx("PlayerFishing",5000,false,"i",playerid);
  151. SendClientMessage(playerid,COLOR_NOTIFICATION,"Fishing... Do not move");
  152. }
  153. else SendClientMessage(playerid,COLOR_ERROR,"You are not near any fishing spot");
  154. return true;
  155. }
  156.  
  157. CMD:fishes(playerid,params[])
  158. {
  159. new string[128];
  160. format(string,sizeof(string),"You currently have %i kilograms of fish on you",FishWeigh[playerid]);
  161. SendClientMessage(playerid,COLOR_NOTIFICATION,string);
  162. return true;
  163. }
  164.  
  165. CMD:buyrod(playerid, params[])
  166. {
  167. if(!IsPlayerInRangeOfPoint(playerid,5.0,379.1845,-2062.6423,7.8359))
  168. return SendClientMessage(playerid,COLOR_ERROR,"You are not near the Fishing Pier Shop");
  169.  
  170. if(GetPlayerMoney(playerid) < 50) //Replace with your variable
  171. return SendClientMessage(playerid,COLOR_ERROR,"You dont have enough money. Required 50$");
  172.  
  173. if(FishingRod[playerid] >= 1)
  174. return SendClientMessage(playerid,COLOR_ERROR,"You already have a fishing rod!");
  175.  
  176.  
  177. GivePlayerMoney(playerid,-50);
  178. FishingRod[playerid] = 1;
  179. SendClientMessage(playerid,COLOR_NOTIFICATION,"You have purchased a fishing rod. 50$ was deducated from your wallet");
  180. return true;
  181. }
  182.  
  183. CMD:sellfish(playerid,params[])
  184. {
  185. if(!IsPlayerInRangeOfPoint(playerid,5.0,379.1845,-2062.6423,7.8359))
  186. return SendClientMessage(playerid,COLOR_ERROR,"You are not near the Fishing Pier Shop");
  187.  
  188. new string[128], pay;
  189. pay = FishWeigh[playerid]*Fish_Price;
  190. format(string,sizeof(string),"You have earned %i$ by selling your %i kilograms of fish",pay,FishWeigh[playerid]);
  191. SendClientMessage(playerid,COLOR_NOTIFICATION,string);
  192. FishWeigh[playerid] = 0;
  193. FishOnPlayer[playerid] = 0;
  194. GivePlayerMoney(playerid,pay);
  195. return true;
  196. }
  197.  
  198.  
  199. forward PlayerFishing(playerid);
  200. public PlayerFishing(playerid)
  201. {
  202. new fish = randomEx(1,5), str[128], moneybag = randomEx(10,200),string[128],fweight = randomEx(1,50);
  203. RemovePlayerAttachedObject(playerid,0);
  204. if(!IsPlayerInRangeOfPoint(playerid,3.0, FishingPosX[playerid],FishingPosY[playerid],FishingPosZ[playerid]))
  205. return SendClientMessage(playerid, COLOR_ERROR,"You have moved from your fishing spot. You failed catching the fish");
  206.  
  207. switch(fish)
  208. {
  209. case 1: { str = "{37DB45}Your fishing rod {FF0000}snaps {37DB45}as you try to catch the fish"; FishingRod[playerid] = 0; }
  210. case 2: { format(string,sizeof(string),"{37DB45}You have caught money bag holding {FF0000}%i$",moneybag); str = string; GivePlayerMoney(playerid, moneybag); }
  211. case 3: { format(string,sizeof(string),"{37DB45}You have caught {FF0000}%s {37DB45}weighting {FF0000}%i {37DB45}kilograms",GetFishSpecie(),fweight); str = string; FishWeigh[playerid] += fweight; FishOnPlayer[playerid] += 1;}
  212. case 4: str = "{37DB45}You reelin your rod to find out {FF0000}you havent caught anything";
  213. case 5: str = "{37DB45}You reelin your rod to find out you have caught a {FF0000}boot";
  214. }
  215. return ShowPlayerDialog(playerid, DIALOG_FISHJUSTCAUGHT, DIALOG_STYLE_MSGBOX, "Notice", str, "Close", "");
  216. }
  217.  
  218. stock GetFishSpecie()
  219. {
  220. new fishspecie = randomEx(0,10), strz[64];
  221. switch(fishspecie)
  222. {
  223. case 0: strz = "Shark";
  224. case 1: strz = "Barracuda";
  225. case 2: strz = "Silverfish";
  226. case 3: strz = "Bass";
  227. case 4: strz = "Batfish";
  228. case 5: strz = "Catfish";
  229. case 6: strz = "Black Tetra";
  230. case 7: strz = "Black Dragonfish";
  231. case 8: strz = "Carp";
  232. case 9: strz = "Boga";
  233. case 10: strz = "Eel";
  234. }
  235. return strz;
  236. }
  237.  
  238. stock randomEx(minnum = cellmin, maxnum = cellmax) return random(maxnum - minnum + 1) + minnum;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement