SA-MP Forums Archive
Problem with a variable - 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 a variable (/showthread.php?tid=145163)



Problem with a variable - sobolanux - 01.05.2010

I`m currently trying to do a respawn command, to respawn all the vehicles. The problem is that I get this error: error 021: symbol already defined: "i"

code:
Код:
dcmd_respawncars(playerid, params[])
{
	#pragma unused params
	for(new i=0, i <= MAX_VEHICLES, i++) SetVehicleToRespawn(i); //error line
	return 1;
}
I`ve tried to delete the "new" and use only "for(i=0 ..." but if I do that way I get two errors, on the same line, that "i" it`s not defined. Some help please?


Re: Problem with a variable - maij - 01.05.2010

Код:
dcmd_respawncars(playerid, params[])
{
	#pragma unused params
	for(new i=0; i <= MAX_VEHICLES; i++) SetVehicleToRespawn(i); //error line
	return 1;
}
You used wrong tag.
use ; instead of ,


Re: Problem with a variable - sobolanux - 01.05.2010

Oh! How could I have missed that. Thanks!


Re: Problem with a variable - maij - 01.05.2010

doesn't matter. Everyone can make a mistake right?