Problem with define - 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: Problem with define (
/showthread.php?tid=157935)
Problem with define -
KuHS - 08.07.2010
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?
Re: Problem with define -
Hiddos - 08.07.2010
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.
Re: Problem with define -
KuHS - 08.07.2010
Thanks Hiddos anyways, i have learned it at the moment, fixed right now. Thanks for reply.