Problem with OnPlayerCommandText
#1

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.
Reply
#2

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

}
return 1;;
}

try this ?
Reply
#3

Not work.
Reply
#4

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?
Reply
#5

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.
Reply
#6

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?
Reply
#7

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.
Reply
#8

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


Forum Jump:


Users browsing this thread: 1 Guest(s)