SA-MP Forums Archive
[help] admin chat - 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: [help] admin chat (/showthread.php?tid=101880)



[help] admin chat - leuthrick - 12.10.2009

hello,

i will make a admin chat but i got 2 errors:

link\test.pwn(122) : error 035: argument type mismatch (argument 1)
link\test.pwn(122) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if(strcmp(cmdtext, "/admin", true) == 0 || strcmp(cmdtext, "/a", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			GetPlayerName(playerid, sendername, sizeof(sendername));
			new length = strlen(cmdtext);
			while ((idx < length) && (cmdtext[idx] <= ' '))
			{
				idx++;
			}
			new offset = idx;
			new result[64];
			while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
			{
				result[idx - offset] = cmdtext[idx];
				idx++;
			}
			result[idx - offset] = EOS;
			if(!strlen(result))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/o)oc [ooc chat]");
				return 1;
			}
			format(string, sizeof(string), "[OOC] %s: %s " , sendername, result);//line 122
			printf("%s", string);
		}
		return 1;
	}
	return 1;
}
lines on the head:

Код:
new sendername[MAX_PLAYER_NAME];
new idx;
new string;
#define COLOR_GRAD2 0xBFC0C2FF
thanks


leuthrick


Re: [help] admin chat - Pghpunkid - 12.10.2009

change 'new string;' to 'new string[128];'


Re: [help] admin chat - leuthrick - 12.10.2009

thanks it works