Unknown command?
#1

Hello.
I got this command:
Код:
CMD:makeadmin(playerid, params[])
{
    new targetid, level, string[100];
    if(!IsPlayerAdmin(playerid)||PlayerInfo[playerid][pAdmin] < 7) return SendClientMessage(playerid,0xFF0000FF,"{FF0000}[SERVER]You're not authorized to use that command.");
    if(sscanf(params, "ud", targetid, level)) return SendClientMessage(playerid, COLOR_RED, "{FF0000}[SERVER]Usage: /makeadmin [playerid] [adminlevel]");
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "{FF0000}[SERVER]{BABABA} Player is not connected!");
    PlayerInfo[targetid][pAdmin] = level;
    format(string, sizeof(string), "{FF0000}[SERVER]{FFFFFF}%s {BABABA}set your {FFFFFF}Admin {BABABA}Level to{FF0000} %d", GetName(playerid), level);
    SendClientMessage(targetid, COLOR_GREEN, string);
    format(string, sizeof(string), "{FF0000}[SERVER]{BABABA}You set {FFFFFF}%s's {FFFFFF}Admin {BABABA}Level to{FF0000} %d", GetName(targetid), level);
    SendClientMessage(playerid, COLOR_GREEN, string);
    return 1;
}
When I type in game /makeadmin it says "SERVER: Unknown command.". Any ideas?
Reply
#2

Try putting random prints each line and see if it puts anything into the console:

pawn Код:
CMD:makeadmin(playerid, params[])
{
    new targetid, level, string[100];
    print("A");
    if(!IsPlayerAdmin(playerid)||PlayerInfo[playerid][pAdmin] < 7) return SendClientMessage(playerid,0xFF0000FF,"{FF0000}[SERVER]You're not authorized to use that command.");
    print("B");
    if(sscanf(params, "ud", targetid, level)) return SendClientMessage(playerid, COLOR_RED, "{FF0000}[SERVER]Usage: /makeadmin [playerid] [adminlevel]");
    print("C");
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "{FF0000}[SERVER]{BABABA} Player is not connected!");
    print("D");
    PlayerInfo[targetid][pAdmin] = level;
    print("E");
    format(string, sizeof(string), "{FF0000}[SERVER]{FFFFFF}%s {BABABA}set your {FFFFFF}Admin {BABABA}Level to{FF0000} %d", GetName(playerid), level);
    print("F");
    SendClientMessage(targetid, COLOR_GREEN, string);
    print("G");
    format(string, sizeof(string), "{FF0000}[SERVER]{BABABA}You set {FFFFFF}%s's {FFFFFF}Admin {BABABA}Level to{FF0000} %d", GetName(targetid), level);
    print("H");
    SendClientMessage(playerid, COLOR_GREEN, string);
    return 1;
}
See what letter it gets up to if any.
Reply
#3

Quote:
Originally Posted by [HiC]TheKiller
Посмотреть сообщение
Try putting random prints each line and see if it puts anything into the console:

pawn Код:
CMD:makeadmin(playerid, params[])
{
    new targetid, level, string[100];
    print("A");
    if(!IsPlayerAdmin(playerid)||PlayerInfo[playerid][pAdmin] < 7) return SendClientMessage(playerid,0xFF0000FF,"{FF0000}[SERVER]You're not authorized to use that command.");
    print("B");
    if(sscanf(params, "ud", targetid, level)) return SendClientMessage(playerid, COLOR_RED, "{FF0000}[SERVER]Usage: /makeadmin [playerid] [adminlevel]");
    print("C");
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "{FF0000}[SERVER]{BABABA} Player is not connected!");
    print("D");
    PlayerInfo[targetid][pAdmin] = level;
    print("E");
    format(string, sizeof(string), "{FF0000}[SERVER]{FFFFFF}%s {BABABA}set your {FFFFFF}Admin {BABABA}Level to{FF0000} %d", GetName(playerid), level);
    print("F");
    SendClientMessage(targetid, COLOR_GREEN, string);
    print("G");
    format(string, sizeof(string), "{FF0000}[SERVER]{BABABA}You set {FFFFFF}%s's {FFFFFF}Admin {BABABA}Level to{FF0000} %d", GetName(targetid), level);
    print("H");
    SendClientMessage(playerid, COLOR_GREEN, string);
    return 1;
}
See what letter it gets up to if any.
When I type /makeadmin it doesn't print anything to the console..
Reply
#4

Make sure you installed ZCMD also your script seems okay.
Reply
#5

Commands like this, work:

Код:
CMD:god(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,0xFF0000FF,"{FF0000}[SERVER]{BABABA}You're not authorized to use that command.");
	SetPlayerHealth(playerid, 100000);
	return 1;
}
Reply
#6

Do you happen to have makeadmin in any other scripts of yours?
Reply
#7

I don't get it?
Reply
#8

Btw, simple commands like this, don't work:

Код:
COMMAND:kill(playerid, params[])
{
	SetPlayerHealth(playerid, 0.0);
	return 1;
}
Reply
#9

