SERVER: Unknown Command but the command appears
#1

Hey guys, I've just fixed my Rules command! Here it is:

Код:
CMD:rules(playerid,params[])
{
	ShowPlayerDialog(playerid,rules,DIALOG_STYLE_MSGBOX,"{FFD000}Server Rules"," 1. Do not go around killing people without a reason.\n 2. Do not bug abuse\n 3. Do not team with hackers, report them as soon as possible\n 4. Do not advertise other servers or websites.\n 5. Do not scam other players in this server\n 6. You may not hack or cheat in this server\n 7. Always respect Admins and other players in this server\n 8. Always speak English in the main chat.","Ok","");
}
Ok, then I go in-game, and the command works fine. But, it says "SERVER: Unknown Command" even though the rules dialog shows up! I hope you can help me fix it!
Reply
#2

It needs a return.

pawn Код:
CMD:rules(playerid)
{
    ShowPlayerDialog(playerid,rules,DIALOG_STYLE_MSGBOX,"{FFD000}Server Rules"," 1. Do not go around killing people without a reason.\n 2. Do not bug abuse\n 3. Do not team with hackers, report them as soon as possible\n 4. Do not advertise other servers or websites.\n 5. Do not scam other players in this server\n 6. You may not hack or cheat in this server\n 7. Always respect Admins and other players in this server\n 8. Always speak English in the main chat.","Ok","");
    return 1;
}
Reply
#3

Oh sorry! I totally forgot about adding:

Код:
return 1;
to my command. I guess I wasn't concentrating. Silly me! You can have a REP for reminding me!


Also 1 more question! How do I change the message from "Server Unknown Command" to something else, when they get a command wrong?


Thanks!
Reply
#4

Also 1 more question! How do I change the message from "Server Unknown Command" to something else, when they get a command wrong?
Reply
#5

use
pawn Код:
OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(!success)
    {
        SendClientMessage(playerid,yourcolor,"This command doesn't exist");
    }
    return 1;
}
if you have zcmd.
Reply
#6

Код:
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\CNRSER~1\GAMEMO~1\Testing.pwn(646) : warning 203: symbol is never used: "OnPlayerCommandPerformed"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Are you sure that works for ZCMD?
Reply
#7

pawn Код:
public OnPlayerCommandPerformed( playerid, cmdtext[ ], success )
{
    if(!success )
        return SendClientMessage( playerid, COLOR_GREY, "Your new unknown command text" );
    return 1; //OnPlayerCommandPerformed requires a value to be returned - sorry i didn't say that earlier
}
Replace the text there with what you want it to return. This only works perfectly if you ONLY have ZCMD and only a GameMode, and not any FilterScripts.
Reply
#8

Код:
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\CNRSER~1\GAMEMO~1\Testing.pwn(540) : warning 209: function "OnPlayerCommandPerformed" should return a value
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Reply
#9

Someone?
Reply
#10

Put a return 1;
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)