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;
}