Problem with arrays [PlayerTime] - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem with arrays [PlayerTime] (
/showthread.php?tid=151879)
Problem with arrays [PlayerTime] -
Flashy - 01.06.2010
Helle everyone!
I have a little problem with an array. I have set an online timer and it saves in a file. It is for saving the online time from players.
But at the end when I finished to script it I get some errors..I dunno really how to fix it. Could someone help pls?
Код:
public PlayerTime(playerid)
{
new i;
for(i=0;i<MAX_PLAYERS;i++)
if(IsPlayerConnected(i))
{
if(Seconds[i] == 0)
{
Seconds[i]++;
}else if(Seconds[i] == 60 && Minutes[i] < 60)
{
Seconds[i] = 0;
Minutes[i]++;
}
if(Minutes[i] == 60 && Hours[i] < 60)
{
Minutes[i] = 0;
Hours[i]++;
}
if(Hours[i] == 60){
Hours++;
}
}
}
ERRORS:
Adminscript.pwn(2711) : error 028: invalid subscript (not an array or too many subscripts): "Seconds"
Adminscript.pwn(2711) : warning 215: expression has no effect
Adminscript.pwn(2711) : error 001: expected token: ";", but found "]"
Adminscript.pwn(2711) : error 029: invalid expression, assumed zero
Adminscript.pwn(2711) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
At this line:
if(Seconds[i] == 0)
Re: Problem with arrays [PlayerTime] -
MadeMan - 01.06.2010
Show how you create the variable Seconds