Raised This Month: $128 Target: $400
 32% 

Revive a player in a certain radius


Post New Thread Reply   
 
Thread Tools Display Modes
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 11-15-2020 , 23:32   Re: Revive a player in a certain radius
Reply With Quote #11

bump, is it possible to remove the corpse model after reviving the partner?
wicho is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 11-16-2020 , 08:15   Re: Revive a player in a certain radius
Reply With Quote #12

no, unless it have been removed in the first place and replaced with an entity, then you can simply remove the entity corpse.


Edit : you probably can. Not sure tho I'll need to make tests and will return with feedback
__________________
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Last edited by Natsheh; 11-16-2020 at 18:59.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 11-16-2020 , 17:47   Re: Revive a player in a certain radius
Reply With Quote #13

Could you give me an example please
wicho is offline
Ark_Procession
Member
Join Date: Jun 2020
Location: Argentina
Old 11-21-2020 , 01:18   Re: Revive a player in a certain radius
Reply With Quote #14

Bugsy! could you please make it for 1.8.2? i have problems compiling:

HTML Code:
//AMXXPC compile.exe
// by the AMX Mod X Dev Team


//// asd.sma
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\addons\amxmodx\scripting\asd.sma(24) : error 017: undefined symbol "MAX_PLAYERS"
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\addons\amxmodx\scripting\asd.sma(53) : error 017: undefined symbol "MAX_PLAYERS"
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\addons\amxmodx\scripting\asd.sma(53) : error 029: invalid expression, assumed zero
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\addons\amxmodx\scripting\asd.sma(53) : error 017: undefined symbol "bBarStarted"
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\addons\amxmodx\scripting\asd.sma(53) : fatal error 107: too many error messages on one line
//
// Compilation aborted.
// 5 Errors.
// Could not locate output file C:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\addons\amxmodx\scripting\compiled\asd.amx (compile failed).
//
// Compilation Time: 0,12 sec
// ----------------------------------------

Press enter to exit ...
__________________
Feel free to ask for ENG to SPA Translations.
Ark_Procession is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 11-21-2020 , 11:14   Re: Revive a player in a certain radius
Reply With Quote #15

PHP Code:
/*

    - Credits:
      # Alucard (Get_origin)
      # Black Rose (Check buttoms)
      # bugsy (added functionality, code cleanup, fixes and added cvars)
*/

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <cstrike>

#if !defined MAX_PLAYERS
    
const MAX_PLAYERS 32;
#endif

new const Version[] = "0.3";

const 
RespawnButtons = ( IN_DUCK IN_USE );

enum CPRData
{
    
Float:CorpseOrigin],
    
ReviverID
}

new 
g_rdDataMAX_PLAYERS ][ CPRData ];
new 
g_msgBarTime;
new 
g_pDistance g_gReviveSeconds;

public 
plugin_init()
{
    
register_plugin"CPR Revive" Version "Alu-rose-sy" );

    
register_event"DeathMsg" "DeathMsg" "a" "1>0" );

    
register_forwardFM_CmdStart "CmdStart" );

    
g_msgBarTime get_user_msgid"BarTime" );

    
g_pDistance register_cvar"cpr_distance" "50" );
    
g_gReviveSeconds register_cvar"cpr_reviveseconds" "10" );
}

public 
DeathMsg()
{
    new 
iVictim read_data);
    
peviVictim pev_origin g_rdDataiVictim ][ CorpseOrigin ] );
}

public 
CmdStartid uc_handle seed )
{
    if ( !
is_user_aliveid ) )
      return;

    static 
iRespawnID bool:bRespawningMAX_PLAYERS ] , bBarStartedMAX_PLAYERS ] , Float:fOrigin];

    if ( ( 
get_ucuc_handle UC_Buttons ) & RespawnButtons ) == RespawnButtons )
    {
      if ( !
bRespawningid ] )
      {
        if ( ( 
iRespawnID CheckOriginid ) ) )
        {
            
g_rdDataiRespawnID ][ ReviverID ] = id;
            
set_pevid pev_iuser2 iRespawnID );
            
set_taskget_pcvar_floatg_gReviveSeconds ) , "RevivePlayer" iRespawnID );
            
bRespawningid ] = true;

            if ( !
bBarStartedid ] )
            {
              
StartBarid );
              
bBarStartedid ] = true;
            }
        }
      }
      else
      {
        
pevid pev_origin fOrigin );
        
iRespawnID pevid pev_iuser2 );

        if ( 
get_distance_f_xfOrigin g_rdDataiRespawnID ][ CorpseOrigin ] ) > get_pcvar_floatg_pDistance ) )
        {
            
remove_taskiRespawnID );
            
