HELP PLEASE
#1

I need the /revive command which allow admins to revive dead players
Reply
#2

Hello.
« Would help if you handed out some code to aid in making this command, but you know, Scripting Help isn't really for making you a command...
But if someone was going to be kind, then they'd need some basis to go on, rather than nothing and guess everything. » - Sew_Suni

Yes, you need to post your code or something before asking help.
This forum part isn't "Request script/command" but "Scripting Help".
Reply
#3

What to you mean by reviving dead player?

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;
}
Notes:
  • 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.
Reply
#4

I dont know what u want exactly
I use this to respawn someone
PHP код:
    //=========================================================================================================
if(strcmp(cmd"/respawn"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playeridCOLOR_GRAD2"USAGE: /respawn [playerid/PartOfName]");
                return 
1;
            }
            new 
playa;
            
playa ReturnUser(tmp);
            if (
PlayerInfo[playerid][pAdmin] >= 1)
            {
                if(
IsPlayerConnected(playa))
                {
                    if(
playa != INVALID_PLAYER_ID)
                    {
                        
//if(SpawnChange[playerid])
                        
{
                            
GetPlayerName(playagiveplayersizeof(giveplayer));
                            
ResetPlayerTofang(playa);
                            
SetSpawnKol(playa);
                            
SpawnPlayer(playa);
                            
GetPlayerName(playeridsendernamesizeof(sendername));
                            
format(stringsizeof(string), "* You have respawned %s"giveplayer);
                            
SendClientMessage(playeridCOLOR_LIGHTREDstring);
                            
format(stringsizeof(string), "* You have been respawned by Admin %s"sendername);
                            
SendClientMessage(playaCOLOR_LIGHTREDstring);
                            
format(string256"AdmWarning: {FFFFFF}%s has respawned the {FFFFFF}%s"sendernamegiveplayer);
                            
ABroadCast(COLOR_YELLOW,string,1);
                            return 
1;
                        }
                    }
                }
            }
            else
            {
                
SendClientMessage(playeridCOLOR_GREEN"Error: Your Admin level isn't high enough to use this command!");
            }
        }
        return 
1;
    }
//---------------------- 
Reply
#5

Quote:
Originally Posted by BloodyDexter
Посмотреть сообщение
I dont know what u want exactly
I use this to respawn someone
...
Was that needed? You've defined some things that he probably haven't defined. This code just won't work for him.


Anyways if you wanted a respawn command, here's a better version:
Код:
CMD:respawn(playerid, params[])
{
	new ChosenPlayerID;
	if (!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "Only admins can use this command.");
	if (sscanf(params, "u", ChosenPlayerID)) SendClientMessage(playerid, -1, "Usage: /respawn <playerid>");
	if (ChosenPlayerID == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "That player is not connected");
	SpawnPlayer(ChosenPlayerID);
	SendClientMessage(SpawnPlayer, -1, "You have been respawned by admin.");
	return 1;
}
Reply
#6

Quote:
Originally Posted by Darkwood17
Посмотреть сообщение
What to you mean by reviving dead player?

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;
}
Notes:
  • 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.
You command will works but you can glitch him. Set your HP between 256 - 265 and your command will work too. Why? « Even though the health can be set to near infinite values on the server side, the individual clients will only report values up to 255. Anything higher will wrap around; 256 becomes 0, 257 becomes 1, etc. » (Source : WIKI)

I don't understand what DAREL wants too.
Reply
#7

Quote:
Originally Posted by Darkwood17
Посмотреть сообщение
Was that needed? You've defined some things that he probably haven't defined. This code just won't work for him.


Anyways if you wanted a respawn command, here's a better version:
Код:
CMD:respawn(playerid, params[])
{
	new ChosenPlayerID;
	if (!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "Only admins can use this command.");
	if (sscanf(params, "u", ChosenPlayerID)) SendClientMessage(playerid, -1, "Usage: /respawn <playerid>");
	if (ChosenPlayerID == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "That player is not connected");
	SpawnPlayer(ChosenPlayerID);
	SendClientMessage(SpawnPlayer, -1, "You have been respawned by admin.");
	SendClientMessage(SpawnPlayer, -1, "You respawned the chosen player.");
	return 1;
}
so I am sorry . I am new and I just see it on my pc
Reply
#8

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
You command will works but you can glitch him. Set your HP between 256 - 265 and your command will work too. Why? « Even though the health can be set to near infinite values on the server side, the individual clients will only report values up to 255. Anything higher will wrap around; 256 becomes 0, 257 becomes 1, etc. » (Source : WIKI)

I don't understand what DAREL wants too.
I've already seen this but if he don't use values higher than 100, he don't have worry about that.
I gave him two different commands: one for healing and one for respawning.

Quote:
Originally Posted by BloodyDexter
Посмотреть сообщение
so I am sorry . I am new and I just see it on my pc
No problem. It's not bad to give examples, but you must be sure that the code will work for others too.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)