Problem with define
#1

Hello. I want to define string for showing message to all players.

Код:
#define KAC_MONEY_MSG "money cheater"
#define KAC_KICK_MSG(%0,%1) "[SERVER] %0 has been kicked from server (%1)."

stock FormatMessage(&playerid, type, bool:ban)
{
	new string[128];
	switch(type)
	{
	    case 0:
	    {
			if(!ban) format(string, 128, ""KAC_KICK_MSG(playerid, KAC_MONEY_MSG)"");
			else format(string, 128, ""KAC_BAN_MSG(playerid, KAC_MONEY_MSG)"");
	 	}
 	}
 	return string;
}
%0 = player id, %1 = reason (string).

And im trying to send it:
Код:
SendClientMessageToAll(KAC_BAN_MSG_COLOR, FormatMessage(playerid, 0, false));
And result: [SERVER] has been kicked from server ().

What's the problem?
Reply
#2

Firstoff, you can't return 'string', you can only send them use Send(blablabla)Message.

pawn Код:
format(string,sizeof(string),"%s",KAC_MONEY_MSG);
SendClientMessageToAll(color,string);
AFAIK, you can't input new variables in pre-defined strings.
Reply
#3

Thanks Hiddos anyways, i have learned it at the moment, fixed right now. Thanks for reply.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)