StopBarid );
            
bRespawningid ] = false;
            
bBarStartedid ] = false;

            if ( !
is_user_aliveiRespawnID  ) )
              
client_printid print_chat "* You moved too far away from player to revive" );

            
set_pevid pev_iuser2 );
        }
      }
    }
    else if ( 
bRespawningid ] )
    {
      
StopBarid );
      
remove_taskiRespawnID );
      
bRespawningid ] = false;
      
bBarStartedid ] = false;
    }

    return;
}

public 
CheckOriginid )
{
    new 
iPlayers32 ] , iNum Float:fOrigin] , Float:fDistanceThreshold Float:fDistance iNearestPlayer iPlayer Float:fNearestDistance;

    
pevid pev_origin fOrigin );
    
get_playersiPlayers iNum "be" cs_get_user_teamid ) == CS_TEAM_T "TERRORIST" "CT" );
    
fDistanceThreshold get_pcvar_floatg_pDistance );

    for ( new 
iNum i++ )
    {
      
iPlayer iPlayers];

      
fDistance get_distance_f_xfOrigin g_rdDataiPlayer ][ CorpseOrigin ] );

      if ( !
fNearestDistance || ( fNearestDistance && ( fDistance fNearestDistance ) ) )
      {
        
fNearestDistance fDistance;
        
iNearestPlayer iPlayer;
      }
    }

    return ( 
fNearestDistance <= fDistanceThreshold ) ? iNearestPlayer 0;
}

public 
RevivePlayerid )
{
    new 
szRespawnName33 ] , szRespawnerName33 ];
    
get_user_nameid szRespawnName charsmaxszRespawnName ) );
    
get_user_nameg_rdDataid ][ ReviverID ] , szRespawnerName charsmaxszRespawnerName ) );

    
ExecuteHamBHam_CS_RoundRespawn id );
    
set_pevid pev_origin g_rdDataid ][ CorpseOrigin ] );
    
client_printprint_chat "[CPR] User %s respawned target %s" szRespawnerName szRespawnName );
}

public 
StartBarid )
{
    
message_beginMSG_ONE g_msgBarTime , {0,0,0} , id );
    
write_shortget_pcvar_numg_gReviveSeconds ) );
    
message_end();
}

public 
StopBarid )
{
    
message_beginMSG_ONE g_msgBarTime _id );
    
write_short);
    
message_end();
}

//Workaround due to AMX-X compile error using array from enumerator in get_distance_f()
Float:get_distance_f_xFloat:fOrigin1[] , Float:fOrigin2[] )
{
    new 
Float:f1] , Float:f2[3];
    
f1[0] = fOrigin1[0];
    
f1[1] = fOrigin1[1];
    
f1[2] = fOrigin1[2];
    
f2[0] = fOrigin2[0];
    
f2[1] = fOrigin2[1];
    
f2[2] = fOrigin2[2];

    return 
get_distance_ff1 f2 );

__________________
Napoleon_be is online now
Send a message via Skype™ to Napoleon_be
Ark_Procession
Member
Join Date: Jun 2020
Location: Argentina
Old 11-21-2020 , 11:37   Re: Revive a player in a certain radius
Reply With Quote #16

Hi, it doesn't work! when you are at a corpse and the bar finishes loading, the game crashes.

But thanks for your time! maybe you can take a look at it?

I don't find any error message in my log!
__________________
Feel free to ask for ENG to SPA Translations.

Last edited by Ark_Procession; 11-21-2020 at 11:38.
Ark_Procession is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 11-21-2020 , 20:15   Re: Revive a player in a certain radius
Reply With Quote #17

Quote:
Originally Posted by Ark_Procession View Post
Hi, it doesn't work! when you are at a corpse and the bar finishes loading, the game crashes.

But thanks for your time! maybe you can take a look at it?

I don't find any error message in my log!
Can you show us if u have any errors now...?
__________________
Napoleon_be is online now
Send a message via Skype™ to Napoleon_be
Ark_Procession
Member
Join Date: Jun 2020
Location: Argentina
Old 11-22-2020 , 11:40   Re: Revive a player in a certain radius
Reply With Quote #18

Quote:
Originally Posted by Napoleon_be View Post
Can you show us if u have any errors now...?
No errors in log, still crashes after bar reaches full
__________________
Feel free to ask for ENG to SPA Translations.
Ark_Procession is offline
Reply


Thread Tools
Display Modes

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 07:59.


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