SA-MP Forums Archive
error 006: must be assigned to an array - 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: error 006: must be assigned to an array (/showthread.php?tid=99139)



error 006: must be assigned to an array - ruarai - 26.09.2009

public OnPlayerText(playerid, text[])
{
for(new i = 0; i != 126; i++)
{
if(text[i] == "a") text[i] = "4"
if(text[i] == "e") text[i] = "3"
if(text[i] == "l") text[i] = "1"
if(text[i] == "o") text[i] = "0"
if(text[i] == "s") text[i] = "5"
if(text[i] == "t") text[i] = "7"
}
SendPlayerMessageToAll(playerid,text)
return 0;
}
Why won't this code work, btw its a 1337 translator!


Re: error 006: must be assigned to an array - [HiC]TheKiller - 26.09.2009

pawn Код:
public OnPlayerText(playerid, text[])
{
  for(new i = 0; i != 126; i++)
  {
    if(text == "a") return text = "4"
    if(text == "e") return text = "3"
    if(text == "l") return text = "1"
    if(text == "o") return text = "0"
    if(text == "s") return text = "5"
    if(text == "t") return text = "7"
  }
  SendPlayerMessageToAll(playerid,text)
  return 0;
}
I really don't see the point of this, unless you are saying one letter at once.


Re: error 006: must be assigned to an array - ruarai - 27.09.2009

oh i posted the wrong code ):

pawn Код:
public OnPlayerText(playerid, text[])
{
  for(new i = 0; i != 126; i++)
  {
    if(text[i] == "a") text[i] = "4"
    if(text[i] == "e") text[i] = "3"
    if(text[i] == "l") text[i] = "1"
    if(text[i] == "o") text[i] = "0"
    if(text[i] == "s") text[i] = "5"
    if(text[i] == "t") text[i] = "7"
  }
  SendPlayerMessageToAll(playerid,text)
  return 0;
}
I don't get whats wrong with it..


Re: error 006: must be assigned to an array - Silent314 - 27.09.2009

pawn Код:
public OnPlayerText(playerid, text[])
{
  for(new i = 0; i != 126; i++)
  {
    if(text[i] == "a") { text[i] = "4"; }
    if(text[i] == "e") { text[i] = "3"; }
    if(text[i] == "l"){ text[i] = "1"; }
    if(text[i] == "o") { text[i] = "0"; }
    if(text[i] == "s") { text[i] = "5"; }
    if(text[i] == "t") { text[i] = "7"; }
  }
  SendPlayerMessageToAll(playerid,text)
  return 0;
}



Re: error 006: must be assigned to an array - Jefff - 27.09.2009

Код:
public OnPlayerText(playerid, text[])
{
	for(new i; i < strlen(text); i++)
	{
		if(text[i] == 'a') text[i] = '4';
		if(text[i] == 'e') text[i] = '3';
		if(text[i] == 'l') text[i] = '1';
		if(text[i] == 'o') text[i] = '0';
		if(text[i] == 's') text[i] = '5';
		if(text[i] == 't') text[i] = '7';
	}
	SendPlayerMessageToAll(playerid,text);
	return 0;
}



Re: error 006: must be assigned to an array - ruarai - 28.09.2009

Thanks!