/set command - "SERVER: Unknown Message" (Help)
#1

Here's my code, to start with(Please don't copy it you fucking lazy idiot):

pawn Код:
dcmd_set(playerid, params[])
{
    new aitem;
    new id;
    new amount;
    if(PlayerInfo[playerid][AdminLevel] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    if(sscanf(params,"sud",aitem,id,amount)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /set (/help sets) (ID/Partial Name) (Amount/Level/Faction)");
    new item[128];
    format(item,sizeof(item),"%s",aitem);
    if(!strcmp(item,"admin",true))
    {
        if(PlayerInfo[playerid][AdminLevel] < 4) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
        if(IsPlayerConnected(id))
        {
            if(amount >= 0 && amount < 6)
            {
                if(amount == 5 && PlayerInfo[playerid][AdminLevel] < 5) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to set a players Admin Level to Level 5.");
                if(amount == 4) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to set a players Admin Level to Level 4.");
                PlayerInfo[id][AdminLevel] = amount;
                new pname[64];
                GetPlayerName(id, pname,sizeof(pname));
                new string[128];
                new astring[128];
                new aname[64];
                GetPlayerName(playerid, aname,sizeof(aname));
                new arank[14];
                if(PlayerInfo[playerid][AdminLevel] == 4) format(arank,sizeof(arank), "Lead Admin");
                if(PlayerInfo[playerid][AdminLevel] == 5) format(arank,sizeof(arank), "Server Owner");
                new prank[14];
                if(PlayerInfo[id][AdminLevel] == 1) format(prank,sizeof(prank), "Assistant");
                if(PlayerInfo[id][AdminLevel] == 2) format(prank,sizeof(prank), "Moderator");
                if(PlayerInfo[id][AdminLevel] == 3) format(prank,sizeof(prank), "Admin");
                if(PlayerInfo[id][AdminLevel] == 4) format(prank,sizeof(prank), "Lead Admin");
                if(PlayerInfo[id][AdminLevel] == 5) format(prank,sizeof(prank), "Server Owner");
                format(string,sizeof(string), "set %s(%d)'s Admin Level to %s(%d).", pname, id, prank, amount);
                SendAdminMessage(playerid, string);
                format(astring,sizeof(astring),"** Congratulations! %s %s(%d) set your Admin Level to %s(%d)!", arank, aname, playerid, prank, amount);
                SendClientMessage(playerid, COLOR_CYAN, astring);
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "USAGE: /set admin (ID/Partial Name) (Admin Level ID)");
                SendClientMessage(playerid, COLOR_GREY, "Normal Player(0), Assistant(1), Moderator(2), Admin(3), Lead Admin(4), Server Owner(5)");
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, "Invalid Player ID/Name.");
        }
    }
    if(!strcmp(item,"donator",true))
    {
        if(PlayerInfo[playerid][AdminLevel] < 4) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
        if(IsPlayerConnected(id))
        {
            if(amount >= 0 && amount < 6)
            {
                PlayerInfo[id][DonatorLevel] = amount;
                new pname[64];
                GetPlayerName(id, pname,sizeof(pname));
                new string[128];
                new astring[128];
                new aname[64];
                GetPlayerName(playerid, aname,sizeof(aname));
                new arank[14];
                if(PlayerInfo[playerid][AdminLevel] == 4) format(arank,sizeof(arank), "Lead Admin");
                if(PlayerInfo[playerid][AdminLevel] == 5) format(arank,sizeof(arank), "Server Owner");
                format(string,sizeof(string), "set %s(%d)'s Donator Level to %d.", pname, id, amount);
                SendAdminMessage(playerid, string);
                format(astring,sizeof(astring),"** %s %s(%d) set your Donator Level to %d! Thank you for your contribution.", arank, aname, playerid, amount);
                SendClientMessage(playerid, COLOR_DONATORGOLD, astring);
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "USAGE: /set donator (ID/Partial Name) (Donator Level 0-5)");
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, "Invalid Player ID/Name.");
        }
    }
    if(!strcmp(item,"skin",true))
    {
        if(PlayerInfo[playerid][AdminLevel] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
        if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_GREY, "Invalid Player ID/Name.");
        if(amount < 0 || amount > 299 || amount == 42 || amount == 53 || amount == 65 || amount == 74 || amount == 86 || amount == 91 || amount == 119 || amount == 149 || amount == 208 || amount == 273) return SendClientMessage(playerid, COLOR_GREY, "Invalid Skin ID. [0-299] - Note: Some doesn't work.");
        SetPlayerSkin(id, amount);
        new aname[64];
        GetPlayerName(playerid, aname,sizeof(aname));
        new pstring[128];
        new arank[16];
        if(PlayerInfo[playerid][AdminLevel] == 3) format(arank,sizeof(arank), "Admin");
        if(PlayerInfo[playerid][AdminLevel] == 4) format(arank,sizeof(arank), "Lead Admin");
        if(PlayerInfo[playerid][AdminLevel] == 5) format(arank,sizeof(arank), "Server Owner");
        format(pstring,sizeof(pstring),"** %s %s(%d) has changed your skin to Skin ID %d", arank, aname, playerid, amount);
        SendClientMessage(id, COLOR_CYAN, pstring);
        new astring[128];
        new pname[64];
        GetPlayerName(id, pname,sizeof(pname));
        format(astring,sizeof(astring), "has changed the skin of %s(%d) to ID %d.", pname, id, amount);
        SendAdminMessage(playerid, astring);
    }
    if(!strcmp(item,"health",true))
    {
        if(PlayerInfo[playerid][AdminLevel] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
        if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_GREY, "Invalid Player ID/Name.");
        if(amount < 0 || amount > 100) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /set health (ID/Partial Name) (1-100)");
        SetPlayerHealth(id, amount);
        new aname[64];
        GetPlayerName(playerid, aname,sizeof(aname));
        new pstring[128];
        new arank[16];
        if(PlayerInfo[playerid][AdminLevel] == 3) format(arank,sizeof(arank), "Admin");
        if(PlayerInfo[playerid][AdminLevel] == 4) format(arank,sizeof(arank), "Lead Admin");
        if(PlayerInfo[playerid][AdminLevel] == 5) format(arank,sizeof(arank), "Server Owner");
        format(pstring,sizeof(pstring),"** %s %s(%d) has set your health to %d", arank, aname, playerid, amount);
        SendClientMessage(id, COLOR_CYAN, pstring);
        new astring[128];
        new pname[64];
        GetPlayerName(id, pname,sizeof(pname));
        format(astring,sizeof(astring), "has set the health of %s(%d) to %d.", pname, id, amount);
        SendAdminMessage(playerid, astring);
    }
    if(!strcmp(item,"armor",true))
    {
        if(PlayerInfo[playerid][AdminLevel] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
        if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_GREY, "Invalid Player ID/Name.");
        if(amount < 0 || amount > 100) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /set armor (ID/Partial Name) (1-100)");
        SetPlayerArmour(id, amount);
        new aname[64];
        GetPlayerName(playerid, aname,sizeof(aname));
        new pstring[128];
        new arank[16];
        if(PlayerInfo[playerid][AdminLevel] == 3) format(arank,sizeof(arank), "Admin");
        if(PlayerInfo[playerid][AdminLevel] == 4) format(arank,sizeof(arank), "Lead Admin");
        if(PlayerInfo[playerid][AdminLevel] == 5) format(arank,sizeof(arank), "Server Owner");
        format(pstring,sizeof(pstring),"** %s %s(%d) has set your armor to %d", arank, aname, playerid, amount);
        SendClientMessage(id, COLOR_CYAN, pstring);
        new astring[128];
        new pname[64];
        GetPlayerName(id, pname,sizeof(pname));
        format(astring,sizeof(astring), "has set the armor of %s(%d) to %d.", pname, id, amount);
        SendAdminMessage(playerid, astring);
    }
    else
    {
        SendClientMessage(playerid, COLOR_GREY, "XUSAGE: /set (/help sets) (ID/Partial Name) (Amount/Level/Faction)");
    }
    return 1;
}
My problem is that any command returns "SERVER: Unknown Message", for some reason, that I can't figure out.

