Why won't this work properly? -
Scenario - 11.12.2010
Hello again. I seem to be having an issue here with "format" and "SendClientMessage"... I have this:
pawn Код:
format(string, sizeof(string), "Welcome to {C2A2DA}Relentless Gaming{FF9900}, %s! Your account information has been loaded, continuing current life...", GetName(playerid));
SendClientMessage(playerid, COLOR_ORANGE, string);
I don't know what has changed, but it's begun acting up on me now even without the color embedding functions. It seems to be that the whole message isn't being sent to the client. I tried using "GetPlayerName" instead of my custom function, which didn't work either. If I format a string, it won't send! I can do this:
pawn Код:
SendClientMessage(playerid, COLOR_WHITE, "Sup dude?");
Although using "format" doesn't work. For those interested, this is the "GetName" function:
pawn Код:
stock GetName(playerid)
{
new name[MAX_PLAYER_NAME];
if(IsPlayerConnected(playerid)) GetPlayerName(playerid, name, sizeof(name));
else name = "Disconnected";
return name;
}
EDIT: I tried using "print" as well, didn't work.
EDIT 2: I'm currently running 0.3c RC4-2.
Re: Why won't this work properly? -
XePloiT - 11.12.2010
try to increase the max length of your string... try "new string[256]" if this doesn't work change it to 512
Re: Why won't this work properly? -
admantis - 11.12.2010
Quote:
Originally Posted by XePloiT
try to increase the max length of your string... try "new string[256]" if this doesn't work change it to 512
|
why? i consider it a waste of cells if he uses it to format the string.
Re: Why won't this work properly? -
Scenario - 11.12.2010
Quote:
Originally Posted by XePloiT
try to increase the max length of your string... try "new string[256]" if this doesn't work change it to 512
|
Why? It's a message being sent to the client in the chat area; which has a maximum of 128 characters.
Re: Why won't this work properly? -
willsuckformoney - 11.12.2010
You probably have string[128] and from the line posted above looks to long for 128 string cell. Try what Exploit said to do, bump the string count up.
Re: Why won't this work properly? -
Scenario - 11.12.2010
I simply used
this tool and I am around 118 characters. Of course, a player name is 24 characters but it's not only this message - it's anything...
Example:
pawn Код:
format(string, sizeof(string), "Hello, %s!", GetName(playerid));
SendClientMessage(playerid, COLOR_WHITE, string);
EDIT: This is the code which comes above the message.
pawn Код:
case 2:
{
if(!response)
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Sorry, you must login to this account in order to play. Goodbye.");
Kick(playerid);
}
else
{
new string[128], buffer[150];
GetFromAccount(GetEscName(playerid), "Password", pStats[playerid][pPassword]);
WP_Hash(buffer, sizeof(buffer), inputtext);
if(!strcmp(buffer, pStats[playerid][pPassword], true))
{
PlayerLogged[playerid] = 1;
LoadAccountVariables(playerid);
format(string, sizeof(string), "Welcome to {6EF83C}Relentless Gaming{FFAF00}, %s! Your account information has been loaded, continuing current life...", GetName(playerid));
SendClientMessage(playerid, COLOR_ORANGE, string);
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "You have entered an incorrect password. As a security measure, you have been kicked!");
Kick(playerid);
}
}
}
It is under "OnDialogResponse".
Re: Why won't this work properly? -
XePloiT - 11.12.2010
i think i know what the problem is ... happened to couple of times... just go to your GM and all FSes and change the return to 0 (return 0

(at the end of the callback) in each of them...that should do it
Re: Why won't this work properly? -
Scenario - 11.12.2010
Quote:
Originally Posted by XePloiT
i think i know what the problem is ... happened to couple of times... just go to your GM and all FSes and change the return to 0 (return 0  (at the end of the callback) in each of them...that should do it
|
I did have "return 1;" which should of been "return 0;", although it's still not working.
Re: Why won't this work properly? -
XePloiT - 11.12.2010
well.. i don't this its a problem in this exact piece of script... try to rewrite it maybe... i'm kinda out of ideas (got home from a hang out still little drunk... i'll try to help after i slept...)
Re: Why won't this work properly? -
Scenario - 11.12.2010
Quote:
Originally Posted by XePloiT
well.. i don't this its a problem in this exact piece of script... try to rewrite it maybe... i'm kinda out of ideas (got home from a hang out still little drunk... i'll try to help after i slept...)
|
The actual server developer hopped on MSN and told me to try sending the same message with a command; which worked... Perhaps a 0.3c bug?