04.05.2011, 05:56
How would i get rid of SERVER: Unknown Command.
when i use a command that is unknown to the server
when i use a command that is unknown to the server
public OnPlayerCommandPerformed(playerid, cmdtext[], success) { if(!success) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"Upisali ste komandu koja ne postoji!"); return true; }
return 0;
return SendClientMessage(playerid,0xFFFFFFFF,"WRONG COMMAND Newb ;P");
I have this in my GM and it works, if it help...
Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success) { if(!success) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"Upisali ste komandu koja ne postoji!"); return true; } |
public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/mycommand", cmdtext, true, 10) == 0) { // Do something here return 1; } return 0; }
public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/mycommand", cmdtext, true, 10) == 0) { // Do something here return 1; } else SendClientMessage(playerid, 0xFFFFFFFF, "LAWL, Invalid Command."); return 1; }
public OnPlayerCommandText(playerid, cmdtext[])
{
return SendClientMessage(playerid,0xFFFF00FF,"Your message (instead of the "Unknown Command")");
}
public OnPlayerCommandText(playerid, cmdtext[])
{
//Every command here
return SendClientMessage(playerid, 0xAFAFAFAA, "Custom unknown command text");
}
if(!strcmp(cmdtext, "/my_command"))
{
//Do something
return 1; //<--
}
switch(random(10))
{
case 0,1,2,3: print("0, 1, 2 or 3 was the random"); //if it is 0, 1, 2 or 3
default: print("The random was something else"); //if it's something else
}