/set skin (id) (something) works, it sets the skin and sends the messages, but it also says "SERVER: Unknown Command".

Yeah, if someone could take a look at my code and tell me what I failed at, I'll be happy


EDIT: Wait shit, I realized I might have a fix myself.

EDIT2: Nope didn't fix it.
Reply
#2

your using if(!strcmp(item,"skin",true)) i thin when you have the ! in it means if it isn't
Reply
#3

Quote:
Originally Posted by willsuckformoney
Посмотреть сообщение
your using if(!strcmp(item,"skin",true)) i thin when you have the ! in it means if it isn't
No. ! means if they are same, as far as I know ._.
Reply
#4

Quote:
Originally Posted by Monty_Burns
Посмотреть сообщение
muahahahaha thanks for the code
nah joking but calling meh that nah i wont help xD
It was to the faggots who go to the forum just to steal others' hard work.

If you don't wanna help, fine. You don't have to say that, do you?
Reply
#5

Then why are you commenting like that? LOL :P
Reply
#6

Quote:
Originally Posted by Monty_Burns
Посмотреть сообщение
well calling others faggots wont help and if you dont want to steal your code dont put the hole command
put like 3 lines and in the middle the error line, USE your brain xD

This forum requires that you wait 120 seconds between posts. Please try again in 21 seconds.
freaking boxhead forum!
I honestly think you should use your brain. Of course my whole code needs to be there, for it to be corrected. I don't know where the error is.

