SERVER: Unkown Command (Help)
#1

Hey guys, I want that when the players typed a wrong command It will show him another text, so i added this code

Код:
forward OnPlayerCommandPerformed(playerid, cmdtext[], success);
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(!success) SendClientMessage(playerid, COLOR_RED, "This Command is wrong.");
    return 1;
}
But i want for example if the player types /aaaa it will show him a message

Код:
The command /aaaa couldn't be found, look at /cmds
Reply
#2

Try This :
Quote:

forward OnPlayerCommandPerformed(playerid, cmdtext[], success);
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(!success)
{
new string[240];
format(string, sizeof(string), "The command %s couldn't be found, look at /cmds", cmdtext);
SendClientMessage(playerid, COLOR_RED, string);
return 1;
}

+Rep if i helped you !
Reply
#3

The code maybe not closed or have problems i am trying to fix it and can't.
Reply
#4

Ok !??
pawn Код:
forward OnPlayerCommandPerformed(playerid, cmdtext[], success);
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(!success)
    {
        new string[240];
        format(string, sizeof(string), "The command %s couldn't be found, look at /cmds", cmdtext);
        SendClientMessage(playerid, COLOR_RED, string);
    }
        return 1;
}
Reply
#5

pawn Код:
forward OnPlayerCommandPerformed(playerid, cmdtext[], success);
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(!success)
    {
        new string[240];
        format(string, sizeof(string), "SERVER: UNKNOWN COMMAND '"%s"' ", cmdtext);
        SendClientMessage(playerid, COLOR_RED, string);
    }
        return 1;
}
Reply
#6

Worked, But this is the right code :

Код:
forward OnPlayerCommandPerformed(playerid, cmdtext[], success);
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(!success)
    {
        new string[240];
        format(string, sizeof(string), "The command %s couldn't be found, look at /cmds", cmdtext);
        SendClientMessage(playerid, COLOR_RED, string);
    	return 1;
    }
    return 0;
}
You should do the return value
Reply
#7

aight bro plz rep me if i heled me
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)