Block commands throughout the server -
caribe88 - 12.03.2012
Hello,
I have a little problem with a block command system, I searched for it but I couldn't find an answer.
So I decided to ask.
The problem is the following:
In my gamemode I have restricted players of using any kind of commands such as teleports, weapons and other things while they are in stunt or dm with " new BlockCMD[MAX_PLAYERS] = 0; ".
Everything works well when the commands are in the gamemode but once they are in a filterscript I can't block them.
So my question is, is there a way to block the commands globally once a players enters a stunt or dm zone even dough the commands are in a filterscript?
Here is some code so you guys understand what I'm talking about.
Code:
new BlockCMD[MAX_PLAYERS] = 0;
CMD:red(playerid,params[])
{
if(BlockCMD[playerid] == 1)return SendClientMessage(playerid, X11_RED, "Command Block Activated to exit type /exit");
SetPlayerColor(playerid, X11_RED);
return 1;
}
PD: I tried putting the " new BlockCMD[MAX_PLAYERS] = 0; " in a include but that didn't workout.
I hope you guys could help me.
Thanks
Caribe88
Re: Block commands throughout the server - T0pAz - 12.03.2012
Yes,
using player variables.
Re: Block commands throughout the server -
caribe88 - 12.03.2012
Thanks for the answer I've never used them before could you explain a little how they work?
Edit: I looked at the examples but don't see how to use them jet i will search if there is a tutorial or something on how to use them
Re: Block commands throughout the server -
caribe88 - 12.03.2012
Sorry for double post but i could not find any example of how to use player variables.
Re: Block commands throughout the server -
[ABK]Antonio - 12.03.2012
You could try this out
pawn Code:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
if(IsInEvent[playerid] && strfind(cmdtext, "LeaveEvent", true) == -1)
{
SendClientMessage(playerid, 0xCC0000AA, "You can't use commands in an event!")
return 0;
}
return 1;
}
Also, PVars are basically the same as new IsInEvent[MAX_PLAYERS] = 0;
pawn Code:
CMD:vartest(playerid)
{
SetPVarInt(playerid, "SomeVar", 0);
printf("Somevar: %i", GetPVarInt(playerid, "SomeVar"));
return 1;
}
That's an example