Return an array in public
#1

Hello. I'm working on a function for my server, however I always get an error, telling me I can't return a string in a public function. I tried to put the string into strlen(), which showed no result at all, so I'm asking for a help here.
Thanks!

Код:
public OnPlayerText(playerid, text[])
{
	new string[160], pName[32];
	GetPlayerName(playerid, pName, sizeof(pName));
	if(GetPVarInt(playerid, "Infected") == 1)
	{
		format(string, sizeof(string), "[Person %d]: %s", GetNumber(pName), text);
		return string;
	}
	else return 1;
}
The errors are:
Код:
C:\Users\Viktor\Desktop\lol.pwn(18) : error 090: public functions may not return arrays (symbol "OnPlayerText")
C:\Users\Viktor\Desktop\lol.pwn(20) : error 079: inconsistent return types (array & non-array)
Reply


Messages In This Thread
Return an array in public - by Homerman - 16.10.2011, 21:05
Re: Return an array in public - by AeroBlast - 16.10.2011, 21:14
Re: Return an array in public - by Homerman - 17.10.2011, 13:05
Re: Return an array in public - by [Diablo] - 17.10.2011, 13:10

Forum Jump:


Users browsing this thread: 2 Guest(s)