Advertisement
sseebbyy

FishingSystemv1.0_GUPS

Jul 30th, 2012
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 13.64 KB | None | 0 0
  1. #include <a_vcmp>
  2.  
  3. #define COLOR_GREY 0xAFAFAFAA
  4. #define NOTACCES 0xFF0000AA
  5. #define COLOR_GREEN 0x33AA33AA
  6. #define COLOR_RED 0xAA3333AA
  7. #define COLOR_YELLOW 0xFFFF00AA
  8. #define COLOR_WHITE 0xFFFFFFAA
  9. #define INACTIVE_PLAYER_ID 255
  10. #define BLUE 0x377DFFFF
  11. #define COLOR 0x377DFFFF
  12. #define COLOR_GREY 0xAFAFAFAA
  13. #define COLOUR_GREEN           0x33AA33AA
  14. #define COLOUR_RED             0xAA3333AA
  15. #define COLOUR_YELLOW          0xFFFF00AA
  16. #define COLOR_LIGHTBLUE        0x33CCFFAA
  17. #define COLOR_PINK             0xFFC0CBAA
  18. #define COLOR_ORANGE           0xFF9900AA
  19.  
  20. #define FILTERSCRIPT
  21.  
  22. //new gPlayers[MAX_PLAYERS][MAX_PLAYER_NAME+1];
  23. new boughtr[MAX_PLAYERS];
  24. new boughtw[MAX_PLAYERS];
  25. new fishing[MAX_PLAYERS];
  26. new hfish[MAX_PLAYERS];
  27.  
  28.  
  29. enum randomfishing {
  30.     tfish[256],
  31.     fish,
  32.     mon,
  33.     hp,
  34. }
  35.  
  36. new randomfish[][randomfishing] = {
  37. {"WoW... this is the golden fish !!!",1,15000,100},
  38. {"You fished a mandarin fish ![Good] !!!",1,3000,63},
  39. {"Cool, a Prussian Carp !",1,6300,12},
  40. {"Hahahaha... you fished a boot.",0,3000,0},
  41. {"You fished a cat fish!",1,5000,41},
  42. {"A Sea Snake, Cool  (^_^)",1,3000,1},
  43. {"LoL... You fished a hat [hahaha]",0,6000,0},
  44. {"You caught a carp of 1 kg ! [Good for you]",1,4000,30},
  45. {"Hahahaha... you fished a boot.",0,3000,0},
  46. {"Funny...You fished a small fish", 1,1000,10},
  47. {"That's your bad day... you failed to fishing",0,1000,40},
  48. {"This is your lucky day. You fished a big carp !!!",1,8000,50},
  49. {"This is a shoes ? Hahahah!",0,2000,12},
  50. {"Your fish escape!",0,1000,63}
  51. };
  52.  
  53. forward waitfish();
  54. forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
  55.  
  56. public OnFilterScriptInit()
  57. {
  58.     printf("------------------------------------------");
  59.     printf("Fishing System By Moby is allowed !");
  60.     printf("------------------------------------------");
  61.     return 1;
  62. }
  63.  
  64. public OnFilterScriptExit()
  65. {
  66.     printf("WARNING: The Fishing System By Moby can't be allowd !");
  67.    return 1;
  68. }
  69.  
  70. public OnPlayerDisconnect(playerid, reason)
  71. {
  72.     fishing[playerid] = 0;
  73.     boughtw[playerid] = 0;
  74.     boughtr[playerid] = 0;
  75.     hfish[playerid] = 0;
  76.     return 1;
  77. }
  78. public OnPlayerDeath(playerid,killerid,reason)
  79. {
  80.     fishing[playerid] = 0;
  81.     hfish[playerid] = 0;
  82.     return 1;
  83. }
  84. public OnPlayerCommandText(playerid,cmdtext[])
  85. {
  86.     if(strcmp(cmdtext, "fhelp", true) == 0) {
  87.         SendClientMessage(playerid,COLOR_YELLOW,"-----------Fishing Help-----------");
  88.         SendClientMessage(playerid,COLOR_YELLOW,"For a good job, type '/aim' before fishing !");
  89.         SendClientMessage(playerid,COLOR_YELLOW,"For eat,sell,live fish type '[/c] eatf, sellf,livef' !");
  90.         SendClientMessage(playerid,COLOR_YELLOW,"For Fishing type '/c fishing' !");
  91.         SendClientMessage(playerid,COLOR_YELLOW,"For buy rod and worms type '/c buyrod' , '/c buyworms' at magazine !");
  92.         SendClientMessage(playerid,COLOR_YELLOW,"For put the fishing rod in your hand type '/c rod' !");
  93.         SendClientMessage(playerid,COLOR_YELLOW,"-----------Fishing Help-----------");
  94.         return 1;
  95.         }
  96.     else if(strcmp(cmdtext, "rod", true) == 0) {
  97.         if(boughtr[playerid] == 1) {
  98.             GivePlayerWeapon(playerid,3,1);
  99.         }
  100.         if(boughtr[playerid] == 0) {
  101.             SendClientMessage(playerid,COLOR_GREEN,"You don't have a fishing rod! Go to magazine to buy!");
  102.         }
  103.         return 1;
  104.         }
  105.     else if(strcmp(cmdtext, "buyrod", true) == 0) {
  106.         if(PlayerToPoint(7, playerid, -712.7392, -1500.4816, 11.4436)) {
  107.             new cash = GetPlayerMoney(playerid);
  108.             if(boughtr[playerid] == 1) {
  109.             SendClientMessage(playerid,COLOR_YELLOW,"Already have a fishing rod!");
  110.             SendClientMessage(playerid,COLOR_YELLOW,"For put the rod in your hand type '/c rod' !");
  111.             }
  112.             if(boughtr[playerid] == 0) {
  113.             if(cash >= 5000) {
  114.             SendClientMessage(playerid,COLOR_YELLOW,"You bought a fishing rod!");
  115.             GivePlayerWeapon(playerid,3,1);
  116.             boughtr[playerid] = 1;
  117.             DecPlayerHandCash(playerid, 5000);
  118.             }
  119.             if(cash < 5000) {
  120.             SendClientMessage(playerid,COLOR_YELLOW,"Need more money ! Need $5000 for this rod!");
  121.             }
  122.             }
  123.             }
  124.             else
  125.             {
  126.             SendClientMessage(playerid,COLOR_YELLOW,"You not are at magazine!");
  127.             }
  128.         return 1;
  129.     }
  130.     else if(strcmp(cmdtext, "buyworms", true) == 0) {
  131.         if(PlayerToPoint(7, playerid, -712.7392, -1500.4816, 11.4436)) {
  132.             new cash = GetPlayerMoney(playerid);
  133.             if(boughtw[playerid] > 0 && boughtw[playerid] < 10) {
  134.                 SendClientMessage(playerid,COLOR_YELLOW,"You have worms!");
  135.             }
  136.             if(boughtw[playerid] == 0) {
  137.                 if(cash >= 3000) {
  138.                 SendClientMessage(playerid,COLOR_YELLOW,"You bought 10 worms !");
  139.                 boughtw[playerid] = 10;
  140.                 DecPlayerHandCash(playerid, 3000);
  141.                 }
  142.                 if(cash < 3000) {
  143.                 SendClientMessage(playerid,COLOR_YELLOW,"Need more money ! Need $3000 for worms!");
  144.                 }
  145.             }
  146.             }
  147.             else
  148.             {
  149.             SendClientMessage(playerid,COLOR_GREEN,"You not are at magazine!");
  150.             }
  151.         return 1;
  152.     }
  153.     else if(strcmp(cmdtext, "sellf", true) == 0) {
  154.         new rand = random(sizeof(randomfish));
  155.         if(hfish[playerid] == 0) {
  156.             SendClientMessage(playerid,COLOR_GREEN,"You don't have a fish!");
  157.             }
  158.         if(hfish[playerid] == 1) {
  159.             SendClientMessage(playerid,COLOR_YELLOW,"You sold your fish for money!");
  160.             IncPlayerHandCash(playerid, randomfish[rand][mon]);
  161.             hfish[playerid] = 0;
  162.             }
  163.         return 1;
  164.         }
  165.     else if(strcmp(cmdtext, "eatf", true) == 0) {
  166.         new rand = random(sizeof(randomfish));
  167.         new Float:Health;
  168.         GetPlayerHealth(playerid,Health);
  169.         if(hfish[playerid] == 0) {
  170.             SendClientMessage(playerid,COLOR_GREEN,"You don't have a fish!");
  171.             }
  172.         if(hfish[playerid] == 1) {
  173.             SendClientMessage(playerid,COLOR_YELLOW,"You ate your fish for health!");
  174.             SetPlayerHealth(playerid,Health + randomfish[rand][hp]);
  175.             hfish[playerid] = 0;
  176.             }
  177.         return 1;
  178.         }
  179.     else if(strcmp(cmdtext, "leavef", true) == 0) {
  180.         if(hfish[playerid] == 0) {
  181.             SendClientMessage(playerid,COLOR_GREEN,"You don't have a fish!");
  182.             }
  183.         if(hfish[playerid] == 1) {
  184.             SendClientMessage(playerid,COLOR_YELLOW,"You want to live your fish, so.. say Bye!");
  185.             SendClientMessage(playerid,COLOR_YELLOW,"The fish say: Thank You Very Much! Im so happy!");
  186.             hfish[playerid] = 0;
  187.             }
  188.         return 1;
  189.         }
  190.     else if(strcmp(cmdtext, "fishing", true) == 0) {
  191.         if(PlayerToPoint(30, playerid,-563.4057, -1514.9204, 4.8351 ) || PlayerToPoint(30, playerid,-600.0203, -1527.4523, 5.9322) || PlayerToPoint(30,playerid,-627.0029, -1516.8279, 8.1077) || PlayerToPoint(30,playerid,-580.3753, -1475.2249, 4.0794) || PlayerToPoint(30,playerid,-621.3587, -1459.5869, 3.7448)) {
  192.             if(fishing[playerid] == 1) {
  193.                 SendClientMessage(playerid,COLOR_GREEN,"Already Fishing!");
  194.                 }
  195.             if(fishing[playerid] == 0) {
  196.             if(boughtr[playerid] == 0) {
  197.                 SendClientMessage(playerid,COLOR_GREEN,"Need rod for fishing! Go to magazine to buy!");
  198.                 }
  199.             if(boughtr[playerid] == 1) {
  200.             if(boughtw[playerid] == 0) {
  201.             GameTextForPlayer(playerid,"~o~not have worms!");
  202.             SendClientMessage(playerid,COLOR_GREEN,"Not have worms! Go to magazine to buy!");
  203.             }
  204.             if(boughtw[playerid] == 1) {
  205.             GameTextForPlayer(playerid,"~o~For a good job, type ~w~/aim ~o~!");
  206.             SendClientMessage(playerid,COLOR_YELLOW,"Wait 5 seconds to find a fish!");
  207.             SendClientMessage(playerid,COLOR_YELLOW,"Now, you have just 1 worm!");
  208.             SetTimer("waitfish", 5000, false);
  209.             fishing[playerid] = 1;
  210.             boughtw[playerid] = 0;
  211.             TogglePlayerControllable(playerid,0);
  212.             GivePlayerWeapon(playerid,3,1);
  213.             }
  214.             if(boughtw[playerid] == 2) {
  215.             GameTextForPlayer(playerid,"~o~For a good job, type ~w~/aim ~o~!");
  216.             SendClientMessage(playerid,COLOR_YELLOW,"Wait 5 seconds to find a fish!");
  217.             SendClientMessage(playerid,COLOR_YELLOW,"Now, you have just 1 worm!");
  218.             SetTimer("waitfish", 5000, false);
  219.             fishing[playerid] = 1;
  220.             boughtw[playerid] = 1;
  221.             TogglePlayerControllable(playerid,0);
  222.             GivePlayerWeapon(playerid,3,1);
  223.             }
  224.             if(boughtw[playerid] == 3) {
  225.             GameTextForPlayer(playerid,"~o~For a good job, type ~w~/aim ~o~!");
  226.             SendClientMessage(playerid,COLOR_YELLOW,"Wait 5 seconds to find a fish!");
  227.             SendClientMessage(playerid,COLOR_YELLOW,"Now, you have just 2 worms!");
  228.             SetTimer("waitfish", 5000, false);
  229.             fishing[playerid] = 1;
  230.             boughtw[playerid] = 2;
  231.             TogglePlayerControllable(playerid,0);
  232.             GivePlayerWeapon(playerid,3,1);
  233.             }
  234.             if(boughtw[playerid] == 4) {
  235.             GameTextForPlayer(playerid,"~o~For a good job, type ~w~/aim ~o~!");
  236.             SendClientMessage(playerid,COLOR_YELLOW,"Wait 5 seconds to find a fish!");
  237.             SendClientMessage(playerid,COLOR_YELLOW,"Now, you have just 3 worms!");
  238.             SetTimer("waitfish", 5000, false);
  239.             fishing[playerid] = 1;
  240.             boughtw[playerid] = 3;
  241.             TogglePlayerControllable(playerid,0);
  242.             GivePlayerWeapon(playerid,3,1);
  243.             }
  244.             if(boughtw[playerid] == 5) {
  245.             GameTextForPlayer(playerid,"~o~For a good job, type ~w~/aim ~o~!");
  246.             SendClientMessage(playerid,COLOR_YELLOW,"Wait 5 seconds to find a fish!");
  247.             SendClientMessage(playerid,COLOR_YELLOW,"Now, you have just 4 worms!");
  248.             SetTimer("waitfish", 5000, false);
  249.             fishing[playerid] = 1;
  250.             boughtw[playerid] = 4;
  251.             TogglePlayerControllable(playerid,0);
  252.             GivePlayerWeapon(playerid,3,1);
  253.             }
  254.             if(boughtw[playerid] == 6) {
  255.             GameTextForPlayer(playerid,"~o~For a good job, type ~w~/aim ~o~!");
  256.             SendClientMessage(playerid,COLOR_YELLOW,"Wait 5 seconds to find a fish!");
  257.             SendClientMessage(playerid,COLOR_YELLOW,"Now, you have just 5 worms!");
  258.             SetTimer("waitfish", 5000, false);
  259.             fishing[playerid] = 1;
  260.             boughtw[playerid] = 5;
  261.             TogglePlayerControllable(playerid,0);
  262.             GivePlayerWeapon(playerid,3,1);
  263.             }
  264.             if(boughtw[playerid] == 7) {
  265.             GameTextForPlayer(playerid,"~o~For a good job, type ~w~/aim ~o~!");
  266.             SendClientMessage(playerid,COLOR_YELLOW,"Wait 5 seconds to find a fish!");
  267.             SendClientMessage(playerid,COLOR_YELLOW,"Now, you have just 6 worms!");
  268.             SetTimer("waitfish", 5000, false);
  269.             fishing[playerid] = 1;
  270.             boughtw[playerid] = 6;
  271.             TogglePlayerControllable(playerid,0);
  272.             GivePlayerWeapon(playerid,3,1);
  273.             }
  274.             if(boughtw[playerid] == 8) {
  275.             GameTextForPlayer(playerid,"~o~For a good job, type ~w~/aim ~o~!");
  276.             SendClientMessage(playerid,COLOR_YELLOW,"Wait 5 seconds to find a fish!");
  277.             SendClientMessage(playerid,COLOR_YELLOW,"Now, you have just 7 worms!");
  278.             SetTimer("waitfish", 5000, false);
  279.             fishing[playerid] = 1;
  280.             boughtw[playerid] = 7;
  281.             TogglePlayerControllable(playerid,0);
  282.             GivePlayerWeapon(playerid,3,1);
  283.             }
  284.             if(boughtw[playerid] == 9) {
  285.             GameTextForPlayer(playerid,"~o~For a good job, type ~w~/aim ~o~!");
  286.             SendClientMessage(playerid,COLOR_YELLOW,"Wait 5 seconds to find a fish!");
  287.             SendClientMessage(playerid,COLOR_YELLOW,"Now, you have just 8 worms!");
  288.             SetTimer("waitfish", 5000, false);
  289.             fishing[playerid] = 1;
  290.             boughtw[playerid] = 8;
  291.             TogglePlayerControllable(playerid,0);
  292.             GivePlayerWeapon(playerid,3,1);
  293.             }
  294.             if(boughtw[playerid] == 10) {
  295.             GameTextForPlayer(playerid,"~o~For a good job, type ~w~/aim ~o~!");
  296.             SendClientMessage(playerid,COLOR_YELLOW,"Wait 5 seconds to find a fish!");
  297.             SendClientMessage(playerid,COLOR_YELLOW,"Now, you have just 9 worms!");
  298.             SetTimer("waitfish", 5000, false);
  299.             fishing[playerid] = 1;
  300.             boughtw[playerid] = 9;
  301.             TogglePlayerControllable(playerid,0);
  302.             GivePlayerWeapon(playerid,3,1);
  303.             }
  304.             }
  305.             }
  306.             }
  307.         else
  308.             {
  309.             SendClientMessage(playerid,COLOR_GREEN,"You not are at port, on legal zone!");
  310.             }
  311.         return 1;
  312.         }
  313.     return 0;
  314. }
  315. public waitfish()
  316. {
  317.     for(new i = 0; i < MAX_PLAYERS; i++) {
  318.         if (IsPlayerConnected(i)) {
  319.             if(fishing[i]) {
  320.     new rand = random(sizeof(randomfish));
  321.     hfish[i] = randomfish[rand][fish];
  322.     fishing[i] = 0;
  323.     hfish[i] = randomfish[rand][fish];
  324.     TogglePlayerControllable(i,1);
  325.     GameTextForPlayer(i,"~b~Got something ! ~w~read ~b~pm !");
  326.     SendClientMessage(i,COLOR_YELLOW,randomfish[rand][tfish]);
  327.     if(hfish[i] == 0) {
  328.         }
  329.     if(hfish[i] == 1) {
  330.     TogglePlayerControllable(i,1);
  331.     GameTextForPlayer(i,"~b~Got something ! ~w~read ~b~pm !");
  332.     SendClientMessage(i,COLOR_YELLOW,randomfish[rand][tfish]);
  333.     SendClientMessage(i,COLOR_YELLOW,"You want to sell fish ? type '/c sellf' !");
  334.     SendClientMessage(i,COLOR_YELLOW,"You want to eat fish ? type '/c eatf' !");
  335.     SendClientMessage(i,COLOR_YELLOW,"You want to leave fish ? type '/c leavef' !");
  336.             }
  337.             }
  338.          }
  339.     }
  340. }
  341. public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
  342. {
  343.     new Float:oldposx, Float:oldposy, Float:oldposz;
  344.     new Float:tempposx, Float:tempposy, Float:tempposz;
  345.     GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  346.     tempposx = (oldposx -x);
  347.     tempposy = (oldposy -y);
  348.     tempposz = (oldposz -z);
  349.     if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  350.     {
  351.         return 1;
  352.     }
  353.     return 0;
  354. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement