Random Fish Size Problem!
#1

hello how can i make fish size in random?
like some time i caught 0.1 lb some time 24.5 sometime 100.23 sometime 10.7 so on!

i've made this
Код:
new Weight = random(20 - 5) + 1;
but itsn't working correctly! i want result in " . "
Example: You Catch: 4.5 lb Pirhana. 6.7 lb Sea Bass 47.8 lb Red Snapper!
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=240128
Reply
#3

How can i use this?
float(random(...))?
Reply
#4

****** post?
Reply
#5

what? u mean? i can't understand!
Reply
#6

Help Please!
Reply
#7

pawn Код:
frandom(Float:max, Float:min = 0.0, dp = 4)
{
    new
        // Get the multiplication for storing fractional parts.
        Float:mul = floatpower(10.0, dp),
        // Get the max and min as integers, with extra dp.
        imin = floatround(min * mul),
        imax = floatround(max * mul);
    // Get a random int between two bounds and convert it to a float.
    return float(random(imax - imin) + imin) / mul;
}
pawn Код:
new Weight = frandom(20, 5, 1) +1;
Reply
#8

F:\Danish\CNR\gamemodes\Cops&Robbers.pwn(1342 : warning 213: tag mismatch

got this warning!
Reply
#9

Quote:
Originally Posted by danish007
Посмотреть сообщение
F:\Danish\CNR\gamemodes\Cops&Robbers.pwn(1342 : warning 213: tag mismatch

got this warning!
pawn Код:
new Float:Weight;
Instead of...
pawn Код:
new Weight;
Reply
#10

Still
Код:
F:\Danish\CNR\gamemodes\Cops&Robbers.pwn(13428) : warning 213: tag mismatch
Код:
frandom(Float:max, Float:min = 0.0, dp = 4)
{
    new
        // Get the multiplication for storing fractional parts.
        Float:mul = floatpower(10.0, dp),
        // Get the max and min as integers, with extra dp.
        imin = floatround(min * mul),
        imax = floatround(max * mul);
    // Get a random int between two bounds and convert it to a float.
    return float(random(imax - imin) + imin) / mul;//error line!
}
forward Fish_Timer(playerid);
public Fish_Timer(playerid)
{
        new string[1280];
	    //new Weight = random(50);
	    //new Weight = RandomEx(1, 50);
        new Float:Weight = frandom(20, 5, 1) +1;
	    switch(random(20))
	    {
	    case 0, 1, 2, 3, 4:
	    {
	    PlayerInfo[playerid][pFishes]+=1;
        Fishing[playerid]=0;
	    FishWeight[playerid]+=Weight;
        format(string, sizeof(string),"~w~Your Catch: ~p~%d lb %s",FishWeight[playerid],FishNames[PlayerInfo[playerid][pFishes]]);
	    GameTextForPlayer(playerid,string, 5000, 3);
	    format(string, sizeof(string), "You Have Caught %d lb %s.",FishWeight[playerid], FishNames[PlayerInfo[playerid][pFishes]]);
	    SendClientMessage(playerid, COLOR_CYAN, string);
	    }
	    case 5, 6, 7, 8:
		{
		format(string, sizeof(string), "~w~Your Catch:~r~ None");
	    GameTextForPlayer(playerid,string, 5000, 3);
	    format(string, sizeof(string), "Failed To Catch Anything.");
	    SendClientMessage(playerid, COLOR_CYAN, string);
	    Fishing[playerid]=0;
	    }
	    case 9:
	    {
	    GivePlayerMoney(playerid, 25000);
	    format(string, sizeof(string),"~w~Found:~p~ Nemo");
	    GameTextForPlayer(playerid,string, 5000, 3);
	    format(string, sizeof(string), "Recieved $25000 in Nemo.");
	    SendClientMessage(playerid, COLOR_CYAN, string);
	    Fishing[playerid]=0;
	    }
        case 10:
	    {
	    GivePlayerMoney(playerid, 50000);
	    format(string, sizeof(string),"~w~Found:~g~ Money");
	    GameTextForPlayer(playerid,string, 5000, 3);
	    format(string, sizeof(string), "Recieved $50000");
	    SendClientMessage(playerid, COLOR_CYAN, string);
	    Fishing[playerid]=0;
	    }
	    case 11, 12:
	    {
	    format(string, sizeof(string),"~w~Found:~r~ Jimmy Hoffa");
	    GameTextForPlayer(playerid,string, 5000, 3);
	    format(string, sizeof(string), "Found a Dead Body. Throw it Back and keep Your Mouth Shut. ");
	    SendClientMessage(playerid, COLOR_CYAN, string);
	    Fishing[playerid]=0;
	    }
        case 13, 14:
	    {
	    format(string, sizeof(string),"~w~Found: Used Condom");
	    GameTextForPlayer(playerid,string, 5000, 3);
	    format(string, sizeof(string), "Found Used Condom. Served With Fried Rice. ");
	    SendClientMessage(playerid, COLOR_CYAN, string);
	    Fishing[playerid]=0;
	    }
	    case 15:
	    {
	    format(string, sizeof(string),"~w~Found: ~p~Underwear");
	    GameTextForPlayer(playerid,string, 5000, 3);
	    format(string, sizeof(string), "Found Underwear. You've Threw it Back Size Mismatch.");
	    SendClientMessage(playerid, COLOR_CYAN, string);
	    Fishing[playerid]=0;
	    }
	    case 16, 17, 18, 19:
	    {
	    PlayerInfo[playerid][pFishes]+=1;
        Fishing[playerid]=0;
	    FishWeight[playerid]+=Weight;
        format(string, sizeof(string),"~w~Your Catch: ~p~%d lb %s",FishWeight[playerid],FishNames[PlayerInfo[playerid][pFishes]]);
	    GameTextForPlayer(playerid,string, 5000, 3);
	    format(string, sizeof(string), "You Have Caught %d lb %s.",FishWeight[playerid], FishNames[PlayerInfo[playerid][pFishes]]);
	    SendClientMessage(playerid, COLOR_CYAN, string);
	    }
	    }
        return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)