I tested this out(without the debugging code), and wondered why the timer won't be called. I tried debugging it, and found where the problem was, but don't know what's wrong about it. The problem was after the second print("1") cause only 2 one's showed up.
PHP Code:
forward FishUpdate(playerid);
public FishUpdate(playerid)
{
if(isFishing[playerid] == true)
{
print("1");
if(Fishes[playerid][pWeight1] < 0 && Fishes[playerid][pWeight2] < 0 && Fishes[playerid][pWeight3] < 0 && Fishes[playerid][pWeight4] < 0 && Fishes[playerid][pWeight5] < 0)
{
print("1");
new string[128];
print("1");
if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
print("1");
if(IsABoat(GetPlayerVehicleID(playerid)))
{
print("1");
new Caught;
print("1");
new rand;
print("1");
new fstring[MAX_PLAYER_NAME];
print("1");
Caught = random(100)-50;
print("1");
rand = random(FishNamesNumber);
print("1");
if(Caught <= 0)
{
print("1");
SendClientMessage(playerid, COLOR_FGREY, "The line snapped.");
return 1;
}
else if(rand == 0)
{
print("1");
SendClientMessage(playerid, COLOR_FGREY, "You caught a jacket and threw it away.");
return 1;
}
else if(rand == 4)
{
print("1");
SendClientMessage(playerid, COLOR_FGREY, "You caught a pair of trousers and threw it away.");
return 1;
}
else if(rand == 7)
{
print("1");
SendClientMessage(playerid, COLOR_FGREY, "You caught a can and threw it away.");
return 1;
}
else if(rand == 10)
{
print("1");
SendClientMessage(playerid, COLOR_FGREY, "You caught a pair of shoes and threw it away.");
return 1;
}
else if(rand == 13)
{
print("1");
SendClientMessage(playerid, COLOR_FGREY, "You caught some garbage and threw it away.");
return 1;
}
else if(rand == 20)
{
print("1");
new mrand = random(50);
format(string, sizeof(string), "* You caught a bag filled with money ($%d).", mrand);
SendClientMessage(playerid, COLOR_FLIGHTBLUE, string);
GivePlayerMoney(playerid, mrand);
return 1;
}
if(Fishes[playerid][pWeight1] == 0)
{
print("1");
format(fstring, sizeof(fstring), "%s", FishNames[rand]);
strmid(Fishes[playerid][pFish1], fstring, 0, strlen(fstring), 255);
Fishes[playerid][pWeight1] = Caught;
format(string, sizeof(string), "* You have caught a %s, weighing %d pounds.", Fishes[playerid][pFish1], Caught);
SendClientMessage(playerid, COLOR_FLIGHTBLUE, string);
Fishes[playerid][pFid1] = rand;
}
else if(Fishes[playerid][pWeight2] == 0)
{
print("1");
format(fstring, sizeof(fstring), "%s", FishNames[rand]);
strmid(Fishes[playerid][pFish2], fstring, 0, strlen(fstring), 255);
Fishes[playerid][pWeight2] = Caught;
format(string, sizeof(string), "* You have caught a %s, weighing %d pounds.", Fishes[playerid][pFish2], Caught);
SendClientMessage(playerid, COLOR_FLIGHTBLUE, string);
Fishes[playerid][pFid2] = rand;
}
else if(Fishes[playerid][pWeight3] == 0)
{
print("1");
format(fstring, sizeof(fstring), "%s", FishNames[rand]);
strmid(Fishes[playerid][pFish3], fstring, 0, strlen(fstring), 255);
Fishes[playerid][pWeight3] = Caught;
format(string, sizeof(string), "* You have caught a %s, weighing %d pounds.", Fishes[playerid][pFish3], Caught);
SendClientMessage(playerid, COLOR_FLIGHTBLUE, string);
Fishes[playerid][pFid3] = rand;
}
else if(Fishes[playerid][pWeight4] == 0)
{
print("1");
format(fstring, sizeof(fstring), "%s", FishNames[rand]);
strmid(Fishes[playerid][pFish4], fstring, 0, strlen(fstring), 255);
Fishes[playerid][pWeight4] = Caught;
format(string, sizeof(string), "* You have caught a %s, weighing %d pounds.", Fishes[playerid][pFish4], Caught);
SendClientMessage(playerid, COLOR_FLIGHTBLUE, string);
Fishes[playerid][pFid4] = rand;
}
else if(Fishes[playerid][pWeight5] == 0)
{
print("1");
format(fstring, sizeof(fstring), "%s", FishNames[rand]);
strmid(Fishes[playerid][pFish5], fstring, 0, strlen(fstring), 255);
Fishes[playerid][pWeight5] = Caught;
format(string, sizeof(string), "* You have caught a %s, weighing %d pounds.", Fishes[playerid][pFish5], Caught);
SendClientMessage(playerid, COLOR_FLIGHTBLUE, string);
Fishes[playerid][pFid5] = rand;
}
else
{
print("1");
return 1;
}
}
}
}
else
{
print("1");
KillTimer(fishtimer[playerid]);
}
}
return 1;
}