Help with command - 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: Help with command (
/showthread.php?tid=319549)
Help with command -
boyan96 - 19.02.2012
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
Re: Help with command -
aRoach - 19.02.2012
What command Processor you use ?
Re: Help with command -
boyan96 - 19.02.2012
if(strcmp(cmd, "/makeadmin", true) == 0)
Re: Help with command -
JhnzRep - 19.02.2012
I recommend you change to ZCMD, as this is much better and less laggy.
Put this on top.
Here is the command
pawn Код:
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;
}
And on top of every command do this.
pawn Код:
if(CMDS == 0) return SendClientMessage(playerid, -1, "Commands are disabled");
Don't want to use ZCMD? Then I guess you have to turn this into strcmp. :P
Re: Help with command -
Littlehelper - 19.02.2012
Using Bools?
there is an example below.
pawn Код:
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..
Correct me if thats not what you said
p
Re: Help with command -
aRoach - 19.02.2012
Ok, strcmp so...
- At the top of your script, out of any Callback:
- Block Command:
pawn Код:
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;
}
- Unblock Command:
pawn Код:
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;
}
- Put at the top of the OnPlayerCommandText Callback:
pawn Код:
if( BlockCommands && !IsPlayerAdmin( playerid ) ) return SendClientMessage( playerid, -1, "You can't use commands because an Admin disabled them." );
PS: You must change IsPlayerAdmin with your Admin Variable and add to the commands too...
Re: Help with command -
JhnzRep - 19.02.2012
Quote:
Originally Posted by Littlehelper[MDZ]
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 p
|
He wanted a command where you disable the commands, not to make an admin.
Re: Help with command -
boyan96 - 19.02.2012
aRoach
i have this error
C:\Users\User\Desktop\servera last !!!!\servera last !!!!\gamemodes\1.pwn(6344) : error 001: expected token: ")", but found "return"
Line error
PHP код:
if( BlockCommands && (PlayerInfo[playerid][pAdmin] >= 3) return SendClientMessage( playerid, -1, "You can't use commands because an Admin disabled them." );
Re: Help with command -
Littlehelper - 19.02.2012
Quote:
Originally Posted by JhnzRep
He wanted a command where you disable the commands, not to make an admin.
|
It Was An Example......
Read his second post.....
Re: Help with command -
boyan96 - 21.02.2012
Quote:
Originally Posted by aRoach
Ok, strcmp so... - At the top of your script, out of any Callback:
- Block Command:
pawn Код:
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; }
- Unblock Command:
pawn Код:
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; }
- Put at the top of the OnPlayerCommandText Callback:
pawn Код:
if( BlockCommands && !IsPlayerAdmin( playerid ) ) return SendClientMessage( playerid, -1, "You can't use commands because an Admin disabled them." );
PS: You must change IsPlayerAdmin with your Admin Variable and add to the commands too...
|
yes this it work's but when i disable the commands i can't unblock them to can work again it's giving me this "You can't use commands because an Admin disabled them." when i write /unblockcommands how we can fix it