HealAll 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: HealAll Command (
/showthread.php?tid=482906)
HealAll Command -
MahdiGames - 23.12.2013
Hello, im using admin system and in my server there are Dm places , so when admin use the command healall all the players is got healed , how to heal only the players which exists out of dm only.
Код:
dcmd_healall(playerid,params[])
{
#pragma unused params
if(AccInfo[playerid][Level] >= 2)
{
SendCommandToAdmins(playerid,"HealAll");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && (i != playerid) && i != ServerInfo[MaxAdminLevel])
{
PlayerPlaySound(i,1057,0.0,0.0,0.0);
SetPlayerHealth(i,100.0);
}
}
new string[128];
format(string,sizeof(string),"{00FFFF}Administrator \"%s\" has healed all players , Except In DM Places !", pName(playerid));
return SendClientMessageToAll(blue, string);
}
else return ErrorMessages(playerid, 6);
}
Re: HealAll Command - Patrick - 23.12.2013
Here's a quick example. You could change the
IsInDM to the variable you have in your
script
pawn Код:
dcmd_healall(playerid,params[])
{
#pragma unused params
if(AccInfo[playerid][Level] < 2) return ErrorMessages(playerid, 6);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i) && (i != playerid) && i != ServerInfo[MaxAdminLevel]) continue;
if(IsInDM[i] == 1)
{
// do nothing, returns 0.
return false;
}
else
{
PlayerPlaySound(i, 1057,0.0,0.0,0.0 );
SetPlayerHealth(i, 100.0 );
}
}
new
string[ 128 ] ;
format(string,sizeof(string),"{00FFFF}Administrator \"%s\" has healed all players , Except In DM Places !", pName(playerid));
SendClientMessageToAll(blue, string);
return SendCommandToAdmins(playerid,"HealAll");
}
Re: HealAll Command -
[EnErGyS]KING - 23.12.2013
This in heal code
pawn Код:
if(dm==false)
PlayerPlaySound(i,1057,0.0,0.0,0.0);
SetPlayerHealth(i, 100.0 )//fixed, thanks Konstantinos
}
And when player teleport to dm
or else if he in dm
It's simplest way.
Re: HealAll Command -
Konstantinos - 23.12.2013
I'm not sure about returning false/0. It may show the Unknown command message.
Check if the player is not in DM directly and set the health.
EDIT: And of course checking if IsInDM or dm is true/false (1/0) is incorrect. Each player may or may not be in DM so it needs to be an array.
Re: HealAll Command -
[EnErGyS]KING - 23.12.2013
So you need to check if player is in range of DM zone