12.09.2010, 09:00
Here's my code, to start with(Please don't copy it you fucking lazy idiot):
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.
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;
}
/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.