07.01.2016, 21:46
Hey guys ! Im still working on a Fishing script and I just cant make the player wait and make an animation while fishing. The idea is pretty simple, it lets the player fish, and I want to make him wait and not being able to fish again for like 10 seconds.(which doesnt works ) Then, when he has 5 fishes, he can't fish anymore for 300 secs. (which works...)
So here is the script.
So here is the script.
Код:
CMD:seafish(playerid, params[]) { new string[128], done, fish; if(!IsPlayerLoggedIn(playerid) || PlayerInfo[playerid][pAsshole] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are not allowed to use command."); if(!IsAtFishingSpot2(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are on a boat standing near blue algae"); if(FishTime[playerid]) { format(string, sizeof(string), "You need to wait %d more seconds before fishing again.", FishTime[playerid]); SendClientMessage(playerid, COLOR_GREY, string); return 1; } for(new i=0; i<5; i++) // Fish { if(!done) { if(!PlayerInfo[playerid][pFish][i]) done = i+1; } } if(!done) return SendClientMessage(playerid, COLOR_GREY, "You can't carry anymore fishes."); done = done-1; // Catching if(strval(RPJL(playerid, JOB_FISHER)) == 1) fish = random(30)+5; else if(strval(RPJL(playerid, JOB_FISHER)) == 2) fish = random(60)+10; else if(strval(RPJL(playerid, JOB_FISHER)) == 3) fish = random(90)+15; else if(strval(RPJL(playerid, JOB_FISHER)) == 4) fish = random(120)+20; else if(strval(RPJL(playerid, JOB_FISHER)) == 5) fish = random(150)+30; PlayerInfo[playerid][pFish][done] = fish; format(string, sizeof(string), "* %s attempts to catch a fish using the fishing rod.", RPN(playerid)); SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); format(string, sizeof(string), " You have caught a %d lbs fish.", fish); SendClientMessage(playerid, COLOR_LIGHTBLUE, string); // Leveling new oldj = strval(RPJL(playerid, JOB_FISHER)); PlayerInfo[playerid][pJobSkill][JOB_FISHER] ++; new newj = strval(RPJL(playerid, JOB_FISHER)); if(oldj < newj) { format(string, sizeof(string), "** Your Fisher level is now %d, you can now catch heavier fishes. **", newj); SendClientMessage(playerid, COLOR_YELLOW, string); } Fished[playerid] ++; if(Fished[playerid] >= 5) { Fished[playerid] = 0; FishTime[playerid] = 60*5; SetTimerEx("FishingTime", 1000, false, "i", playerid); } return 1; }