CMD:healall(playerid, params[]) { new str[128]; if(PlayerInfo[playerid][Admin] >= 1) { foreach(Player, i) { if(IsPlayerConnected(i) && (i != playerid) && (PlayerInfo[playerid][Admin] < PlayerInfo[i][Admin])) { SetPlayerHealth(i, 100.0); } } GameTextForAll("~g~Healed by ~w~Admin!", 3000, 3); format(str, sizeof(str), "- AS - %s(%d) has healed all players!", GetName(playerid), playerid); SendClientMessageToAll(COLOR_BLUE, str); SendClientMessage(playerid, COLOR_LIME, "You healed all players!"); } return 1; }
CMD:healall(playerid, params[]) //Create a command (you need ZCMD/y_commands to do this thing)
{
for(new i = 0; i < GetMaxPlayers(); i++) //Looping to all players
{
if(IsPlayerConnected(i)) //Check if player are connected
{
SetPlayerHealth(i, 100); //Set player health to 100
}
}
return 1;
}
This ? :
Код:
CMD:healall(playerid, params[]) { new str[128]; if(PlayerInfo[playerid][Admin] >= 1) { foreach(Player, i) { if(IsPlayerConnected(i) && (i != playerid) && (PlayerInfo[playerid][Admin] < PlayerInfo[i][Admin])) { SetPlayerHealth(i, 100.0); } } GameTextForAll("~g~Healed by ~w~Admin!", 3000, 3); format(str, sizeof(str), "- AS - %s(%d) has healed all players!", GetName(playerid), playerid); SendClientMessageToAll(COLOR_BLUE, str); SendClientMessage(playerid, COLOR_LIME, "You healed all players!"); } return 1; } |
CMD:healall(playerid, params[]) { if(IsPlayerAdmin(playerid)) { SendClientMessageToAll(COLOR_GREEN, "All players healed by Admin"); for(new i = 0; i < MAX_PLAYERS; i++) { SetPlayerHealth(i, 100.0); } } else SendClientMessage(playerid,COLOR_RED,"You are not Admin!"); return true; }
Create a loop, check if player is connected (or use foreach) and set his health to 100.
|
for(new i = 0; i < MAX_PLAYERS; i++)
for(new i = 0; i < MAX_PLAYERS; i++)
SetPlayerHealth( i , 100);
for(new i = 0; i < MAX_VEHICLES; i++)
i dont think a newbee (as he claimed to be) knows what a loop or even foreach is but i understand that you are trying to make him learn.
|
This is not script request. This is Scripting Help. Also, if you code it for him, he is probably not going to learn and when he will need something again, he will post here and wait for someone to code it for him.
In case you want someone to code it for you, then use the right section. |