SA-MP Forums Archive
y_commands (OnPlayerCommandPerformed) problem. - 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)
+--- Thread: y_commands (OnPlayerCommandPerformed) problem. (/showthread.php?tid=329570)



y_commands (OnPlayerCommandPerformed) problem. - KreeDz - 29.03.2012

Alright so, i`m using y_commands for the gamemode i`m working on. There is one problem, after i updated to the latest YSI with the new y_commands.inc, OnCommandPerformed doesn't work as supposed. It practically returns the error message to any command. All the commands I have return "1", so i`m not sure what is it caused by.

Here is how the callback looks like,
Код:
public OnPlayerCommandPerformed(playerid,cmdtext[],success)
{
    if(!success) return SendClientMessage(playerid,white,"Error message.");
    return 1;
}
Any idea?
Thanks.


Re: y_commands (OnPlayerCommandPerformed) problem. - Ironboy - 29.03.2012

Try this
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(success == 0)
    {
        format(string, sizeof(string), "Error message.");
        SendClientMessage(playerid, white, string);
        return 1;
    }
    return 1;}



Re: y_commands (OnPlayerCommandPerformed) problem. - KreeDz - 29.03.2012

Nope, still the same problem.
But thanks for your help!


Re: y_commands (OnPlayerCommandPerformed) problem. - KreeDz - 02.04.2012

Bump... anyone? At least, i`m pretty sure that the problem is from the actual include. Something makes the OnPlayerCommandPerformed think that the commands do not exist even tho they do.


Re: y_commands (OnPlayerCommandPerformed) problem. - KreeDz - 09.04.2012

So... no one ever experienced this problem?
Bump.


Re: y_commands (OnPlayerCommandPerformed) problem. - Ash. - 09.04.2012

You'll want to wait for ****** to see this. He knows the system inside out and will be able to help the most. I'm unsure what could cause this and I've never ever had that issue before.

Just for debugging purposes, could you produce an example (perhaps with screenshots and an example command).


Re: y_commands (OnPlayerCommandPerformed) problem. - KreeDz - 15.04.2012

Sure,
OnPlayerCommandPerformed:
Код:
public OnPlayerCommandPerformed(playerid,cmdtext[],success)
{
	if(!success) SendClientMessage(playerid,white,"Error message.");
	return 1;
}
Command:
Код:
YCMD:test(playerid,params[],help)
{
	#pragma unused params
	if(help) return SendClientMessage(playerid,white,"Blahblah !");
	SendClientMessage(playerid,white,"Test message. You will receive some dosh !");
	GivePlayerMoney(playerid,400);
	return 1;
}
Screenshot:


Here you go!


Re: y_commands (OnPlayerCommandPerformed) problem. - KreeDz - 17.04.2012

Well, seems like there's no point on bumping this anymore. I'll just opt out for this feature and wait silently until it's possibly gonna be fixed. Thanks for the above members who tried to help!


Re: y_commands (OnPlayerCommandPerformed) problem. - deffo - 03.01.2013

See my tutorial, just copy paste my else condition in your script inside OnPlayerCommandPerformed calleback. I have done it with OnPlayerCommandText, but its same thing with the other callback too.

You have to loop it, see my tutorial in my signature.