19.02.2012, 14:15
How i can make two commands.First command to diable all commands of the server
The second command to enable to can use all of commands again
The second command to enable to can use all of commands again
new CMDS;
cmd(commandson, playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You cannot use this command");
if(CMDS == 0)
{
CMDS = 1;
SendClientMessageToAll(-1, "All commands are disabled");
}
else
{
CMDS = 0;
SendClientMessageToAll(-1, "All commands are enabled");
}
return 1;
}
if(CMDS == 0) return SendClientMessage(playerid, -1, "Commands are disabled");
new bool:CommandsOff;
if(strcmp(cmd, "/makeadmin", true) == 0)
{
if(CommandsOff == true) return SendClientMessage(playerid,-1,"Commands Are Disabled By An Administrator);
} else {
everything else..
new bool:BlockCommands;
if( !strcmp( cmdtext, "/blockcommands", true ) )
{
BlockCommands = true;
SendClientMessage( playerid, -1, "You have blocked commands to all players." );
SendClientMessage( playerid, -1, "Use {C0C0C0}/unblockcommands {FFFFFF}to unblock them." );
return 1;
}
if( !strcmp( cmdtext, "/unblockcommands", true ) )
{
BlockCommands = false;
SendClientMessage( playerid, -1, "You have unblocked commands to all players." );
SendClientMessage( playerid, -1, "Use {C0C0C0}/blockcommands {FFFFFF}to block them." );
return 1;
}
if( BlockCommands && !IsPlayerAdmin( playerid ) ) return SendClientMessage( playerid, -1, "You can't use commands because an Admin disabled them." );
Using Bools?
there is an example below. [CODE] new bool:CommandsOff; if(strcmp(cmd, "/makeadmin", true) == 0) { if(CommandsOff == true) return SendClientMessage(playerid,-1,"Commands Are Disabled By An Administrator); } else { everything else..[/PAWN] Correct me if thats not what you said ![]() |
if( BlockCommands && (PlayerInfo[playerid][pAdmin] >= 3) return SendClientMessage( playerid, -1, "You can't use commands because an Admin disabled them." );
Ok, strcmp so...
|