Problem:(
#1

How to fix SERVER: Unknown Command ? please help me
Reply
#2

Use:

pawn Код:
if(!strcmp(cmdtext, "/yourcommandhere", true))
    {
        // Functions here
        return 1;
    }
under the:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
calback.

https://sampwiki.blast.hk/wiki/Category:..._Documentation

Good luck

-J

Edit: Or did you mean an custom error message? e.g: Command not found, please use /help
?

fot that use:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/yourcommandhere", true))
    {
          //functions here
    }
    return SendClientMessage(playerid, color_here, "Command not found! Use: /help");
}
Reply
#3

Thanks. fixed
I have a problem I moved the mysql server, but I do not save data .. admin level and look more like ex-admin command:
pawn Код:
if(strcmp(cmd, "/makestaff", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makestaff [playerid/PartOfName] [level(1-3)]");
                return 1;
            }
            new para1;
            new level;
            para1 = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            level = strval(tmp);
            if (PlayerInfo[playerid][pStaff] >= 4)
            {
                if(IsPlayerConnected(para1))
                {
                    if(para1 != INVALID_PLAYER_ID)
                    {
                        new year, month,day;
                        getdate(year, month, day);
                        GetPlayerName(para1, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        PlayerInfo[para1][pStaff] = level;
                        printf("AdmCmd: %s has promoted %s to a level %d admin.", sendername, giveplayer, level);
                        format(string, sizeof(string), "   You have been promoted to a level %d admin by %s", level, sendername);
                        SendClientMessage(para1, 0xFFFFFFFF, string);
                        format(string, sizeof(string), "   You have promoted %s to a level %d admin.", giveplayer,level);
                        SendClientMessage(playerid, 0xFFFFFFFF, string);
                        format(string, 256, "AdmWarning: %s promoted %s to admin level %d.", sendername, giveplayer, level);
                        ABroadCast(COLOR_YELLOW,string,1);
                        //format(string, 256, "[WARNING] Owner %s promoted %s to admin level %d (%d-%d-%d)", sendername, giveplayer, level, day, month, year);
                        //MakeAdminLog(string);
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
            }
        }
    }
Reply
#4

Help me please
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)