Raised This Month: $ Target: $400
 0% 

Simple respawning, bodies does not disappear


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
naven
Veteran Member
Join Date: Jun 2008
Location: Poland, Cieszyn
Old 06-27-2009 , 14:31   Simple respawning, bodies does not disappear
Reply With Quote #1

Hi,
I am using this code for respawning(works fine):
Code:
public DeathMsg()
{
    new victim;
    victim = read_data(2)
    if (get_cvar_num("amx_respawn") > 0)
    set_task(1.0, "respawn_player", victim + 483) 
} 
public respawn_player(id)
{
    id -= 483;
    if (!is_user_connected(id) || is_user_alive(id) || cs_get_user_team(id) == CS_TEAM_SPECTATOR)         return;
    set_pev(id, pev_deadflag, DEAD_RESPAWNABLE)
    dllfunc(DLLFunc_Think, id)
    if (is_user_bot(id) && pev(id, pev_deadflag) == DEAD_RESPAWNABLE)
    {
    dllfunc(DLLFunc_Spawn, id)
    }
    
}
public sayrespawn(gracz)
{
    if (!is_user_connected(gracz) || cs_get_user_team(gracz) == CS_TEAM_SPECTATOR)         return PLUGIN_HANDLED;
    set_pev(gracz, pev_deadflag, DEAD_RESPAWNABLE)
    dllfunc(DLLFunc_Think, gracz)
    dllfunc(DLLFunc_Spawn, gracz)
    return PLUGIN_HANDLED;
}
("gracz" is id)
But I want bodies to disappear just right after death, at the moment some maps looks like this: http://iv.pl/images/f8kvcr040qy9ha48y.jpg
Check out fps- not really good fps for surf
Note: I need this for my surf mod, and I want to keep as many fps as I can
__________________
naven.com.pl
"At the end of the day, there are always going to be mental disorders and people who cause violence for no other reason than the fact that they're fucked up and lost. And all we can do is try to learn from it." Corey Taylor.
naven is offline
vato loco [GE-S]
Veteran Member
Join Date: Oct 2006
Location: Germany
Old 06-27-2009 , 16:53   Re: Simple respawning, bodies does not disappear
Reply With Quote #2

you can test this respawn plugin
should be ok for surf maps
PHP Code:
/* Plugin generated by AMXX-Studio */

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

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

new g_sf_respawn

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /respawn","cmd_respawn")
    
g_sf_respawn register_cvar("sf_respawn","1")
    
register_event("DeathMsg","death_event","a")
}

public 
cmd_respawn(id)
{    
    if(
get_pcvar_num(g_sf_respawn))
    {
        new 
CsTeams:Team cs_get_user_team(id)
        
        if(
Team == CS_TEAM_T || Team == CS_TEAM_CT)
        {
            
set_task(0.5,"spawn",id)
        }
    }
    return 
PLUGIN_CONTINUE
}

public 
death_event()    
{
    new 
victim read_data(2)
    
set_task(0.5,"spawn",victim)
}

public 
spawn(id)
{
    if(
get_pcvar_num(g_sf_respawn))
    {    
        new 
CsTeams:Team cs_get_user_team(id)
        
        if(
is_user_connected(id) && (Team == CS_TEAM_T || Team == CS_TEAM_CT))
        {
            
dllfunc(DLLFunc_Spawn,id)
        }
    }
    return 
PLUGIN_CONTINUE

__________________
vato loco [GE-S] is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 06-28-2009 , 05:48   Re: Simple respawning, bodies does not disappear
Reply With Quote #3

I remember that when spawning dead player with Ham, his body sometimes disappears and sometimes not. Does it really never disappear with the way N A V E N provided?
__________________
hleV is offline
naven
Veteran Member
Join Date: Jun 2008
Location: Poland, Cieszyn
Old 06-28-2009 , 07:43   Re: Simple respawning, bodies does not disappear
Reply With Quote #4

When I play alone, bodies disappear after maybe 10 seconds(I look when my body falls down... i do not want that too), but when it's on a server with more people some bodies never disappear, makes crash and low fps, not really wanted on surf.
P.S. I prefer saying just naven to me
__________________
naven.com.pl
"At the end of the day, there are always going to be mental disorders and people who cause violence for no other reason than the fact that they're fucked up and lost. And all we can do is try to learn from it." Corey Taylor.

Last edited by naven; 06-28-2009 at 08:35.
naven is offline
naven
Veteran Member
Join Date: Jun 2008
Location: Poland, Cieszyn
Old 06-29-2009 , 09:51   Re: Simple respawning, bodies does not disappear
Reply With Quote #5

Could anyone fix my code?
__________________
naven.com.pl
"At the end of the day, there are always going to be mental disorders and people who cause violence for no other reason than the fact that they're fucked up and lost. And all we can do is try to learn from it." Corey Taylor.
naven 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 15:37.


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