Command Message
#1

Hello SA:MP Community, I have a question about one thing
What is wrong here?? I don't get this Message Ingame...
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	new Text[100];
	format(Text, sizeof Text,"[Error] Command /%s don't exist!", cmdtext);
	SendClientMessage(playerid, COLOR_ERROR, Text);
        return 1;
}
Reply
#2

If you use any filterscripts then use return 0; at the end of OnPlayerCommandText in them.
Reply
#3

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
        return SendClientMessage(playerid, COLOR_ERROR, "[Error] Command does not exist!");
}
Reply
#4

Try...
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new Text[100];
    format(Text, sizeof Text,"[Error] Command %s don't exist!", cmdtext);
    return SendClientMessage(playerid, COLOR_ERROR, Text);

}
Reply
#5

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new Text[100];
    format(Text, sizeof Text,"[Error] Command /%s don't exist!", cmdtext);
    /*Your commands here
    here...
    here...
    blah blah*/


    return SendClientMessage(playerid, COLOR_ERROR, Text);
}
Should work then.

EDIT: MyLife was a bit faster.
Reply
#6

Quote:
Originally Posted by Jeffry
Посмотреть сообщение
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new Text[100];
    format(Text, sizeof Text,"[Error] Command /%s don't exist!", cmdtext);
    /*Your commands here
    here...
    here...
    blah blah*/


    return SendClientMessage(playerid, COLOR_ERROR, Text);
}
Should work then.

EDIT: MyLife was a bit faster.
Won't that just format the string every time, regardless on whether or not it's wrong?
Reply
#7

Return 2; end.
Reply
#8

Quote:
Originally Posted by Famalamalam
Посмотреть сообщение
Won't that just format the string every time, regardless on whether or not it's wrong?
Not if you return at every successful command.
Reply
#9

Quote:
Originally Posted by Jeffry
Посмотреть сообщение
Not if you return at every successful command.
It will ... the string won't be called/displayed but it will be formatted every time a player types a command (since every time a player types a command it will call OnPlayerCommandText).

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])//As soon as this is called ...
{
    new Text[100]; // This..
    format(Text, sizeof Text,"[Error] Command /%s don't exist!", cmdtext); // .. and this will be processed, now matter whether the command exists or not.
    /*Your commands here
    here...
    here...
    blah blah*/


    return SendClientMessage(playerid, COLOR_ERROR, Text);// This will be called if it doesn't.
}
Reply
#10

Yes ******^^ I'm using ZCMD
Код:
public OnPlayerCommandPerformed( playerid, cmdtext[], success )
{
	if(success)
	{
		new Text[100];
		format(Text, sizeof Text,"[Error] %s don't exist!", cmdtext);
		return SendClientMessage(playerid, COLOR_ERROR, Text);
	}
	return 0;
}
It don't work i don't know why^^. pls help me
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)