Y_Commands - Problem
#1

Hello, I have a problem using Y_Commands with my commands. If I use any command, the OnPlayerCommandText returns "Unknown Command", but the command works perfectly.

pawn Код:
YCMD:help(playerid, params[], pHELPS)
{
    // player help

    return 1;
}
and

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    SendPlayerMessage(playerid, 0xFF0000FF, "Ops! O comando \"%s\" nгo existe.", cmdtext);
    return 1;
}
If I return 0 in callback, returns "Ops! O comando \"%s\" nгo existe." and "SERVER: Unknown Command.". But if I return 1, just return "Ops! O comando \"%s\" nгo existe." even when the command exists.

I'd like the message to be displayed only when the command doesn't exist.


Thanks and sorry from my bad English.
Reply
#2

Make sure that all of your filterscripts and your gamemodes are using Y-Command, otherwise it will mess up. Example: If you are using strcmp in your gamemode and some of your filterscripts, Y-Command will not function properly in a separate script.
Reply
#3

It doesn't use that. It uses OnPlayerCommandPerformed
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(!succes) return SendPlayerMessage(playerid, 0xFF0000FF, "Ops! O comando \"%s\" nгo existe.", cmdtext);// I don't know if this function of yours is working or not. But I prefer format and sendclientmessage
    return 1;
}
Be sure you are using this version: http://pastebin.com/L95eNJPW
Reply
#4

Quote:
Originally Posted by suhrab_mujeeb
Посмотреть сообщение
It doesn't use that. It uses OnPlayerCommandPerformed
True... I probably should have read the post fully before I posted... xD
Reply
#5

hahaha, then I need to use OnPlayerCommandPerformed instead of OnPlaterCommandText and replace the entire contents of the callback?
Reply
#6

pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(!success) return SendPlayerMessage(playerid, 0xFF0000FF, "Ops! O comando \"%s\" nгo existe.", cmdtext);// I don't know if this function of yours is working or not. But I prefer format and sendclientmessage
    return 1;
}
This is the simplest way you do it. If you aren't using OnPlayerCommandText for anything else just delete it. If you are using it keep it. It won't have any effects, afaik. As long as you use this version of y_commands.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)