Command for enable/disable -
Join7 - 30.08.2011
I need a command to enable/disable other commands, such as the /heal command can be enable/disable by administrator
Re: Command for enable/disable -
PrawkC - 30.08.2011
new bool:heal;
in your heal command check if the variable is false, if so return.
then make a command that toggles heal between true and false
Re: Command for enable/disable -
Join7 - 30.08.2011
Can you do an example command
Re: Command for enable/disable -
sasuga - 30.08.2011
pawn Код:
new bool:eheal;
CMD:disableheal(playerid,params[])
{
if(eheal = true)
{
eheal = false;
}
else if(eheal = false)
{
eheal = true;
}
return 1;
}
CMD:heal(playerid,params[])
{
if(eheal=true){
SetPlayerHealth(playerid,100);}
else if(eheal=false) return SendClientMessage(playerid,red,"this command is disabled");
return 1;
}
Re: Command for enable/disable -
Improvement™ - 30.08.2011
This is a fixed version of the command of sasuga.
pawn Код:
CMD:heal(playerid,params[])
{
if(eheal)
{
SetPlayerHealth(playerid,100);
eheal = false;
}
else if(!eheal)
{
SendClientMessage(playerid, 0xFFFFFFAA, "this command is disabled");
eheal = true;
}
return 1;
}
I did all this on BlackBerry mobile, so sorry if I was a bit late.
Re: Command for enable/disable -
Join7 - 31.08.2011
Код:
new bool:eheal;
CMD:disableheal(playerid,params[])
{
if(eheal = true)
{
eheal = false;
//Here I want to write "{GetPlayerColor}%s administrator disable command /heal"
}
else if(eheal = false)
{
eheal = true;
//Here I want to write "{GetPlayerColor}%s administrator enable command /heal"
}
return 1;
}
CMD:heal(playerid,params[])
{
if(eheal)
{
SetPlayerHealth(playerid,100);
eheal = false;
}
else if(!eheal)
{
SendClientMessage(playerid, 0xFFFFFFAA, "This command is disabled");
eheal = true;
}
return 1;
}
But can you write that Nick and the administrator who puts it disable
Re: Command for enable/disable -
=WoR=Varth - 31.08.2011
pawn Код:
new bool:eheal;
CMD:disableheal(playerid,params[])
{
if(!IsPlayerAdmin(playerid)) return 1;//Rcon admin
new string[128];
if(eheal = true)
{
eheal = false;
GetPlayerName(playerid,string,sizeof(string));
format(string,sizeof(string),"%s administrator disable command /heal",string);
}
else if(eheal = false)
{
eheal = true;
GetPlayerName(playerid,string,sizeof(string));
format(string,sizeof(string),"%s administrator enable command /heal",string);
}
SendClientMessageToAll(color,string);
return 1;
}
Re: Command for enable/disable -
Join7 - 31.08.2011
Can "%s" GetPlayerColor him and shows him with his color
{GetPlayerColor}%s
Re: Command for enable/disable -
=WoR=Varth - 31.08.2011
pawn Код:
CMD:disableheal(playerid,params[])
{
if(!IsPlayerAdmin(playerid)) return 1;//Rcon admin
new string[128],name[24];
if(eheal = true)
{
eheal = false;
GetPlayerName(playerid,name,sizeof(name));
format(string,sizeof(string),"%x",GetPlayerColor(playerid));
strmid(string,string,2,7)
format(string,sizeof(string),"{%s}%s{FFFFFF} administrator disable command /heal",string,name);
}
else if(eheal = false)
{
eheal = true;
GetPlayerName(playerid,name,sizeof(name));
format(string,sizeof(string),"%x",GetPlayerColor(playerid));
strmid(string,string,2,7)
format(string,sizeof(string),"{%s}%s{FFFFFF} administrator enable command /heal",string,name);
}
SendClientMessageToAll(color,string);
return 1;
}
EDITED, try new code before posting reply.
EDITED again, forgot to place white color.
Re: Command for enable/disable -
Join7 - 31.08.2011
I fixed the errors, but:
D:\Server\gamemodes\drift.pwn(9243) : warning 211: possibly unintended assignment
D:\Server\gamemodes\drift.pwn(9251) : warning 211: possibly unintended assignment
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
2 Warnings.
Line 9243: if(eheal = true)
Line 9251: else if(eheal = false)