SA-MP Forums Archive
error 021: symbol already defined: "i" - 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: error 021: symbol already defined: "i" (/showthread.php?tid=565364)



error 021: symbol already defined: "i" - suni - 27.02.2015

new bool: spec_enabled[MAX_PLAYERS]

for (new i=0, i<MAX_PLAYERS, i++) spec_enabled[i]= true;

please help me


Re: error 021: symbol already defined: "i" - Crayder - 27.02.2015

for (new i; i<MAX_PLAYERS; i++)

It's ';', not ','.


Re: error 021: symbol already defined: "i" - Jimmy0wns - 27.02.2015

Quote:
Originally Posted by Crayder
Посмотреть сообщение
for (new i; i<MAX_PLAYERS; i++)

It's ';', not ','.
I suggest reading the title first...


Re: error 021: symbol already defined: "i" - Crayder - 27.02.2015

Quote:
Originally Posted by Jimmy0wns
Посмотреть сообщение
I suggest reading the title first...
Well then you sir are a complete dumbass.

What happens when you do "new i, i"? Well, that would be defining the same var twice, thus the error 021. The for loop consist of three parts, he is only doing the var init because he never ends the section with a ';'. So the compiler thinks he is defining more vars. Now, I suggest you pay attention and look at his problem again.


Re: error 021: symbol already defined: "i" - Golf - 27.02.2015

PHP код:
for (new 910a++)
{
    
// Code in the loop
}
// Code after the loop 
https://sampwiki.blast.hk/wiki/Control_S...res#for_.28.29


Re: error 021: symbol already defined: "i" - HolyScripter - 27.02.2015

can you show full script ?


Re: error 021: symbol already defined: "i" - Beckett - 27.02.2015

Quote:
Originally Posted by Jimmy0wns
Посмотреть сообщение
I suggest reading the title first...
Crayder's right, you should read his code before replying.


Re: error 021: symbol already defined: "i" - Crayder - 27.02.2015

Quote:
Originally Posted by HolyScripter
Посмотреть сообщение
can you show full script ?
Why do you need the full script? Don't give this guy your script! We already answered your question, who knows what this guy was gonna do...


Re: error 021: symbol already defined: "i" - MikE1990 - 27.02.2015

Did you defined somewhere "i" as global variable ?


Re: error 021: symbol already defined: "i" - Crayder - 27.02.2015

Quote:
Originally Posted by MikE1990
Посмотреть сообщение
Did you defined somewhere "i" as global variable ?
Wow, stfu dude. I just explained what the problem was.