AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Solved respawn plugin (https://forums.alliedmods.net/showthread.php?t=320870)

Sanjay Singh 01-13-2020 05:22

respawn plugin
 
I need a good auto respawn plugin which will respawn player when they're dead and also respawn newly connected players.
which won't respawn spec players

iceeedr 01-13-2020 09:10

Re: respawn plugin
 
PHP Code:

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

#define PLUGIN "Respawn"
#define VERSION "1.0"
#define AUTHOR "iceeedR"

new pRespawnEnabled

new const m_iMenu 205
new const CS_Menu_ChooseAppearance 3

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
RegisterHam(Ham_Killed"player""PostPlayerKilled"1)
    
pRespawnEnabled register_cvar("amx_respawn","1")
    
    
register_clcmd("joinclass","JoinClass")
    
register_clcmd("menuselect","JoinClass")
}

public 
PostPlayerKilled(iVictimiAttackershouldgib
{
    if(
get_pcvar_num(pRespawnEnabled)) {
        
set_task(2.0"RespawnVictim"iVictim)
    }
}

public 
RespawnVictim(id
{
    if(
get_pcvar_num(pRespawnEnabled) && !is_user_alive(id)) 
    {
        
ExecuteHamB(Ham_CS_RoundRespawnid
    }
}

public 
JoinClass(id)
{
    if(
pev_valid(id) == && get_pdata_int(idm_iMenu) == CS_Menu_ChooseAppearance)
        
set_task(1.0"RespawnVictim"id)



HamletEagle 01-13-2020 09:19

Re: respawn plugin
 
@iceeedr, the only 1.9 specific thing is RegisterHamPlayer and that can be easily replaced with RegisterHam. Given that 1.9 is not the stable release yet you should try to post code that works in 1.8.2 whenever possible.

For example if you were to change some gamerules offsets I would understand using 1.9 specific natives because the alternative for 1.8.2 is orpheu and it is not a trivial replacement.

iceeedr 01-13-2020 13:44

Re: respawn plugin
 
Quote:

Originally Posted by HamletEagle (Post 2680052)
@iceeedr, the only 1.9 specific thing is RegisterHamPlayer and that can be easily replaced with RegisterHam. Given that 1.9 is not the stable release yet you should try to post code that works in 1.8.2 whenever possible.

For example if you were to change some gamerules offsets I would understand using 1.9 specific natives because the alternative for 1.8.2 is orpheu and it is not a trivial replacement.

Sure, but I always try to bring amx 1.9+ to the forum so that more people upgrade their servers, I use the dev version for over 1 year and it at least for me is perfectly stable, but as you well considered it to be an extremely change Easy for version 1.8.2 I made the change, thanks.

HamletEagle 01-13-2020 14:49

Re: respawn plugin
 
If it was considered perfectly stable by the people developing it then it would have been already released.
The point of having both stable and dev versions is that people are not forced to use the new version until it was thoroughly tested. We should not be trying to get people to switch to a dev version, they should switch because they feel like it.

iceeedr 01-13-2020 15:10

Re: respawn plugin
 
Code:

I use the dev version for over 1 year and it at least for me is perfectly stable
But I understand your point.

Sanjay Singh 01-14-2020 05:53

Re: respawn plugin
 
Error

PHP Code:

// H:\AMX 1.8.2\scripting\autorespawn.sma(39) : error 017: undefined symbol "get_ent_data" 


iceeedr 01-14-2020 08:55

Re: respawn plugin
 
Quote:

Originally Posted by Sanjay Singh (Post 2680174)
Error

PHP Code:

// H:\AMX 1.8.2\scripting\autorespawn.sma(39) : error 017: undefined symbol "get_ent_data" 


I forgot that get_ent_data was only added in amx 1.9, updated my post with version 1.8.2 (now compiled to make sure).

wy19850 02-21-2020 17:32

Re: respawn plugin
 
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>

#define PLUGIN "Respawn"
#define VERSION "100.0"
#define AUTHOR "iceeedR"

new pRespawnEnabled

new const m_iMenu = 205
new const CS_Menu_ChooseAppearance = 3

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)

RegisterHam(Ham_Killed, "player", "PostPlayerKilled", 1)
pRespawnEnabled = register_cvar("amx_respawn","1")

register_clcmd("joinclass","JoinClass")
register_clcmd("menuselect","JoinClass")
}

public PostPlayerKilled(iVictim, iAttacker, shouldgib)
{
if(get_pcvar_num(pRespawnEnabled)) {
set_task(100.0, "RespawnVictim", iVictim)
}
}

public RespawnVictim(id)
{
if(get_pcvar_num(pRespawnEnabled) && !is_user_alive(id))
{
ExecuteHamB(Ham_CS_RoundRespawn, id)
}
}

public JoinClass(id)
{
if(pev_valid(id) == 2 && get_pdata_int(id, m_iMenu) == CS_Menu_ChooseAppearance)
set_task(100.0, "RespawnVictim", id)
}


















#define VERSION "100.0"


set_task(100.0, "RespawnVictim", iVictim)

set_task(100.0, "RespawnVictim", id)




N time debugging will immediately resurrection, 10 seconds resurrection do friends, thank you

wy19850 02-21-2020 17:34

Re: respawn plugin
 
1.82 platform


All times are GMT -4. The time now is 01:47.

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