SA-MP Forums Archive
OnPlayerCommandPerformed - 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: OnPlayerCommandPerformed (/showthread.php?tid=386161)



OnPlayerCommandPerformed - PaulDinam - 19.10.2012

I added check if the player is muted but it sends the message and still shows the command action.

Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
	if(PlayerInfo[playerid][pMuted] == 1)
	{
		SCM(playerid, COLOR_RED, "You cannot speak, you have been silenced");
		return 0;
	}
    if(!success)
    {
        new string[256];
        format(string, sizeof(string), "Error: {FFFFFF}The command '%s' was not recognised, please type /help.", cmdtext);
        SCM(playerid,COLOR_RED, string);
    }
    return 1;
}



Re: OnPlayerCommandPerformed - Roel - 19.10.2012

Change
pawn Код:
SCM(playerid,COLOR_RED, string);
with
pawn Код:
return SCM(playerid,COLOR_RED, string), 0;



Re: OnPlayerCommandPerformed - PaulDinam - 19.10.2012

still now worst



Re: OnPlayerCommandPerformed - PaulDinam - 19.10.2012

k i changed the 0 to 1


Re: OnPlayerCommandPerformed - Roel - 19.10.2012

Ok, go to your OnPlayerCommandTextpublic and return 0; there.
And edit the script I post before to your old script.


Re: OnPlayerCommandPerformed - Djole1337 - 19.10.2012

Use OnPlayerCommandReceived instead!
Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
	if(PlayerInfo[playerid][pMuted] == 1)
	{
		SCM(playerid, COLOR_RED, "You cannot speak, you have been silenced");
		return 0;
	}
	return 1;
}



Re: OnPlayerCommandPerformed - Roel - 19.10.2012

Lol yea i readed the post wrong, sorry.
use Mr_DjolE solution.


Re: OnPlayerCommandPerformed - PaulDinam - 19.10.2012

thank you bro!


Re: OnPlayerCommandPerformed - Djole1337 - 19.10.2012

Quote:
Originally Posted by PaulDinam
Посмотреть сообщение
thank you bro!
No problem.