Simple command isn't working -
Kingunit - 27.08.2011
Hello,
I'm create some simple commands, but this one doens't work. It's just strange since I don't see the fault.
I've used those command before and those just worked. This one not:
pawn Code:
//-----[Me]-----
CMD:me(playerid, params[])
{
if(sscanf(params, "s", playerid)) return SendClientMessage(playerid, COLOR_WHITE, ""#COL_DGREY"[CMD] / "#COL_SGREY"[Action]");
new string[128], text[64], pName[24];
GetPlayerName(playerid,pName,128);
format(string,sizeof string,"* %s %s",pName,text);
SendClientMessageToAll(COLOR_RED,string);
return 1;
}
When I am ingame the output is just:
*
Re: Simple command isn't working -
[MG]Dimi - 27.08.2011
PHP Code:
new string[128], text[64], pName[24];
GetPlayerName(playerid,pName,128);
Up there you have pName[24] and down you have GetPlayerName(playerid,pName,12
Maybe that?
AW: Simple command isn't working -
Nero_3D - 27.08.2011
the text variable looks pretty empty and sscanf surly wants an string not an integer as output
Re: Simple command isn't working -
Jafet_Macario - 27.08.2011
PHP Code:
CMD:me(playerid, params[])
{
new pName[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, pName, sizeof(pName));
if(isnull(params)) return SendClientMessage(playerid, COLOR_WHITE, ""#COL_DGREY"[CMD] / "#COL_SGREY"[Action]");
format(string, sizeof(string), "* %s %s", pName, params);
SendClientMessageToAll(COLOR_RED,string);
return 1;
}
Re: Simple command isn't working -
Kingunit - 27.08.2011
Quote:
Originally Posted by Jafet_Macario
PHP Code:
CMD:me(playerid, params[])
{
new pName[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, pName, sizeof(pName));
if(isnull(params)) return SendClientMessage(playerid, COLOR_WHITE, ""#COL_DGREY"[CMD] / "#COL_SGREY"[Action]");
format(string, sizeof(string), "* %s %s", pName, params);
SendClientMessageToAll(COLOR_RED,string);
return 1;
}
|
Yes, those are working. But now if I use it I didn't learned anything. Can someone show me a example with using sscanf? So I can see what I've did wrong.
Re: Simple command isn't working -
Jafet_Macario - 27.08.2011
You don't need to:
because sscanf will use params so you only gotta check if the params are null
Re: Simple command isn't working -
Kingunit - 27.08.2011
Aah okay. Anyway thank you for helping me all