SendClientMessageToAll(format) problem -
Extraordinariness - 02.03.2014
I've resetted my gamemode and put in some color defines for my SCMToAll msg. Something like this
pawn Код:
public OnPlayerDisconnect(playerid, reason);
{
new
szString[64],
name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
switch(reason)
{
case 0: format(szString, sizeof szString, ""C_RED"%s"C_WHI" has been disconnected in the server. (Timed Out/Crashed)", name);
case 1: format(szString, sizeof szString, ""C_RED"%s"C_WHI" has been disconnected in the server. (Quit)", name);
case 2: format(szString, sizeof szString, ""C_RED"%s"C_WHI" has been disconnected in the server. (Kicked/Banned)", name);
}
SendClientMessageToAll(-1, szString);
return 1;
}
becomes...
C:\Documents and Settings\eros\Desktop\SAMP Server\gamemodes\TDScript9.pwn(74) : error 001: expected token: "-string end-", but found "-identifier-"
C:\Documents and Settings\eros\Desktop\SAMP Server\gamemodes\TDScript9.pwn(74) : warning 215: expression has no effect
C:\Documents and Settings\eros\Desktop\SAMP Server\gamemodes\TDScript9.pwn(74) : error 001: expected token: ";", but found "-identifier-"
C:\Documents and Settings\eros\Desktop\SAMP Server\gamemodes\TDScript9.pwn(74) : error 017: undefined symbol "C_WHI"
C:\Documents and Settings\eros\Desktop\SAMP Server\gamemodes\TDScript9.pwn(74) : fatal error 107: too many error messages on one line
Line 74:
pawn Код:
case 0: format(szString, sizeof szString, ""C_RED"%s"C_WHI" has been disconnected in the server. (Timed Out/Crashed)", name);
Respuesta: SendClientMessageToAll(format) problem -
iNetX - 02.03.2014
How you have defined "C_WHI"?
Re: SendClientMessageToAll(format) problem -
Twizted - 02.03.2014
Change the
, to
; and the problem should be resolved, therefore being:
Re: SendClientMessageToAll(format) problem -
Mike.FTW - 02.03.2014
Why do you put " ; " at the end of a Public ??

And not like that you embed colors. See
https://sampwiki.blast.hk/wiki/Colour_Embedding
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
new
szString[64],
name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
switch(reason)
{
case 0: format(szString, sizeof szString, "{C_RED}%s{C_WHI} has been disconnected in the server. (Timed Out/Crashed)", name);
case 1: format(szString, sizeof szString, "{C_RED}%s{C_WHI} has been disconnected in the server. (Quit)", name);
case 2: format(szString, sizeof szString, "{C_RED}%s{C_WHI} has been disconnected in the server. (Kicked/Banned)", name);
}
SendClientMessageToAll(-1, szString);
return 1;
}
And change
to
You defined it bad.
Do the same with the other color.
Re: SendClientMessageToAll(format) problem -
Extraordinariness - 02.03.2014
Quote:
Originally Posted by Twizted
Change the , to ; and the problem should be resolved, therefore being:
|
C:\Documents and Settings\eros\Desktop\SAMP Server\gamemodes\TDScript9.pwn(70) : warning 217: loose indentation
C:\Documents and Settings\eros\Desktop\SAMP Server\gamemodes\TDScript9.pwn(70) : error 017: undefined symbol "name"
C:\Documents and Settings\eros\Desktop\SAMP Server\gamemodes\TDScript9.pwn(70) : warning 215: expression has no effect
C:\Documents and Settings\eros\Desktop\SAMP Server\gamemodes\TDScript9.pwn(70) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\eros\Desktop\SAMP Server\gamemodes\TDScript9.pwn(70) : error 029: invalid expression, assumed zero
C:\Documents and Settings\eros\Desktop\SAMP Server\gamemodes\TDScript9.pwn(70) : fatal error 107: too many error messages on one line
Line 70
Quote:
How have you defined "C_WHI"?
|
Re: SendClientMessageToAll(format) problem -
Konstantinos - 02.03.2014
C_WHI is defined correctly. Is C_RED defined as?
Quote:
Originally Posted by Twizted
Change the , to ; and the problem should be resolved, therefore being:
|
He uses "," because at the next line there's 1 more variable.
Quote:
Originally Posted by Mike.FTW
pawn Код:
public OnPlayerDisconnect(playerid, reason) { new szString[64], name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, MAX_PLAYER_NAME); switch(reason) { case 0: format(szString, sizeof szString, "{C_RED}%s{C_WHI} has been disconnected in the server. (Timed Out/Crashed)", name); case 1: format(szString, sizeof szString, "{C_RED}%s{C_WHI} has been disconnected in the server. (Quit)", name); case 2: format(szString, sizeof szString, "{C_RED}%s{C_WHI} has been disconnected in the server. (Kicked/Banned)", name); } SendClientMessageToAll(-1, szString); return 1; }
And change
to
You defined it bad.
Do the same with the other color.
|
You have to use "" around the C_RED and C_WHI, otherwise they'll be taken as text. Also C_WHI must be defined as "{FFFFFF}" because it's a string, not an integer.
Re: SendClientMessageToAll(format) problem -
Twizted - 02.03.2014
Oh, right! I did not even notice. Thanks for the heads up.
It must be a color define then, because the rest is ok.
Re: SendClientMessageToAll(format) problem -
Extraordinariness - 02.03.2014
Quote:
Originally Posted by Mike.FTW
pawn Код:
public OnPlayerDisconnect(playerid, reason) { new szString[64], name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, MAX_PLAYER_NAME); switch(reason) { case 0: format(szString, sizeof szString, "{C_RED}%s{C_WHI} has been disconnected in the server. (Timed Out/Crashed)", name); case 1: format(szString, sizeof szString, "{C_RED}%s{C_WHI} has been disconnected in the server. (Quit)", name); case 2: format(szString, sizeof szString, "{C_RED}%s{C_WHI} has been disconnected in the server. (Kicked/Banned)", name); } SendClientMessageToAll(-1, szString); return 1; }
And change
to
You defined it bad.
Do the same with the other color.
|
https://sampforum.blast.hk/showthread.php?tid=250389
Re: SendClientMessageToAll(format) problem -
Extraordinariness - 02.03.2014
Then if I can't really find solution, could you just give me one example? Cus it's very impossible in the wiki to backfire.
Re : SendClientMessageToAll(format) problem -
TunisianoGamer - 02.03.2014
public OnPlayerDisconnect(playerid, reason)
{
new
szString[
64],
name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name,
sizeof(name));
switch(reason)
{
case 0: format(szString,
sizeof (szString),
"{FF0000}%s{FFFFFF} has been disconnected in the server. (Timed Out/Crashed)", name);
case 1: format(szString,
sizeof (szString),
"{FF0000}%s{FFFFFF} has been disconnected in the server. (Quit)", name);
case 2: format(szString,
sizeof (szString),
"{FF0000}%s{FFFFFF} has been disconnected in the server. (Kicked/Banned)", name);
}
SendClientMessageToAll(-1, szString);
return 1;
}