SA-MP Forums Archive
Command Message - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Command Message (/showthread.php?tid=254939)



Command Message - The_$ - 13.05.2011

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



Re: Command Message - MadeMan - 13.05.2011

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


Re: Command Message - Famalamalam - 13.05.2011

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



Re: Command Message - MyLife - 13.05.2011

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

}



Re: Command Message - Jeffry - 13.05.2011

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.


Re: Command Message - Famalamalam - 13.05.2011

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?


Re: Command Message - Ozz - 13.05.2011

Return 2; end.


Re: Command Message - Jeffry - 13.05.2011

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.


Re: Command Message - Famalamalam - 13.05.2011

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



AW: Command Message - The_$ - 15.05.2011

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