Код:
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;
}