13.05.2016, 21:55
What to you mean by reviving dead player?
I made this command to heal a chosen player if he have less than 10 HP.
Notes:
I made this command to heal a chosen player if he have less than 10 HP.
Код:
CMD:revive(playerid, params[]) { new ChosenPlayerID, Float:health; if (!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "Only admins can use this command."); // This is your admin check if (sscanf(params, "u", ChosenPlayerID)) SendClientMessage(playerid, -1, "Usage: /revive <playerid>"); if (ChosenPlayerID == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "That player is not connected"); GetPlayerHealth(ChosenPlayerID, health); if (health > 10.0) return SendClientMessage(playerid, -1, "This player has enough health."); SetPlayerHealth(ChosenPlayerID, 100.0); // Heal the player SendClientMessage(ChosenPlayerID, -1, "You was revived by admin."); // Inform the player that he was revived return 1; }
- I used the IsPlayerAdmin (RCON admin) check, if you use other admin check change it.
- If the player is dead or was killed he can't be revived but he will respawn as usually.
- This command is not tested.