error 006: must be assigned to an array
#1

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!
Reply
#2

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.
Reply
#3

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..
Reply
#4

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;
}
Reply
#5

Код:
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;
}
Reply
#6

Thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)