Trouble with Timer -
preshantram - 20.08.2012
Good day,
today i had a problem with my timer,
Код:
error 021: symbol already defined: "JobTimer"
error 021: symbol already defined: "JobTimer"
Код:
new JobTimer[MAX_PLAYERS];
public OnPlayerExitVehicle(playerid, vehicleid)
{
new Veh=GetVehicleModel(GetPlayerVehicleID(playerid));
{
if(Veh == 448)
{
RemovePlayerFromVehicle(playerid);
JobTimer[playerid]= SetTimerEx("Jobtimer", 20000, true, "d", playerid);
ShowPlayerDialog(playerid, 6, DIALOG_STYLE_MSGBOX,"Pizzajob","You have left the pizzaboy, you have 20 seconds left to get back to work!", "ok", "");
}
}
return 1;
}
forward JobTimer(playerid);
public JobTimer(playerid)
{
ShowPlayerDialog(playerid, 16, DIALOG_STYLE_MSGBOX,"Pizzajob","I am not paying you for this!, you are fired", "ok", "");
PlayerJob[playerid] = 0;
}
}
Does anyone have a solution,
Thank you very much,,,
Preshantram.
Re: Trouble with Timer -
Cjgogo - 20.08.2012
First of all,you have forwarded a function after you called it(the "Jobtimer" function).Put the forwarding at the top of your gamemode.And second,I am not sure,but I think that PAWNO isn't case sensitive,so you should come up with another name for the function.Like JOB(so there won't be any confusion between the variable JobTimer and the function Jobtimer).
Re: Trouble with Timer -
preshantram - 20.08.2012
Cjgogo, thank you for your fast reply,
Only i tried to rename my function,
and moved forwarded function above, but still the same errors
Preshantram
Re: Trouble with Timer -
Cjgogo - 20.08.2012
Then you must have defined somewhere else Jobtimer,try remove
pawn Код:
new JobTimer[MAX_PLAYERS];
Re: Trouble with Timer -
preshantram - 20.08.2012
I cannot remove
Код:
new JobTimer[MAX_PLAYERS];
because i have to kill the timer
This script have to make sure when you leave a pizzaboy for a job,
and you fell off or leave the vehicle, you have 20 seconds to get back on the bike
Re: Trouble with Timer -
Cjgogo - 20.08.2012
Код:
error 021: symbol already defined: "JobTimer"
This code means that you have defined it somewhere else on the very top of your script and you forgot like"
pawn Код:
new JobTimer[MAX_PLAYERS];
/* line 25{code}
line 300*{other pieces of code}*/
new JobTimer[MAX_PLAYERS];
And you cannot notice you defined it twice,because of too many lines between the definitions,so just try to remove it,and see if it fixes the errors.
Re: Trouble with Timer -
preshantram - 20.08.2012
Once i removed it,
i get a couple of more errors:
Код:
error 028: invalid subscript (not an array or too many subscripts): "JobTimer"
warning 215: expression has no effect
error 001: expected token: ";", but found "]"
error 029: invalid expression, assumed zero
Fatal error 107: too many error messages on one line
the error line
Код:
JobTimer[playerid]= SetTimerEx("Jobtimer", 20000, true, "d", playerid);
Re: Trouble with Timer -
Cjgogo - 20.08.2012
Then don't remove it,and just rename it,as JobUpdate[MAX_PLAYERS];.(I know what the error is,but it's harder to explain,you have it defined as a variable and global variable at the same time[BUT FORGET THIS]).Just rename it,and of course rename it on OnPlayerDeath also
Re: Trouble with Timer -
preshantram - 20.08.2012
Hmm
Код:
error 021: symbol already defined: "JobUpdate"
error 021: symbol already defined: "JobUpdate"
Re: Trouble with Timer -
Cjgogo - 20.08.2012
AH,error spotted,I took a CLOSER at your code,try REPLACE THE whole thing with this:
pawn Код:
new JobUpdate[MAX_PLAYERS];
forward JobTimer(playerid);
public OnPlayerExitVehicle(playerid, vehicleid)
{
new Veh=GetVehicleModel(GetPlayerVehicleID(playerid));
if(Veh == 448)
{
RemovePlayerFromVehicle(playerid);
JobUpdate[playerid]= SetTimerEx("JobTimer", 20000, true, "d", playerid);
ShowPlayerDialog(playerid, 6, DIALOG_STYLE_MSGBOX,"Pizzajob","You have left the pizzaboy, you have 20 seconds left to get back to work!", "ok", "");
}
return 1;
}
public JobTimer(playerid)
{
ShowPlayerDialog(playerid, 16, DIALOG_STYLE_MSGBOX,"Pizzajob","I am not paying you for this!, you are fired", "ok", "");
PlayerJob[playerid] = 0;
}