y_timers help ! - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: y_timers help ! (
/showthread.php?tid=474669)
y_timers help ! -
maximthepain - 09.11.2013
Hi! I'm using y_timers to make speedcameras ingame keep updated.
so here is some code i added to the script:
Код:
Timer:ServerHeartbeat[1000]()
{
foreach(Player, i)
{
if(SpeedCamera[i] > 0)
{
if(SpeedCamera[i] <= 0)
{
SpeedCamera[i] = 0;
}
else
{
SpeedCamera[i] -= 1;
}
}
}
}
And got those errors:
Код:
(41590) : error 010: invalid function or declaration
(41592) : error 010: invalid function or declaration
(41594) : error 010: invalid function or declaration
(41596) : error 010: invalid function or declaration
(41600) : error 010: invalid function or declaration
the error lines are related to the script i showed you above.
Should there be a return value? I don't understand those errors, please help me! thanks.
Re: y_timers help ! - Patrick - 09.11.2013
You've done it wrong, I suggest you re-reading the YSI Wikipeadia again, try this code
pawn Код:
timer ServerHeartbeat[1000]()
{
foreach(Player, i)
{
If(!IsPlayerConnected(playerid)) continue;
if(SpeedCamera[i] > 0) {
if(SpeedCamera[i] <= 0) {
SpeedCamera[i] = 0;
}
else {
SpeedCamera[i] -= 1;
}
}
}
Re: y_timers help ! -
maximthepain - 09.11.2013
Quote:
Originally Posted by pds2k12
You've done it wrong, I suggest you re-reading the YSI Wikipeadia again, try this code
pawn Код:
timer ServerHeartbeat[1000]() { foreach(Player, i) { If(!IsPlayerConnected(playerid)) continue; if(SpeedCamera[i] > 0) { if(SpeedCamera[i] <= 0) { SpeedCamera[i] = 0; } else { SpeedCamera[i] -= 1; } } }
|
Thanks. There was missing bracket and playerid is undefined so i deleted line "If(!IsPlayerConnected(playerid)) continue;"
now it works. thanks alot!
Re: y_timers help ! - Patrick - 09.11.2013
Quote:
Originally Posted by maximthepain
Thanks. There was missing bracket and playerid is undefined so i deleted line "If(!IsPlayerConnected(playerid)) continue;"
now it works. thanks alot!
|
No, don't delete this code If(!IsPlayerConnected(playerid)) continue; just change the playerid to i I forgot to change it
, sorry