Also, if you didn't intend stealing it, then I didn't call you anything. But I don't like people who try to steal others code. If that's not you, then stop acting like an offended 10-year old.

Thank you.

Anyone got any clues?

EDIT: There are no error lines either. So maybe you should read my thread first.
Reply
#7

Quote:
Originally Posted by Monty_Burns
Посмотреть сообщение
This forum requires that you wait 120 seconds between posts. Please try again in 21 seconds.
freaking boxhead forum!
u mad?

Ontopic:
Try using Sccanf and see if anything changes.
Reply
#8

Quote:
Originally Posted by miokie
Посмотреть сообщение
u mad?

Ontopic:
Try using Sccanf and see if anything changes.
Where and how?

Instead of what?
Reply
#9

He is using sscanf. Your first problem is here:

pawn Код:
new aitem; // cell, but you're trying to put a string in it!
    new id;
    new amount;
    if(PlayerInfo[playerid][AdminLevel] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    if(sscanf(params,"sud",aitem,id,amount)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /set (/help sets) (ID/Partial Name) (Amount/Level/Faction)"); // your sscanf line is putting a string in the cell.
    new item[128];
    format(item,sizeof(item),"%s",aitem); // now you're putting this cell in a string array, your data is lost.
pawn Код:
new item[128]; // create a string array
    new id;
    new amount;
    if(PlayerInfo[playerid][AdminLevel] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    if(sscanf(params,"sud",item,id,amount)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /set (/help sets) (ID/Partial Name) (Amount/Level/Faction)"); // put the first parameter directly into the string.
Reply
#10

Quote:
Originally Posted by Simon
Посмотреть сообщение
He is using sscanf. Your first problem is here:

pawn Код:
new aitem; // cell, but you're trying to put a string in it!
    new id;
    new amount;
    if(PlayerInfo[playerid][AdminLevel] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    if(sscanf(params,"sud",aitem,id,amount)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /set (/help sets) (ID/Partial Name) (Amount/Level/Faction)"); // your sscanf line is putting a string in the cell.
    new item[128];
    format(item,sizeof(item),"%s",aitem); // now you're putting this cell in a string array, your data is lost.
pawn Код:
new item[128]; // create a string array
    new id;
    new amount;
    if(PlayerInfo[playerid][AdminLevel] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    if(sscanf(params,"sud",item,id,amount)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /set (/help sets) (ID/Partial Name) (Amount/Level/Faction)"); // put the first parameter directly into the string.
Oh, I'll check that
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)