What am I doing wrong -
SeniorGamer - 14.06.2014
What did I do wrong here
pawn Код:
CMD:test(playerid,params[])
{
new string[128];
format(string, sizeof(string), "%s used /test command", GetName(playerid));
SendClientMessage(playerid, COLOR_YELLOW, string);
return true;
}
stock GetName(playerid)
{
new string[MAX_PLAYER_NAME];
GetPlayerName(playerid,string,sizeof(string));
return string;
}
Re: What am I doing wrong -
SilentSoul - 14.06.2014
Nothing wrong? what are you trying to do? Send this message to admins or what or what is your problem?
Re: What am I doing wrong -
SeniorGamer - 14.06.2014
I am just trying to output
pawn Код:
format(string, sizeof(string), "%s used /test command", GetName(playerid));
Its not being outputed lol
Re: What am I doing wrong -
Dignity - 14.06.2014
It sends the message to yourself, but not everyone.
Change "SendClientMessage(playerid," to "SendClientMessageToAll(".
Re: What am I doing wrong -
SeniorGamer - 14.06.2014
I know it does. Everything stopped outputing stuff out. Its not displaying any messages I send.
I just added Whirlpool plugin few mins ago and everything stoped being outputed.
Re: What am I doing wrong -
SilentSoul - 14.06.2014
Plugin doesn't matter, Also it works fine for me
I don't know what is the usage of this command but as you like
try to debug
pawn Код:
CMD:test(playerid,params[])
{
printf("%s used /test command",GetName(playerid));
return true;
}
now check your server console if you are able to see this message that means everything is fine
Re: What am I doing wrong -
SeniorGamer - 14.06.2014
Tried. I even got a blank script outputing it normaly but once I add whirlpool it stops outputing stuff lmfao
Re: What am I doing wrong -
Laure - 14.06.2014
Are you sure your whirlpool is not outdated? Also i dont think so whirlpool has anything to do with it.
It should work normally as you said using the following code.
pawn Код:
CMD:test(playerid,params[])
{
new string[128];
format(string, sizeof(string), "%s used /test command", GetName(playerid));
SendClientMessageToAll(playerid, COLOR_YELLOW, string);
return true;
}
Re: What am I doing wrong -
SickAttack - 14.06.2014
Quote:
Originally Posted by Imperor
Are you sure your whirlpool is not outdated? Also i dont think so whirlpool has anything to do with it.
It should work normally as you said using the following code.
pawn Код:
CMD:test(playerid,params[]) { new string[128]; format(string, sizeof(string), "%s used /test command", GetName(playerid)); SendClientMessageToAll(playerid, COLOR_YELLOW, string); return true; }
|
Your cmd is wrong. "SendClientMessageToAll" doesn't have a playerid parameter.
pawn Код:
CMD:test(playerid,params[])
{
new string[128];
format(string, sizeof(string), "%s used /test command", GetName(playerid));
SendClientMessageToAll(COLOR_YELLOW, string);
return 1;
}
Quote:
Originally Posted by SeniorGamer
What did I do wrong here
pawn Код:
CMD:test(playerid,params[]) { new string[128]; format(string, sizeof(string), "%s used /test command", GetName(playerid)); SendClientMessage(playerid, COLOR_YELLOW, string); return true; }
stock GetName(playerid) { new string[MAX_PLAYER_NAME]; GetPlayerName(playerid,string,sizeof(string)); return string; }
|
This is a common problem, witch is very easy to fix. You're formating "string" and "string" in the command and stock, just change the name of "string" in the stock.
pawn Код:
stock GetName(playerid)
{
new stockstring[MAX_PLAYER_NAME];
GetPlayerName(playerid, stockstring, sizeof(stockstring));
return stockstring;
}
And the whole code would look like this:
pawn Код:
CMD:test(playerid,params[])
{
new string[128];
format(string, sizeof(string), "%s used /test command", GetName(playerid));
SendClientMessageToAll(COLOR_YELLOW, string);
return 1;
}
stock GetName(playerid)
{
new stockstring[MAX_PLAYER_NAME];
GetPlayerName(playerid, stockstring, sizeof(stockstring));
return stockstring;
}
Re: What am I doing wrong -
Threshold - 14.06.2014
Quote:
Originally Posted by SickAttack
This is a common problem, witch is very easy to fix. You're formating "string" and "string" in the command and stock, just change the name of "string" in the stock.
|
This would be true if 'string' was a global variable, but it isn't. It's local in both functions and won't be changed by any outside callback or function. The code is fine, but something is stopping it from sending? I don't see what could cause that, and I find it even harder to see how the Whirlpool plugin stops it.