bug with random weitht output
#1

sometimes when i catch a fish, it says the weight for example -45Lbs
and sometimes 32Lbs, also it goes minus- How come?

pawn Код:
if(PRESSED(KEY_AIM))
    {
        if (FishCaught[playerid] == 1)
        {
            if(IsPlayerNearWater(playerid) || IsPlayerInWater(playerid))
            {
                //if(Fishing[playerid] == 1)
                {
                    new Caught;
                    new rand;
                    new luck = Random(1, 100);
                    new fstring[MAX_PLAYER_NAME];
                    new Level = PlayerInfo[playerid][pFishSkill];
                    if(Level >= 0 && Level < 50) { Caught = random(20)-7; }
                    else if(Level >= 50 && Level < 100) { Caught = random(50)-20; }
                    else if(Level >= 100 && Level < 200) { Caught = random(100)-50; }
                    else if(Level >= 200 && Level < 400) { Caught = random(140)-60; }
                    else if(Level >= 400 && Level < 500) { Caught = random(170)-60; }
                    rand = random(FishNamesNumber);
                    if(luck <= 6)
                    {
                        SendClientMessage(playerid, COLOR_GREY, "   You caught a headcrab and threw it away!");
                        HidePlayerFishText(playerid);
                        FishCaught[playerid] = 0;
                        Fishing[playerid] = 0;
                        Fishes[playerid][pTempFishName] = 0;
                        RemovePlayerAttachedObject(playerid,0);
                        KillTimer(fishtimer[playerid]);
                        return 1;
                    }
                    if(luck <= 7)
                    {
                        SendClientMessage(playerid, COLOR_GREY, "   You caught a g-string and threw it away!");
                        HidePlayerFishText(playerid);
                        FishCaught[playerid] = 0;
                        Fishing[playerid] = 0;
                        Fishes[playerid][pTempFishName] = 0;
                        RemovePlayerAttachedObject(playerid,0);
                        KillTimer(fishtimer[playerid]);
                        return 1;
                    }
                    if(luck <= 8)
                    {
                        SendClientMessage(playerid, COLOR_GREY, "   You caught a can and threw it away!");
                        HidePlayerFishText(playerid);
                        FishCaught[playerid] = 0;
                        Fishing[playerid] = 0;
                        Fishes[playerid][pTempFishName] = 0;
                        RemovePlayerAttachedObject(playerid,0);
                        KillTimer(fishtimer[playerid]);
                        return 1;
                    }
                    if(luck <= 9)
                    {
                        SendClientMessage(playerid, COLOR_GREY, "   You caught a used condom and threw it away!");
                        HidePlayerFishText(playerid);
                        FishCaught[playerid] = 0;
                        Fishing[playerid] = 0;
                        Fishes[playerid][pTempFishName] = 0;
                        RemovePlayerAttachedObject(playerid,0);
                        KillTimer(fishtimer[playerid]);
                        return 1;
                    }
                    if(luck <= 15)
                    {
                        new string[85];
                        new weapon[MAX_PLAYERS];
                        HidePlayerFishText(playerid);
                        AddWeapon(playerid,weapon[playerid] = 31);
                        PlayerInfo[playerid][pFishSkill] += 1;
                        Fishes[playerid][pTempFishName] = 0;
                        format(string, sizeof(string), "* %s reels in an M4.", RemoveUnderScore(playerid));
                        ProxDetector(30.0, playerid, string, COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED);
                        RemovePlayerAttachedObject(playerid,0);
                        FishCaught[playerid] = 0;
                        Fishing[playerid] = 0;
                        KillTimer(fishtimer[playerid]);
                        return 1;
                    }
                    if(luck <= 18)
                    {
                        new string[85];
                        new weapon[MAX_PLAYERS];
                        HidePlayerFishText(playerid);
                        AddWeapon(playerid,weapon[playerid] = 30);
                        PlayerInfo[playerid][pFishSkill] += 1;
                        Fishes[playerid][pTempFishName] = 0;
                        format(string, sizeof(string), "* %s reels in an AK 47.", RemoveUnderScore(playerid));
                        ProxDetector(30.0, playerid, string, COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED);
                        RemovePlayerAttachedObject(playerid,0);
                        FishCaught[playerid] = 0;
                        Fishing[playerid] = 0;
                        KillTimer(fishtimer[playerid]);
                        return 1;
                    }
                    if(luck <= 70)
                    {
                        new string[85];
                        HidePlayerFishText(playerid);
                        PlayerInfo[playerid][pFishes] += 1;
                        PlayerInfo[playerid][pFishSkill] += 1;
                        format(fstring, sizeof(fstring), "%s", FishNames[rand]);
                        strmid(Fishes[playerid][pFish], fstring, 0, strlen(fstring), 255);
                        Fishes[playerid][pWeight3] = Caught;
                        format(string, sizeof(string), "* %s reels in a %s, weighing %d lbs!", RemoveUnderScore(playerid), Fishes[playerid][pFish], Caught);
                        ProxDetector(30.0, playerid, string, COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED);
                        RemovePlayerAttachedObject(playerid,0);
                        KillTimer(fishtimer[playerid]);
                        FishCaught[playerid] = 0;
                        Fishing[playerid] = 0;
                        Fishes[playerid][pLastWeight] = Caught;
                        Fishes[playerid][pLastFish] = 3;
                        Fishes[playerid][pFid3] = rand;
                        Fishes[playerid][pFishID] = rand;
                        if(Caught > PlayerInfo[playerid][pBiggestFish])
                        {
                            format(string, sizeof(string), "* You've beaten your old record of %d pounds!  Your new biggest fish is: %d pounds.", PlayerInfo[playerid][pBiggestFish], Caught);
                            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                            PlayerInfo[playerid][pBiggestFish] = Caught;
                        }
                        return 1;
                    }
                    if(luck <= 70)
                    {
                        new string[85];
                        HidePlayerFishText(playerid);
                        PlayerInfo[playerid][pFishes] += 1;
                        PlayerInfo[playerid][pFishSkill] += 1;
                        format(fstring, sizeof(fstring), "%s", FishNames[rand]);
                        strmid(Fishes[playerid][pFish], fstring, 0, strlen(fstring), 255);
                        Fishes[playerid][pWeight4] = Caught;
                        format(string, sizeof(string), "* %s reels in a %s weighing %d lbs!", RemoveUnderScore(playerid), Fishes[playerid][pFish], Caught);
                        ProxDetector(30.0, playerid, string, COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED);
                        RemovePlayerAttachedObject(playerid,0);
                        KillTimer(fishtimer[playerid]);
                        FishCaught[playerid] = 0;
                        Fishing[playerid] = 0;
                        Fishes[playerid][pLastWeight] = Caught;
                        Fishes[playerid][pLastFish] = 4;
                        Fishes[playerid][pFid4] = rand;
                        Fishes[playerid][pFishID] = rand;
                        if(Caught > PlayerInfo[playerid][pBiggestFish])
                        {
                            format(string, sizeof(string), "* You've beaten your old record of %d pounds!  Your new biggest fish is: %d pounds.", PlayerInfo[playerid][pBiggestFish], Caught);
                            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                            PlayerInfo[playerid][pBiggestFish] = Caught;
                        }
                        return 1;
                    }
                    if(luck <= 70)
                    {
                        new string[85];
                        HidePlayerFishText(playerid);
                        PlayerInfo[playerid][pFishes] += 1;
                        PlayerInfo[playerid][pFishSkill] += 1;
                        format(fstring, sizeof(fstring), "%s", FishNames[rand]);
                        strmid(Fishes[playerid][pFish], fstring, 0, strlen(fstring), 255);
                        Fishes[playerid][pWeight5] = Caught;
                        format(string, sizeof(string), "* %s reels in a %s weighing %d lbs!", RemoveUnderScore(playerid), Fishes[playerid][pFish], Caught);
                        ProxDetector(30.0, playerid, string, COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED);
                        RemovePlayerAttachedObject(playerid,0);
                        KillTimer(fishtimer[playerid]);
                        FishCaught[playerid] = 0;
                        Fishing[playerid] = 0;
                        Fishes[playerid][pLastWeight] = Caught;
                        Fishes[playerid][pLastFish] = 5;
                        Fishes[playerid][pFid5] = rand;
                        Fishes[playerid][pFishID] = rand;
                        if(Caught > PlayerInfo[playerid][pBiggestFish])
                        {
                            format(string, sizeof(string), "* You've beaten your old record of %d pounds!  Your new biggest fish is: %d pounds.", PlayerInfo[playerid][pBiggestFish], Caught);
                            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                            PlayerInfo[playerid][pBiggestFish] = Caught;
                        }
                        return 1;
                    }
                    if(PlayerInfo[playerid][pFishSkill] == 50)
                    { SendClientMessage(playerid, COLOR_YELLOW, "* Your fishing skill is now level 2."); }
                    else if(PlayerInfo[playerid][pFishSkill] == 100)
                    { SendClientMessage(playerid, COLOR_YELLOW, "* Your fishing skill is now level 3."); }
                    else if(PlayerInfo[playerid][pFishSkill] == 200)
                    { SendClientMessage(playerid, COLOR_YELLOW, "* Your fishing skill is now level 4."); }
                    else if(PlayerInfo[playerid][pFishSkill] == 400)
                    { SendClientMessage(playerid, COLOR_YELLOW, "* Your fishing skill is now level 5."); }
                    else if(PlayerInfo[playerid][pFishSkill] == 700)
                    { SendClientMessage(playerid, COLOR_YELLOW, "* The fish gods are mad at you!. You no longer can catch fish."); }
                }
            }
        }
    }
    return 1;
}
Reply


Messages In This Thread
bug with random weitht output - by MayaEU - 20.07.2016, 21:29
Re: bug with random weitht output - by Codeah - 20.07.2016, 22:14
Re: bug with random weitht output - by MayaEU - 20.07.2016, 22:29
Re: bug with random weitht output - by Nero_3D - 20.07.2016, 23:16
Re: bug with random weitht output - by MayaEU - 20.07.2016, 23:44
Re: bug with random weitht output - by Nero_3D - 20.07.2016, 23:52
Re: bug with random weitht output - by MayaEU - 20.07.2016, 23:58
Re: bug with random weitht output - by MayaEU - 21.07.2016, 00:04
Re: bug with random weitht output - by VVWVV - 21.07.2016, 01:25
Re: bug with random weitht output - by Nero_3D - 21.07.2016, 19:27

Forum Jump:


Users browsing this thread: 2 Guest(s)