Interesting, do you happen to have OnPlayerCommandText within your script as well?
Reply
#10

Yes I do..

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/mycommand", cmdtext, true, 10) == 0)
	{
		// Do something here
		return 1;
	}
	return SendClientMessage(playerid, 0xFF0000,"{BABABA}Invalid Command: Type /help for more information.");
}
**Ignore this:
Quote:

return SendClientMessage(playerid, 0xFF0000,"{BABABA}Invalid Command: Type /help for more information.");

Btw, I don't think that it cause that error because commands like:
Код:
COMMAND:god(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,0xFF0000FF,"{FF0000}[SERVER]{BABABA}You're not authorized to use that command.");
	SetPlayerHealth(playerid, 100000);
	return 1;
}
, work.
Reply
#11

Do some commands happen to be above OnPlayerCommandText and some below OnPlayerCommandText? Try removing OnPlayerCommandText and trying again.
Reply
#12

Quote:
Originally Posted by [HiC]TheKiller
Посмотреть сообщение
Do some commands happen to be above OnPlayerCommandText and some below OnPlayerCommandText? Try removing OnPlayerCommandText and trying again.
Same..
Reply
#13

Change
pawn Код:
if(sscanf(params, "ud", targetid, level))
To
pawn Код:
if(sscanf(params, "ui", targetid, level))
Reply
#14

Quote:
Originally Posted by M0HAMMAD
Посмотреть сообщение
Change
pawn Код:
if(sscanf(params, "ud", targetid, level))
To
pawn Код:
if(sscanf(params, "ui", targetid, level))
I don't think that this cause it..Look the comments..There are also commands like: /kill which don't work.

Код:
COMMAND:kill(playerid, params[])
{
	SetPlayerHealth(playerid, 0.0);
	return 1;
}
Reply
#15

Quote:
Originally Posted by M0HAMMAD
Посмотреть сообщение
Change
pawn Код:
if(sscanf(params, "ud", targetid, level))
To
pawn Код:
if(sscanf(params, "ui", targetid, level))
That won't make any difference.

Are you sure you've not got the command makeadmin in other filterscripts or your gamemode? Maybe that's what's causing the problem. Try this, rescripted:

pawn Код:
CMD:makeadmin(playerid, params[])
{
    if(!IsPlayerAdmin(playerid) && PlayerInfo[playerid][pAdmin] < 7) return SendClientMessage(playerid, 0xFF0000FF, "{FF0000}[SERVER]You're not authorized to use that command.");
    new targetid, level;
    if(sscanf(params, "ui", targetid, level)) return SendClientMessage(playerid, COLOR_WHITE, "{FF0000}[SERVER]Usage /makeadmin [playerid] [adminlevel]");
    if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_WHITE, "{FF0000}[SERVER]{BABABA} Player is not connected!");
    PlayerInfo[targetid][pAdmin] = level;
    new string[150];
    format(string, sizeof(string), "{FF0000}[SERVER]{FFFFFF}%s {BABABA}set your {FFFFFF}Admin {BABABA}Level to {FF0000}%d", GetName(playerid), level);
    SendClientMessage(targetid, COLOR_GREEN, string);
    format(string, sizeof(string), "{FF0000}[SERVER]{BABABA}You set {FFFFFF}%s's Admin {BABABA}Level to {FF0000}%d", GetName(targetid), level);
    SendClientMessage(playerid, COLOR_GREEN, string);
    return 1;
}
Reply
#16

I told you guys..
Commands which don't work:
/pm, /dnd, /reply, /stopradio, /radio, /kill, /godoff, /clearchat, /makeadmin

Commands which work: /makevip, /god, /ct, /hey, /youidiot (lol;p), /never, /punk, /stats, /vipmenu, /stopmaps, /gotopos, /jetpack

Example of commands which don't work:
(/kill)
Код:
COMMAND:kill(playerid, params[])
{
	SetPlayerHealth(playerid, 0.0);
	return 1;
}
Example of commands which work:
(/god)
Код:
COMMAND:god(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,0xFF0000FF,"{FF0000}[SERVER]{BABABA}You're not authorized to use that command.");
	SetPlayerHealth(playerid, 100000);
	return 1;
}
It's simple. Some commands work and some others don't.
Reply
#17

Try changing the name of the command from makeadmin to makeadmintest or something. See if it works.
Reply
#18

Quote:
Originally Posted by [HiC]TheKiller
Посмотреть сообщение
Try changing the name of the command from makeadmin to makeadmintest or something. See if it works.
I made some new commands and the same happens. Btw, I don't think that it makes sense..?
Reply
#19

Hmm have you tried recompiling + updating includes?
On the top of script what's your include definitions.
Reply
#20

You have a filterscript that uses strcmp.

Quote:
Originally Posted by [HiC]TheKiller
Посмотреть сообщение
Try changing the name of the command from makeadmin to makeadmintest or something. See if it works.
. . . .
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)