Invalid Command!
#1

i've made that if the player types in an invalid command , that code does its function
Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{	
        if(!success)
	{
	    SendClientMessage(playerid,COL_GREEN,"ERROR: Invalid command! Check /CMDS for the commands list");
	}
	return 1;
}
yes it does show when a player types an invalid cmd but it also shows up when a player types a valid one

any help ?
Reply
#2

PHP код:
public OnPlayerCommandPerformed(playeridcmdtext[], success)
{    
        if(
success == 0)
    {
        
SendClientMessage(playerid,COL_GREEN,"ERROR: Invalid command! Check /CMDS for the commands list");
    }
    return 
1;

Reply
#3

Quote:
Originally Posted by jlalt
Посмотреть сообщение
PHP код:
public OnPlayerCommandPerformed(playeridcmdtext[], success)
{    
        if(
success == 0)
    {
        
SendClientMessage(playerid,COL_GREEN,"ERROR: Invalid command! Check /CMDS for the commands list");
    }
    return 
1;

Changing ! to ==0 doesn't fix a fucking code god damn it, stop being a kosmaghz
You should use this callback for invalid command since latest YSI update
PHP код:
public e_COMMAND_ERRORS:OnPlayerCommandReceived(playeridcmdtext[], e_COMMAND_ERRORS:success)
{
    if (
success != COMMAND_OK)
    {
        return 
SendClientMessage(playerid,COL_GREEN,"ERROR: Invalid command! Check /CMDS for the commands list");
    }
    return 
1;

Reply
#4

Quote:
Originally Posted by PrO.GameR
Посмотреть сообщение
Changing ! to ==0 doesn't fix a fucking code god damn it, stop being a kosmaghz
You should use this callback for invalid command since latest YSI update
PHP код:
public e_COMMAND_ERRORS:OnPlayerCommandReceived(playeridcmdtext[], e_COMMAND_ERRORS:success)
{
    if (
success != COMMAND_OK)
    {
        return 
SendClientMessage(playerid,COL_GREEN,"ERROR: Invalid command! Check /CMDS for the commands list");
    }
    return 
1;

stop swearing nab just wait for he's own reply to see if it does not work
Reply
#5

pro.gamer was right lol.
Reply
#6

In this topic https://sampforum.blast.hk/showthread.php?tid=593886

btw i tried both , they dont work
Reply
#7

Can you show a valid command from your gamemode?
Reply
#8

Quote:
Originally Posted by Jefff
Посмотреть сообщение
Can you show a valid command from your gamemode?
here:

Код:
CMD:aa(playerid,params[])
{
	SetPlayerPos(playerid, 404.7529,2439.8262,16.5000);
	SendClientMessage(playerid,COLOR_YELLOW,"Welcome to Abandand Airport.");
	GameTextForPlayer(playerid,"~w~Abandand Airport",3000,4);
}
Reply
#9

Thats the problem, you need add return 1; at the end of command because in this case CallLocalFunction from zcmd returns 0 so 'success' is always false

pawn Код:
CMD:aa(playerid,params[])
{
    SetPlayerPos(playerid, 404.7529,2439.8262,16.5000);
    SendClientMessage(playerid,COLOR_YELLOW,"Welcome to Abandand Airport.");
    GameTextForPlayer(playerid,"~w~Abandand Airport",3000,4);
    return 1;
}
Reply
#10

alright thanks
EDIT: will reputate when i can
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)