symbol already defined.
#1

Hello guys, I need a help.

This is my code
Код:
if (strcmp("/eventtp", cmdtext, true, 10) == 0)
	{
		
		GetPlayerPos(playerid,X,Y,Z);
		ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Amount","What amount of players u want to tp?","OK","Cancel");
		for(new i=1,i<=amount,i++)
		{
        	ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"ID","Enter the ID of the player u want to tp.","OK","Cancel");
        	Y=Y+2;
        	SetPlayerPos(id,X,Y,Z);
        }
		return 1;
	}
	return 1;
}
And I get an error saying :

error 021: symbol already defined: "i"


The line which has the error is :
for(new i=1,i<=amount,i++)
Reply
#2

yes i haven't defined it before
Reply
#3

Quote:
Originally Posted by Virus.
Посмотреть сообщение
yes i haven't defined it before
Just make sure, press Ctrl + F, then type in new = i;
Reply
#4

I have defined 'id', but not 'i'
Reply
#5

try using this
Код:
if (strcmp("/eventtp", cmdtext, true, 10) == 0)
	{
		
		GetPlayerPos(playerid,X,Y,Z);
		ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Amount","What amount of players u want to tp?","OK","Cancel");
		for(new _i=1,_i<=amount,_i++)
		{
        	ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"ID","Enter the ID of the player u want to tp.","OK","Cancel");
        	Y=Y+2;
        	SetPlayerPos(id,X,Y,Z);
        }
		return 1;
	}
	return 1;
}
Reply
#6

Quote:
Originally Posted by [bot]fatninja
Посмотреть сообщение
try using this
Код:
if (strcmp("/eventtp", cmdtext, true, 10) == 0)
	{
		
		GetPlayerPos(playerid,X,Y,Z);
		ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Amount","What amount of players u want to tp?","OK","Cancel");
		for(new _i=1,_i<=amount,_i++)
		{
        	ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"ID","Enter the ID of the player u want to tp.","OK","Cancel");
        	Y=Y+2;
        	SetPlayerPos(id,X,Y,Z);
        }
		return 1;
	}
	return 1;
}
error 021: symbol already defined: "_i"
Reply
#7

PHP код:
if (strcmp("/eventtp"cmdtexttrue10) == 0)
    {
        
        
GetPlayerPos(playerid,X,Y,Z);
        
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Amount","What amount of players u want to tp?","OK","Cancel");
        for(new 
_i=1;_i<=amount;_i++)
        {
            
ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"ID","Enter the ID of the player u want to tp.","OK","Cancel");
            
Y=Y+2;
            
SetPlayerPos(id,X,Y,Z);
        }
        return 
1;
    }
    return 
1;

Try using this
Reply
#8

Quote:
Originally Posted by [HK]Ryder[AN]
Посмотреть сообщение
PHP код:
if (strcmp("/eventtp"cmdtexttrue10) == 0)
    {
        
        
GetPlayerPos(playerid,X,Y,Z);
        
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Amount","What amount of players u want to tp?","OK","Cancel");
        for(new 
_i=1;_i<=amount;_i++)
        {
            
ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"ID","Enter the ID of the player u want to tp.","OK","Cancel");
            
Y=Y+2;
            
SetPlayerPos(id,X,Y,Z);
        }
        return 
1;
    }
    return 
1;

Try using this
Tried it already, gets the same error : "Already defined '_i'
Reply
#9

hey well wait i dont know what you wana do but you have a loop on show player dialog which means you are looping the dialog again and again :O isnt your server crashing due to this ?
Reply
#10

Didn't try it becasue of the error, but i think it won't crash because the first dialog gets the amount of players someone wants to tp, and then the i used amount in the for loop. But its just a guess.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)