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;
}
Could you please give us some more information. What did the excecutor say?
|
Caught = random(20)-7;
Rethink what your code does
PHP код:
subtacting 7 will result in an overall output from -7 till 12 |
What do you want to achive ?
If you want to have a random value between two numbers use Random(7, 20); like you did with the luck variable |
if(Level >= 0 && Level < 50) { Caught = random(7, 20); }
else if(Level >= 50 && Level < 100) { Caught = random(20, 50); }
else if(Level >= 100 && Level < 200) { Caught = random(50, 100); }
else if(Level >= 200 && Level < 400) { Caught = random(60, 140); }
else if(Level >= 400 && Level < 500) { Caught = random(60, 170); }
C:\Users\Maya\Desktop\gf_july21_2016.pwn(30507) : warning 202: number of arguments does not match definition
C:\Users\Maya\Desktop\gf_july21_2016.pwn(30508) : warning 202: number of arguments does not match definition
C:\Users\Maya\Desktop\gf_july21_2016.pwn(30509) : warning 202: number of arguments does not match definition
C:\Users\Maya\Desktop\gf_july21_2016.pwn(30510) : warning 202: number of arguments does not match definition
C:\Users\Maya\Desktop\gf_july21_2016.pwn(30511) : warning 202: number of arguments does not match definition
native random(max);
if(Level >= 0 && Level < 50) { Caught = random((20 - 7 + 1)) + 7; }
else if(Level >= 50 && Level < 100) { Caught = random((50 - 20 + 1)) + 20; }
else if(Level >= 100 && Level < 200) { Caught = random((100 - 50 + 1)) + 50; }
else if(Level >= 200 && Level < 400) { Caught = random((140 - 60 + 1)) + 60; }
else if(Level >= 400 && Level < 500) { Caught = random((170 - 60 + 1)) + 60; }
if(Level >= 0 && Level < 50) { Caught = random((20 - 7 + 1)) - 7; }
else if(Level >= 50 && Level < 100) { Caught = random((50 - 20 + 1)) - 20; }
else if(Level >= 100 && Level < 200) { Caught = random((100 - 50 + 1)) - 50; }
else if(Level >= 200 && Level < 400) { Caught = random((140 - 60 + 1)) - 60; }
else if(Level >= 400 && Level < 500) { Caught = random((170 - 60 + 1)) - 60; }
I changed it to this
pawn Код:
|