27.01.2016, 02:01
Ok so I'm having a hard time figuring this out. I know it's a simple mistake but when I run the script and start the timer, the timer works but when it reaches 5 second ( else if(CowTime[playerid] == 5) ) , this part doesn't work. Looks like ''cw'' isnt well defined or syntax is wrong.
So this part doesnt work
This is the whole timer
Thanks much
So this part doesnt work
PHP Code:
PlayerInfo[playerid][pCow][cow] += cw;
format(string, sizeof(string), "* Your cow has been fed and got bigger by %d lbs", cw);
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
DestroyDynamicObject(CowFence);
PHP Code:
forward CowTimeCooldown(playerid);
public CowTimeCooldown(playerid)
{
if(CowTime[playerid] > 0)
{
CowTime[playerid] --;
}
else if(CowTime[playerid] == 5)
{
new string[128], cow;
new cw;
if(PlayerInfo[playerid][pJobSkill][JOB_FARMER] < 100) cw = 50;
else if(PlayerInfo[playerid][pJobSkill][JOB_FARMER] < 300) cw = 75;
else if(PlayerInfo[playerid][pJobSkill][JOB_FARMER] < 700) cw = 100;
else if(PlayerInfo[playerid][pJobSkill][JOB_FARMER] < 1200) cw = 125;
else if(PlayerInfo[playerid][pJobSkill][JOB_FARMER] >= 1200) cw = 150;
PlayerInfo[playerid][pCow][cow] += cw;
format(string, sizeof(string), "* Your cow has been fed and got bigger by %d lbs", cw);
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
DestroyDynamicObject(CowFence);
KillTimer(CowCooldown[playerid]);
}
return 1;
}