PDA

View Full Version : %s unkown command


rido1998
19/01/2012, 09:17 AM
Hello friends,my request code player use command and command not mode should "%s not command" thank you.

[ABK]Antonio
19/01/2012, 09:18 AM
are you using OnPlayerCommandText?

rido1998
19/01/2012, 09:19 AM
Yeah.

[ABK]Antonio
19/01/2012, 09:23 AM
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp("/ban", cmdtext, true))
{
if(IsPlayerAdmin(playerid))
{
new id;
if(sscanf(cmdtext, "r", id)) return SendClientMessage(playerid, 0xCC0000AA, "USAGE: /ban <playerid/partofname>");
if(IsPlayerAdmin(id)) return SendClientMessage(playerid, 0xCC0000AA, "You can't ban admins!");

new str[128], name[MAX_PLAYER_NAME], bname[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(id, bname, sizeof(bname));
format(str,sizeof(str), "%s[%d] has banned %s[%d]", name, playerid, bname, id);
SendClientMessageToAll(0xCC0000AA, str);
BanEx(id, str);

}
return 1;
}
return SendClientMessage(playerid, 0xCC0000AA, "Invalid Command."); //this should work
}

rido1998
19/01/2012, 09:27 AM
Not my request example player use /aasadasdasd and not command message: "/aasadasdasd" not command okey ?

[ABK]Antonio
19/01/2012, 09:30 AM
Not my request search my request use command name example player use /aasadasdasd and not command message: "/aasadasdasd" not command okey ?

what

MasterJoker
19/01/2012, 09:38 AM
oh i know what he mean when he use a command he want to announce to everyone

rido1998
19/01/2012, 09:47 AM
Not topic post.

spedico
19/01/2012, 12:02 PM
He means that if you type an invalid command (such as /hi, and there's no such command) it says "/hi is not a valid command".

[ABK]Antonio
19/01/2012, 12:13 PM
new str[128];
format(str,sizeof(str), "%s is not a valid command!", cmdtext);
return SendClientMessage(playerid, 0xCC0000AA, str);


What about this?