Raised This Month: $ Target: $400
 0% 

Edit Revive Plugin (Help Please)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Clouder16
Member
Join Date: Apr 2011
Old 11-07-2014 , 04:57   Edit Revive Plugin (Help Please)
Reply With Quote #1

Hello ! Can someone help me with revive players plugin ?

Standart command is:
amx_revive Nickname hp armor

I need to make that command like
amx_respawn Nickname (Without any hp and armor change) (Just reviving with 100 hp and 0 armor)
And make available to revive only players by nick, not all team, and etc.

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

#define PLUGIN "Ultimate Revive"
#define VERSION "1.1"
#define AUTHOR "anakin_cstrike"

new g_fade;
public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_concmd("amx_revive","revive_cmd",ADMIN_BAN,"- <player/@/@T/@CT> <hp> <armor>");
    
g_fade get_user_msgid("ScreenFade");
}
public 
revive_cmd(id,level,cid)
{
    if(!
cmd_access(id,level,cid,4))
        return 
PLUGIN_HANDLED;
    new 
    
arg[32],arg2[4],arg3[4],
    
name[32],hp,armor;
    
read_argv(1,arg,31);
    
read_argv(2,arg2,3);
    
read_argv(3,arg3,3);
    
get_user_name(id,name,31);
    new 
argc read_argc();
    if(
argc 2) {hp 100;armor 0;}
    else if(
argc == 3) {hp str_to_num(arg2);armor 0;}
    else {
hp str_to_num(arg2);armor str_to_num(arg3);}
    if(
arg[0] == '@')
    {
        new 
players[32],teamname[24],tname[16],num,index,i;
        if(
arg[1])
        {
            if(
arg[1] == 'T')
            {
                
copy(tname,15,"TERRORIST");
                
copy(teamname,23,"Terrorist");
            } else if(
arg[1] == 'C' && arg[2] == 'T') {
                
copy(tname,15,"CT");
                
copy(teamname,23,"Counter-Terrorist");
            } else {
                
console_print(id,"Usage: @T/@CT");
                return 
PLUGIN_HANDLED;
            }
            
get_players(players,num,"be",tname);
        } else {
            
get_players(players,num);
            
copy(teamname,23,"All");
        }
        if(
num == 0)
        {
            
console_print(id,"No players in team %s",teamname);
            return 
PLUGIN_HANDLED;
        }
        for(
0;num;i++)
        {
            
index players[i];
            if(
is_user_alive(index)) continue;
            
Revive(index,hp,armor);
        }
        
log_amx("ADMIN %s: Revive %s with %i hp and %i armor",name,teamname,hp,armor);
    } else {
        new 
target cmd_target(id,arg,3);
        if(!
target)
        return 
PLUGIN_HANDLED;
        if(
is_user_alive(target))
        {
            
console_print(id,"Player is allready alive !");
            return 
PLUGIN_HANDLED;
        }
        new 
namet[32]; 
        
get_user_name(target,namet,31);
        
Revive(target,hp,armor);
        
log_amx("ADMIN %s: Revive %s with %i hp and %i armor",name,namet,hp,armor);
    }
    return 
PLUGIN_HANDLED;
}
Revive(index,hp,armor)
{
    
set_pev(index,pev_deadflag,DEAD_RESPAWNABLE);
    
set_pev(index,pev_iuser1,0);
    
dllfunc(DLLFunc_Think,index);
    
engfunc(EngFunc_SetOrigin,index,Float:{-4800.0,-4800.0,-4800.0});
    new array[
3];
    array[
0] = index;
    array[
1] = hp;
    array[
2] = armor
    set_task
(0.5,"respawn",0,array,3);
}
public 
respawn(array[3])
{
    new 
index = array[0];
    new 
hp = array[1];
    new 
armor = array[2];
    if(
is_user_connected(index))
    {
        
dllfunc(DLLFunc_Spawn,index);
        
set_pev(index,pev_health,float(hp));
        
set_pev(index,pev_armorvalue,float(armor));
        switch(
get_user_team(index))
            {
                    case 
1:
                    {
                        
fm_give_item(index,"weapon_knife");
                    }
                    case 
2:
                    {
                            
fm_give_item(index,"weapon_knife");
                    }
            }
        
Fade(index,0,255,0,30);
    }
}
stock fm_give_item(id,const item[])
{
    static 
ent
    ent 
engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocStringitem));
    if(!
pev_valid(ent)) return;
   
    static 
Float:originF[3]
    
pev(idpev_originoriginF);
    
set_pev(entpev_originoriginF);
    
set_pev(entpev_spawnflagspev(entpev_spawnflags) | SF_NORESPAWN);
    
dllfunc(DLLFunc_Spawnent);
   
    static 
save
    save 
pev(entpev_solid);
    
dllfunc(DLLFunc_Touchentid);
    if(
pev(ent,pev_solid) != save)
        return;
      
    
engfunc(EngFunc_RemoveEntityent);
}
stock Fade(index,red,green,blue,alpha)
{
    
message_begin(MSG_ONE,g_fade,{0,0,0},index);
    
write_short(1<<10);
    
write_short(1<<10);
    
write_short(1<<12);
    
write_byte(red);
    
write_byte(green);
    
write_byte(blue);
    
write_byte(alpha);
    
message_end();


Last edited by Clouder16; 11-07-2014 at 05:08.
Clouder16 is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 11-07-2014 , 05:49   Re: Edit Revive Plugin (Help Please)
Reply With Quote #2

Just use my version.

If you want to use it, just say amx_revive zmd94 in the console.

zmd94 = The player name. ;)
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>

public plugin_init() 
{
    
register_plugin("AMX Revive""1.0""zmd94")
    
    
register_concmd("amx_revive""g_Revive"ADMIN_BAN"<target>")
}

public 
g_Revive(idlevelcid)
{
    if(!
cmd_access(idlevelcid2))
        return 
1
        
    
new arg[32]
    
read_argv(1argcharsmax(arg))
    
    new 
TargetPlayer cmd_target(idarg2)
    
    if(!
TargetPlayer)
        return 
1
    
    
if(is_user_alive(TargetPlayer))
    {
        
client_print(idprint_chat,"[ZM] This command is disabled for alive player!")
        return 
1
    
}
    
    new 
AdminName[32], TargetName[32]
    
get_user_name(idAdminNamecharsmax(AdminName))
    
get_user_name(TargetPlayerTargetNamecharsmax(TargetName))
    
    
client_print(0print_chat,"[ZM] ADMIN %s has revived %s"AdminNameTargetName)
    
    
Revive(TargetPlayer)
    
    return 
1
}

public 
Revive(id)
{
    
ExecuteHamB(Ham_CS_RoundRespawnid)

Attached Files
File Type: sma Get Plugin or Get Source (amx_revive.sma - 491 views - 923 Bytes)

Last edited by zmd94; 11-07-2014 at 05:51.
zmd94 is offline
Clouder16
Member
Join Date: Apr 2011
Old 11-07-2014 , 07:22   Re: Edit Revive Plugin (Help Please)
Reply With Quote #3

Awesome, thank you very much !
Clouder16 is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 11-07-2014 , 08:07   Re: Edit Revive Plugin (Help Please)
Reply With Quote #4

Nevermind. I glad if I can help you. ;)
zmd94 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:08.


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