Use restriccions in Pawn.CMD -
Romero837 - 07.09.2018
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;
}
}
Re: Use restriccions in Pawn.CMD -
iHollyZinhO - 07.09.2018
You have to return 0:
PHP код:
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 0;
}
return 1;
}
Re: Use restriccions in Pawn.CMD -
Romero837 - 07.09.2018
I want to do is that the commands do not work, except "/ salirevento" which is exclusive to get out of it.
Re: Use restriccions in Pawn.CMD -
iHollyZinhO - 07.09.2018
Try to use this condition:
PHP код:
if(CmdBloq5[playerid] == 1 && strcmp(cmd, "salirevento"))
I'm not sure about the parameter
cmd, because I don't know if '/' is in this string.
Re: Use restriccions in Pawn.CMD -
Romero837 - 07.09.2018
Actually i use the command processor PAWN.CMD, i need do it with pawn.cmd.
Re: Use restriccions in Pawn.CMD -
Romero837 - 07.09.2018
My commands all are in pawn.cmd, i need use that
Re: Use restriccions in Pawn.CMD -
Undef1ned - 08.09.2018
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".
Re: Use restriccions in Pawn.CMD -
Romero837 - 09.09.2018
Not working