SA-MP Forums Archive
Invalid CMD? (Rep+) - 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: Invalid CMD? (Rep+) (/showthread.php?tid=303001)



Invalid CMD? (Rep+) - JohnDoVaS12345 - 11.12.2011

um hi.
could you tell me how to create a script that it will say "Invalid CMD" when i press an invalid cmd? xD i'm a noob plz help


Re: Invalid CMD? - THE_KNOWN - 11.12.2011

it says that by default. unless you wanna change the text.


Re: Invalid CMD? - JohnDoVaS12345 - 11.12.2011

Quote:
Originally Posted by THE_KNOWN
Посмотреть сообщение
it says that by default. unless you wanna change the text.
my GameMode does not says it.


Re: Invalid CMD? - THE_KNOWN - 11.12.2011

what command processor do you use?


Re: Invalid CMD? (Rep+) - Kostas' - 11.12.2011

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/example", true)) {
        //Something Here
        return 1;
    }
    return SendClientMessage(playerid, -1, "Invalid CMD");
}



Re: Invalid CMD? (Rep+) - Calgon - 11.12.2011

Quote:
Originally Posted by Kostas'
Посмотреть сообщение
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/example", true)) {
        //Something Here
        return 1;
    }
    return SendClientMessage(playerid, -1, "Invalid CMD");
}
...not everyone uses strcmp directly in OnPlayerCommandText.


Re: Invalid CMD? (Rep+) - THE_KNOWN - 11.12.2011

Quote:
Originally Posted by Calgon
Посмотреть сообщение
...not everyone uses strcmp directly in OnPlayerCommandText.
agreed. Thats why I asked for the Command Processor he is using


Re: Invalid CMD? (Rep+) - Kostas' - 11.12.2011

pawn Код:
// In ZCMD:

public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if (!success) {
        SendClientMessage(playerid, -1, "Invalid CMD");
    }
    return 1;
}

// In Strcmp:

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/example", true)) {
        //Something Here
        return 1;
    }
    return SendClientMessage(playerid, -1, "Invalid CMD");
}



Re: Invalid CMD? (Rep+) - JohnDoVaS12345 - 11.12.2011

Quote:
Originally Posted by Kostas'
Посмотреть сообщение
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/example", true)) {
        //Something Here
        return 1;
    }
    return SendClientMessage(playerid, -1, "Invalid CMD");
}
C:\Users\Giannis\Desktop\SA-MP Server\gamemodes\XtremeGaming.pwn(290) : warning 202: number of arguments does not match definition
C:\Users\Giannis\Desktop\SA-MP Server\gamemodes\XtremeGaming.pwn(2330) : error 010: invalid function or declaration
C:\Users\Giannis\Desktop\SA-MP Server\gamemodes\XtremeGaming.pwn(2332) : error 010: invalid function or declaration
C:\Users\Giannis\Desktop\SA-MP Server\gamemodes\XtremeGaming.pwn(2334) : error 010: invalid function or declaration
C:\Users\Giannis\Desktop\SA-MP Server\gamemodes\XtremeGaming.pwn(2336) : error 010: invalid function or declaration
C:\Users\Giannis\Desktop\SA-MP Server\gamemodes\XtremeGaming.pwn(233 : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


5 Errors.


Re: Invalid CMD? (Rep+) - Kostas' - 11.12.2011

Quote:
Originally Posted by JohnDoVaS12345
Посмотреть сообщение
C:\Users\Giannis\Desktop\SA-MP Server\gamemodes\XtremeGaming.pwn(290) : warning 202: number of arguments does not match definition
C:\Users\Giannis\Desktop\SA-MP Server\gamemodes\XtremeGaming.pwn(2330) : error 010: invalid function or declaration
C:\Users\Giannis\Desktop\SA-MP Server\gamemodes\XtremeGaming.pwn(2332) : error 010: invalid function or declaration
C:\Users\Giannis\Desktop\SA-MP Server\gamemodes\XtremeGaming.pwn(2334) : error 010: invalid function or declaration
C:\Users\Giannis\Desktop\SA-MP Server\gamemodes\XtremeGaming.pwn(2336) : error 010: invalid function or declaration
C:\Users\Giannis\Desktop\SA-MP Server\gamemodes\XtremeGaming.pwn(233 : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


5 Errors.

Edit: I use zcmd
That was for strcmp. It was stupid from me, that I didn't ask for command processor.
For ZCMD use OnPlayerCommandPerformed callback
pawn Код:
// In ZCMD:

public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if (!success) {
        SendClientMessage(playerid, -1, "Invalid CMD");
    }
    return 1;
}