Command works but says unknown command? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Command works but says unknown command? (
/showthread.php?tid=289157)
Command works but says unknown command? -
Shuffler - 10.10.2011
Hey so when i type /ooc message it says my message, but also says under the working message SERVER: Unknown command. The second problem is, after 5 characters in /ooc example 12345 it shows OOC: : 12345 but when i do /ooc 1234 it does OOC: My_Name: 1234. Help?
pawn Код:
CMD:ooc(playerid, params[])
{
new OOCT;
new string[246];
if(sscanf(params, "s[126]", OOCT)) return SendClientMessage(playerid, COLOR_RED, "USE: /ooc [message]");
if(ooc == 0)
{
return SendClientMessage(playerid, COLOR_GREY, "The OOC channel is closed!");
}
else
{
format(string, sizeof(string), "(( OOC: %s: %s ))", pName(playerid), OOCT);
SendClientMessageToAll(COLOR_GREY, string);
print(string);
return 1;
}
return 0;
}
Re: Command works but says unknown command? -
QuaTTrO - 10.10.2011
pawn Код:
CMD:ooc(playerid, params[])
{
new OOCT[126];
new string[246];
if(sscanf(params, "s[126]", OOCT)) return SendClientMessage(playerid, COLOR_RED, "USE: /ooc [message]");
if(ooc == 0)
{
return SendClientMessage(playerid, COLOR_GREY, "The OOC channel is closed!");
}
else
{
format(string, sizeof(string), "(( OOC: %s: %s ))", pName(playerid), OOCT);
SendClientMessageToAll(COLOR_GREY, string);
print(string);
return 1;
}
return 1;
}
i think this will be work
Re: Command works but says unknown command? -
Jafet_Macario - 10.10.2011
You don't need sscanf.
pawn Код:
CMD:ooc(playerid, params[])
{
new string[246];
if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "USE: /ooc [message]");
if(ooc == 0) return SendClientMessage(playerid, COLOR_GREY, "The OOC channel is closed!");
format(string, sizeof(string), "(( OOC: %s: %s ))", pName(playerid), params);
SendClientMessageToAll(COLOR_GREY, string);
print(string);
return 1;
}
Re: Command works but says unknown command? -
Kush - 10.10.2011
Your returning everything inside the compound expression or statement (everything within the first and last code block) as false.