[HELP]Script errors.. conflict -
TheBluec0de - 08.06.2012
Error in my code onplayertext... give this error, and conflict the symbol i
Код:
warning 219: local variable "i" shadows a variable at a preceding level
error 076: syntax error in the expression, or invalid function call
Код:
new
i;
while (text[++i])
{
if ('A' <= text[i] <= 'Z') text[i] |= 0x20;
}
//
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i)) continue;
{
if(GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid))
{
new
s[128];
format(s, sizeof(s), "%s: %s", name, text[0]);
SendClientMessageToAll(-1, s);
return 0;
}
return 0;
}
}
Re: [HELP]Script errors.. conflict -
[KHK]Khalid - 08.06.2012
should kill the first warning
pawn Код:
new
iText;
while (text[++iText])
{
if ('A' <= text[iText] <= 'Z') text[iText] |= 0x20;
}
//
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i)) continue;
{
if(GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid))
{
new
s[128];
format(s, sizeof(s), "%s: %s", name, text[0]);
SendClientMessageToAll(-1, s);
return 0;
}
return 0;
}
}
point us to the line for the error!
Re: [HELP]Script errors.. conflict -
Face9000 - 08.06.2012
Remove it,you are already defining "i" with the loop.
Also,the error 076,post the line.
Re: [HELP]Script errors.. conflict -
TheBluec0de - 08.06.2012
error 076: syntax error in the expression, or invalid function call
Код:
new
iText;
while (text[++iText])
{
if ('A' <= text[iText] <= 'Z') text[iText] |= 0x20;
}
//
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i)) continue;
{
if(GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid))
{
new
s[128];
/* ------>>>>>>>> LINE ERROR ! */format(s, sizeof(s), "%s: %s", name, text[0]);
SendClientMessageToAll(-1, s);
return 0;
}
return 0;
}
}
Re: [HELP]Script errors.. conflict -
MP2 - 08.06.2012
Not related to your problem but you should remove the return 0's from the loop because it's only going to send one message. Put them outside the loop.
Also try replacing text[0] with just 'text'.
Re: [HELP]Script errors.. conflict -
[KHK]Khalid - 08.06.2012
You might like to show us some of the codes above and below this code 'cause when I compiled it gave me no errors!
And why do I see return inside the loop? It will just stop it after the first player. Remove it