AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   revive any player saying /revive (https://forums.alliedmods.net/showthread.php?t=93994)

micke1101 06-05-2009 09:07

revive any player saying /revive
 
Hey i was just looking though some topics and found a code (cant find it right now X)) anyways im trying to make so anyone that says /revive (if hes dead not if hes alive or spectator) gets revived.

Thanks in advanced:mrgreen:

Atspulgs 06-05-2009 09:42

Re: revive any player saying /revive
 
well you could check for player to be alive like this
Quote:

if(!is_user_alive(id))
then you use command to revive the user that called the comand
(i assume you found that one) :D

zacky 06-05-2009 09:43

Re: revive any player saying /revive
 
Wait i can help you

hleV 06-05-2009 09:45

Re: revive any player saying /revive
 
Is it for CS?
Code:
#include <amxmodx> #include <hamsandwich>   public plugin_init()         register_clcmd("say /revive", "cmdSayRevive");   public cmdSayRevive(iCl)         if (!is_user_alive(iCl))                 ExecuteHamB(Ham_CS_RoundRespawn, iCl);

micke1101 06-05-2009 09:49

Re: revive any player saying /revive
 
Yes thanks hleV
(lol that was a small code XD)

zacky 06-05-2009 09:52

Re: revive any player saying /revive
 
haha, i thought you meant revive another player ^^

Well, if you want to respawn another player use this:
PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say""cmdHookSay");
}

public 
cmdHookSay(id) {
    new 
iArgs[38], iArg1[6], iArg2[33];
    
read_argsiArgs37 );
    
remove_quotesiArgs );
    
    if( 
containi(iArgs"revive") == -&& iArgs[0] != '/' )
        return 
PLUGIN_CONTINUE;
    
    
parseiArgsiArg15iArg232 );
    
    if( 
equali(iArg1"/revive"5) && get_user_flags(id) & ADMIN_CHAT ) {
        new 
iPlayer cmd_targetidiArg2);
            
        if( 
iPlayer ) {
            if (!
is_user_alive(iPlayer) && cs_get_user_team(id) != CS_TEAM_SPECTATOR ) {
                new 
szAdminName[32], szPlayerName[32];
                
                
get_user_name(idszAdminName31);
                
get_user_name(iPlayerszPlayerName31);
                
                
ExecuteHam(Ham_CS_RoundRespawnid);
                
client_print(iPlayerprint_chat"ADMIN %s revived you"szAdminName);
                
client_print(idprint_chat"You revived %s"szPlayerName);
            }
        }
        else if( !
equal(iArg2"") )
            
client_print(idprint_chat"Failed to find player named %s."iArg2);
        else if( 
equal(iArg2"") )
            
client_print(idprint_chat"Usage: /revive <nick>");
    }
    
    return 
PLUGIN_CONTINUE;


Usage:
Say in chat: /revive name

hleV 06-05-2009 09:56

Re: revive any player saying /revive
 
I forgot to check if player is not spectator. Not sure if Ham_CS_RoundRespawn works on spectators though.

zacky 06-05-2009 09:58

Re: revive any player saying /revive
 
Question, why did you use ExecuteHamB and not ExecuteHam?

Atspulgs 06-05-2009 11:53

Re: revive any player saying /revive
 
do you need to check spec? is spec ever considered alive?

hleV 06-05-2009 12:54

Re: revive any player saying /revive
 
Quote:

Originally Posted by Atspulgs (Post 842294)
do you need to check spec? is spec ever considered alive?

In my code you can only respawn, if YOU'RE DEAD. All spectators ARE DEAD. So I wonder if Ham_CS_RoundRespawn allows spectator to respawn.


All times are GMT -4. The time now is 14:02.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.