SA-MP Forums Archive
SERVER: Unknown Command but the command appears - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SERVER: Unknown Command but the command appears (/showthread.php?tid=410616)



SERVER: Unknown Command but the command appears - Goldino - 26.01.2013

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!


Re: SERVER: Unknown Command but the command appears - Psymetrix - 26.01.2013

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;
}



Re: SERVER: Unknown Command but the command appears - Goldino - 26.01.2013

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!


Re: SERVER: Unknown Command but the command appears - Goldino - 26.01.2013

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



Re: SERVER: Unknown Command but the command appears - CoDeZ - 26.01.2013

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


Re: SERVER: Unknown Command but the command appears - Goldino - 26.01.2013

Код:
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?


Re: SERVER: Unknown Command but the command appears - denNorske - 26.01.2013

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.


Re: SERVER: Unknown Command but the command appears - Goldino - 26.01.2013

Код:
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.



Re: SERVER: Unknown Command but the command appears - Goldino - 26.01.2013

Someone?


Re: SERVER: Unknown Command but the command appears - SilverKiller - 26.01.2013

Put a return 1;