why am i getting these errors?
#1

ok i made a time system for my server, but i get two errors:

Код:
C:\PROGRA~1\ROCKST~1\GTASAN~1\GAMEMO~1\EASTSI~1.PWN(219) : warning 213: tag mismatch
C:\PROGRA~1\ROCKST~1\GTASAN~1\GAMEMO~1\EASTSI~1.PWN(223) : warning 213: tag mismatch
here's my code:
Код:
//top of script
new MyTime;
forward TimeTmr();

public TimeTmr()
{
	new newtime;
	newtime = MyTime + 1.00; //line 219
	MyTime = newtime;
	if(MyTime == 24.00)
 	{
	MyTime = 0.00; //line 223
	}
	return 0;
}
Reply
#2

To use decimal points in a variable it needs to be a float so change new MyTime; to new Float:MyTime; and new newtime; to new Float:new newtime;.
Reply
#3

also, the command does not display the time:

Код:
	if(strcmp(cmdtext, "/time", true) == 0)
 	{
 	  new string[126];
		format(string, 256, "[TIME]: %s", MyTime);
		SendClientMessageToAll(GetPlayerColor(playerid), string);

		return 1;
	}
Reply
#4

Quote:
Originally Posted by On_Top_Non_Stop
To use decimal points in a variable it needs to be a float so change new MyTime; to new Float:MyTime; and new newtime; to new Float:new newtime;.
Time is not done in floats.
Reply
#5

Quote:
Originally Posted by Kinetic
Quote:
Originally Posted by On_Top_Non_Stop
To use decimal points in a variable it needs to be a float so change new MyTime; to new Float:MyTime; and new newtime; to new Float:new newtime;.
Time is not done in floats.
well, the time system works.

can someone check that command?
Reply
#6

it warning not error ;o
Reply
#7

Quote:
Originally Posted by Kinetic
Quote:
Originally Posted by On_Top_Non_Stop
To use decimal points in a variable it needs to be a float so change new MyTime; to new Float:MyTime; and new newtime; to new Float:new newtime;.
Time is not done in floats.
Hmm, how did i miss that O.o

pawn Код:
if(strcmp(cmdtext, "/time", true) == 0)
    {
      new string[10];
      format(string, sizeof(string), "[TIME]: %d", MyTime);
      SendClientMessageToAll(GetPlayerColor(playerid), string);
      return 1;
    }
Remove the Float: from MyTime and newtime and to set the variables do MyTime +=1;, MyTime +=2; etc and don't add a decimal point.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)