SA-MP Forums Archive
Problem with OnPlayerCommandText - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Server (https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: Problem with OnPlayerCommandText (/showthread.php?tid=337186)



Problem with OnPlayerCommandText - falcko - 25.04.2012

Hi,
I have a problem with my function OnPlayerCommandText.

This is my function:
Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/test", cmdtext, true, 10) == 0)
	{
		SendClientMessage(playerid, COLOR_WHITE, "Test");
		return 1;
	}
	return 0;
}
When I go ingame, I write the command and I receive a message : SERVER: Unknown command.

I changed return 0; by return 1; or return SendClientMessage... but I have the same message.

Thank you in advance.

Sorry for my english, i'm french.

EDIT: With a filtescript, it works.


Re: Problem with OnPlayerCommandText - ikbenremco - 25.04.2012

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/test", cmdtext, true, 10) == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "Test");

}
return 1;;
}

try this ?


Re : Problem with OnPlayerCommandText - falcko - 25.04.2012

Not work.


Re: Problem with OnPlayerCommandText - Aira - 25.04.2012

PHP Code:
public OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp(cmd"/test"true) == 0)
    {
    
SendClientMessage(playeridCOLOR_WHITE"Testing Command");
    return 
1;
    }
    return 
1;

It will Work ( Obviously ) or, tell me..
Is this Command in a FIlterscript or GameMode?
If GameMode, what Other FS is loaded?

OR what Command Processor do you use?


Re : Problem with OnPlayerCommandText - falcko - 25.04.2012

Not work. (always SERVER: Unknown command)

This command is in gamemode.
No FS was loaded. (just for a test when i have loaded and it works)

I don't use command processor.


Re: Problem with OnPlayerCommandText - Aira - 25.04.2012

1 - UnLoad all of your Filterscripts
2 - Download the Latest SAMP Server Files ( The pawno shit )
3 - Make sure you only have ONE "public OnPlayerCommandText"
Or would you mind putting your code to pastebin.com and PMing the Link to me?


Re : Problem with OnPlayerCommandText - falcko - 25.04.2012

1 - I don't have filterscripts.
2 - Already done.
3 - Yes I have only one OnPlayerCommandText

I have give the link to you by PM.
Thanks.


Re: Problem with OnPlayerCommandText - Mark™ - 25.04.2012

pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/test", cmdtext, true, 5) == 0) // string value for /test command will be 5 rather than 10
    {
        SendClientMessage(playerid, COLOR_WHITE, "Test");
        return 1;
    }
    return 0;
}