Admin Level "h" Have this . /revive for menu revive . You can chose revive tr ct or ...
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <fun>
#include <cstrike>
#define PLUGIN "Revive"
#define VERSION "1.1"
#define AUTHOR "Crey"
#pragma tabsize 0 // 0 = off 1 = on
new g_fade;
new g_arv
const KEYSMENU = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6|MENU_KEY_7|MENU_KEY_8|MENU_KEY_9|MENU_KEY_0
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_clcmd("say /revive","cmd_menu");
register_clcmd("hex_revive","revive_cmd",ADMIN_LEVEL_H);
g_fade = get_user_msgid("ScreenFade");
register_menu("Auto Revive Menu", KEYSMENU, "admin_menu")
//register_clcmd("show_menu_arv","adminmenu");
register_logevent("round_end", 2, "1=Round_End")
g_arv = 0
}
public client_authorized(id)
{
client_cmd(0,"setinfo ^"_vgui_menus^" ^"1^"");
set_user_info(id, "_vgui_menus", "1");
}
public cmd_menu(client)
{
if ( !(get_user_flags( client ) & ADMIN_LEVEL_H) )
{
ColorPrint( client, "You have no access to this command." );
//client_cmd(client,"spk ^"sound/soundeffect/insufficient_permissions.wav^"");
return PLUGIN_HANDLED;
}
new hMenu = menu_create( "\rRevive Menu", "CMDMenu_Handler" );
menu_additem( hMenu, "Revive Player", "0" );
menu_additem( hMenu, "Revive All", "1" );
menu_additem( hMenu, "Revive Self", "2" );
menu_additem( hMenu, "Revive \rCT", "3" );
menu_additem( hMenu, "Revive \rTerrorist", "4" );
if(get_user_flags(client) && ADMIN_IMMUNITY)
menu_additem( hMenu, "Auto \rRevive \wMenu", "5" );
menu_display( client, hMenu, 0 );
return PLUGIN_HANDLED;
}
public CMDMenu_Handler( id, hMenu, iItem )
{
if( iItem == MENU_EXIT )
{
menu_destroy( hMenu );
return PLUGIN_HANDLED;
}
new szData[ 6 ];
new iAccess, hCallback;
menu_item_getinfo( hMenu, iItem, iAccess, szData, 5, _, _, hCallback );
switch( str_to_num( szData ) )
{
case 0:
{
CmdRV( id )
}
case 1:
{
client_cmd(id,"hex_revive ^"@CT^" ^"100^" ^"0^"");
client_cmd(id,"hex_revive ^"@T^" ^"100^" ^"0^"");
ColorPrint(0 , "^4^3[ADMIN : ^4%s^3]^1 Use Command ^4[Revive All]^1",szName(id));
}
case 2:
{
if(!is_user_alive(id))
{
Revive(id,100,0)
ColorPrint(0 , "^4^3[ADMIN : ^4%s^3]^1 Use Command ^4[Revive]^1",szName(id));
}
}
case 3:
{
client_cmd(id,"hex_revive ^"@CT^" ^"100^" ^"0^"");
ColorPrint(0 , "^4^3[ADMIN : ^4%s^3]^1 Use Command ^4[Revive CT]^1",szName(id));
}
case 4:
{
client_cmd(id,"hex_revive ^"@T^" ^"100^" ^"0^"");
ColorPrint(0, "^4^3[ADMIN : ^4%s^3]^1 Use Command ^4[Revive Terrorist]^1",szName(id));
}
case 5:
{
if(get_user_flags(id) && ADMIN_IMMUNITY)
show_menu_arv(id)
}
}
menu_destroy( hMenu );
return PLUGIN_HANDLED;
}
show_menu_arv(id)
{
if(get_user_flags(id) && ADMIN_IMMUNITY)
{
static menu[250], len
len = 0
// Title
len += formatex(menu[len], charsmax(menu) - len, "\rAuto Revive Menu^n^n")
// 2. un Stuck
len += formatex(menu[len], charsmax(menu) - len, "\r1.\w Auto Revive %s^n^n",g_arv ? "\r[ON]" : "\y[OFF]")
len += formatex(menu[len], charsmax(menu) - len, "^n^n\r0.\w Exit", id)
show_menu(id, KEYSMENU, menu, -1, "Auto Revive Menu")
}
}
public admin_menu(id, key, menu)
{
switch (key)
{
case 0: // Extra Items
{
if(g_arv == 0)
{
g_arv = 1
set_task(1.0,"aRv");
}else if(g_arv == 1)
{
ColorPrint(0,"^4^1 Auto ^4Revive^1 Desactivated.")
g_arv = 0
remove_task(id)
}
}
}
}
public aRv(id)
{
if(g_arv == 1)
{
client_cmd(id,"hex_revive ^"@CT^" ^"100^" ^"0^"");
client_cmd(id,"hex_revive ^"@T^" ^"100^" ^"0^"");
ColorPrint(0,"^4^1 Auto ^4Revive^1 Actived.")
set_task(20.0,"aRv");
}
}
public round_end(id)
{
remove_task(id)
g_arv = 0
}
public CmdRV( client )
{
if ( !(get_user_flags( client ) & ADMIN_LEVEL_H) )
{
ColorPrint( client, " You have no access to this command." );
return PLUGIN_HANDLED;
}
static szItem[ 128 ], Menu, Players[ 32 ], iNum, szTempid[ 10 ];
formatex( szItem, charsmax( szItem ), "\rRevive Player Menu");
Menu = menu_create( szItem, "SubRV" );
get_players( Players, iNum)
for ( new i; i < iNum; i++ )
{
new iPlayer = Players[ i ];
if( !is_user_connected(iPlayer) || is_user_bot(iPlayer) || is_user_alive(iPlayer) || cs_get_user_team(iPlayer) == CS_TEAM_SPECTATOR)
continue;
num_to_str( iPlayer, szTempid, charsmax( szTempid ) );
formatex( szItem, charsmax( szItem ), "%s", szName( iPlayer ));
menu_additem( Menu, szItem, szTempid );
}
menu_display( client, Menu );
return 1;
}
public SubRV( client, Menu, Item )
{
if ( Item == MENU_EXIT )
{
menu_destroy( Menu );
return 1;
}
new Access, Callback, Name[ 64 ], Data[ 6 ];
menu_item_getinfo( Menu, Item, Access, Data, charsmax( Data ), Name, charsmax( Name ),Callback );
new iPlayer = str_to_num( Data );
ColorPrint(0 , "^4^3[ADMIN : ^4%s^3]^1 Gave Revive To ^4[%s]^1",szName( client ),szName( iPlayer ));
Revive(iPlayer,100,0);
menu_destroy( Menu );
CmdRV( client );
return 1;
}
public revive_cmd(id,level,cid)
{
if(!get_user_flags(id) && ADMIN_LEVEL_H)
return PLUGIN_HANDLED;
if(cs_get_user_team(id) == CS_TEAM_SPECTATOR)
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(i = 0;i < num;i++)
{
index = players[i];
if(!is_user_alive(index) && !is_user_bot(index) && !is_user_hltv(index) && cs_get_user_team(index) != CS_TEAM_SPECTATOR)
{
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(!is_user_alive(target) && !is_user_bot(target) && !is_user_hltv(target) && cs_get_user_team(target) != CS_TEAM_SPECTATOR)
{
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)
{
if(cs_get_user_team(index) == CS_TEAM_SPECTATOR)
return PLUGIN_HANDLED;
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);
return PLUGIN_HANDLED;
}
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_CreateNamedEntity, engfunc(EngFunc_AllocString, item));
if(!pev_valid(ent)) return;
static Float:originF[3]
pev(id, pev_origin, originF);
set_pev(ent, pev_origin, originF);
set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN);
dllfunc(DLLFunc_Spawn, ent);
static save
save = pev(ent, pev_solid);
dllfunc(DLLFunc_Touch, ent, id);
if(pev(ent,pev_solid) != save)
return;
engfunc(EngFunc_RemoveEntity, ent);
}
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();
}
stock ColorPrint( const client, const szString[], any:... )
{
new szMsg[ 191 ], Players[ 32 ], PNum = 1;
static Len; Len = formatex( szMsg, charsmax( szMsg ), "");
vformat( szMsg[ Len ], charsmax ( szMsg ) - Len, szString, 3 );
if ( client ) Players[ 0 ] = client;
else get_players( Players, PNum, "ch" );
for ( new i; i < PNum; i++ )
{
if ( is_user_connected( Players[ i ] ) )
{
message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ) ,_, Players[ i ] );
write_byte( Players[ i ] );
write_string( szMsg );
message_end( );
}
}
return 1;
}
stock szName( const index )
{
static g_szName[ 32 ];
get_user_name( index, g_szName, charsmax( g_szName ) );
return g_szName;
}
stock fm_get_user_team( const index )
return get_pdata_int( index, 114 );