Use restriccions in Pawn.CMD
#1

How could I put restrictions on commands, that is, in an event system, if I enter the event I can not use the command, I already have the variable bool. But if I use / salirevento I'll come out of it. I'm using Pawn.CMD and I really did not find help.

I tried to use this code in OnPlayerCommandReceive but not works, and in OnPlayerCommandText works but the excepcion not works with /salirevento.


Код:
public OnPlayerCommandReceived(playerid, cmd[], params[], flags)  //Not works 
{
    if(CmdBloq5[playerid] == 1)
    {
	    PlayerPlaySound(playerid,1140,0.0,0.0,0.0);
	    GameTextForPlayer(playerid,"~n~~p~Estas en un ~r~Evento ~n~~w~usa /Salirevento",3000,3);
	    return 1;
	}
}

public OnPlayerCommandText(playerid, cmdtext[])  //Not works
{
    if(CmdBloq5[playerid] == 1)
    {
	    PlayerPlaySound(playerid,1140,0.0,0.0,0.0);
	    GameTextForPlayer(playerid,"~n~~p~Estas en un ~r~Evento ~n~~w~usa /Salirevento",3000,3);
	    return 1;
    }
}
Reply
#2

You have to return 0:

PHP код:
public OnPlayerCommandReceived(playeridcmd[], params[], flags)  //Not works 
{
    if(
CmdBloq5[playerid] == 1)
    {
    
PlayerPlaySound(playerid,1140,0.0,0.0,0.0);
    
GameTextForPlayer(playerid,"~n~~p~Estas en un ~r~Evento ~n~~w~usa /Salirevento",3000,3);
        return 
0;
    }
    return 
1;

Reply
#3

I want to do is that the commands do not work, except "/ salirevento" which is exclusive to get out of it.
Reply
#4

Try to use this condition:
PHP код:
if(CmdBloq5[playerid] == && strcmp(cmd"salirevento")) 
I'm not sure about the parameter cmd, because I don't know if '/' is in this string.
Reply
#5

Actually i use the command processor PAWN.CMD, i need do it with pawn.cmd.
Reply
#6

My commands all are in pawn.cmd, i need use that
Reply
#7

public OnPlayerCommandReceived(playerid, cmd[], params[], flags)
{
if(CmdBloq5[playerid] == 1 && !(strfind(cmd, "salirevento", true) != -1))
{
PlayerPlaySound(playerid, 1140,0.0,0.0,0.0);
GameTextForPlayer(playerid, "~n~~p~Estas en un ~r~Evento~n~~w~ usa /Salirevento", 3000,3);
return 0;
}
return 1;
}

By the way, as ****** says, you can use "y_command".
Reply
#8

Not working
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)