Raised This Month: $12 Target: $400
 3% 

Solved Respawn Bug on Course maps


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Javierko
AlliedModders Donor
Join Date: Sep 2017
Location: Czech republic
Old 01-02-2019 , 10:05   Respawn Bug on Course maps
Reply With Quote #1

Hi,
i have problem with respawning players, when plugin respawn them on death, players are not alive, but camera is bugged, like they are alive and they can see their HP bar, ammo, but they dont have knife or any gun.
How it looks: https://ctrlv.cz/shots/2019/01/02/VzRB.png

Code:
PHP Code:
public Action Event_PlayerDeath(Event event, const char[] namebool dontBroadcast)
{
    
int victim GetClientOfUserId(event.GetInt("userid"));

    if(
IsValidClient(victim))
    {
        if(
Zone_CheckIfZoneExists("teleport"))
        {
            
float Position[3];
            if(
Zone_GetZonePosition("teleport"falsePosition))
            {
                
CS_RespawnPlayer(victim);
                
TeleportEntity(victimPositionNULL_VECTORNULL_VECTOR);
                
CS_RespawnPlayer(victim);
            }
            else
            {
                
PrintToChatAll("pozice nenalezena"); 
            }
        }
        else
        {
            
PrintToChatAll("zona nenalezena");
        }
    }

Thanks for help.
__________________
My Github & Sourcemod work.
If you like my work and if you want to support me, you can through PayPal.

Official SourceMod CZ/SK Discord: https://discord.gg/Qvar55a

Last edited by Javierko; 01-03-2019 at 06:42.
Javierko is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 01-02-2019 , 10:51   Re: Respawn Bug on Course maps
Reply With Quote #2

You're respawning them too fast. When a player dies you should wait atleast 1 frame to respawn them.
Mitchell is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 01-02-2019 , 11:30   Re: Respawn Bug on Course maps
Reply With Quote #3

why are you respawning them 2 times?
__________________
8guawong is offline
Rohanlogs
Senior Member
Join Date: Nov 2015
Old 01-03-2019 , 01:29   Re: Respawn Bug on Course maps
Reply With Quote #4

You should also wait at least 1 frame to teleport a client once respawn is called, otherwise I don't think it'll work.
So you can use requestframe or create a 0.1s timer.
__________________
Rohanlogs is offline
kratoss1812
Senior Member
Join Date: May 2018
Location: Romānia
Old 01-03-2019 , 04:36   Re: Respawn Bug on Course maps
Reply With Quote #5

You should respawn the player after let's say 0,5 seconds after he dies. Do this using a timer.
Also teleport the player after he spawn. And don't spawn him twice
__________________
kratoss1812 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 01-03-2019 , 06:39   Re: Respawn Bug on Course maps
Reply With Quote #6

If someone want to know more about this.

This is what happen in-game (csgo), normal.
normal






And what would happen when CS_RespawnPlayer() player on player_death event.
Respawn on player_death


*Huge edit

Problem is when you going to respawn player on event player_death:
- Player is back alive and game set player m_lifeState something else than 0 or player m_iHealth is set to 0, later.
There is small delay when this happen after event.
__________________
Do not Private Message @me

Last edited by Bacardi; 01-03-2019 at 10:38.
Bacardi is offline
Javierko
AlliedModders Donor
Join Date: Sep 2017
Location: Czech republic
Old 01-03-2019 , 06:42   Re: Respawn Bug on Course maps
Reply With Quote #7

Thanks guys, fixed by making RequestFrame on p. death.
__________________
My Github & Sourcemod work.
If you like my work and if you want to support me, you can through PayPal.

Official SourceMod CZ/SK Discord: https://discord.gg/Qvar55a
Javierko is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 01-03-2019 , 06:57   Re: Respawn Bug on Course maps
Reply With Quote #8

I would recommend 0.0 timer than next frame.
Bacardi is offline
Facksy
Senior Member
Join Date: Apr 2017
Location: +2+2
Old 01-03-2019 , 08:31   Re: Respawn Bug on Course maps
Reply With Quote #9

EventHookMode_Post works too no?
__________________
My Steam I take private requests if related with TF2
My Plugins
Facksy is offline
foon
Member
Join Date: Dec 2018
Old 01-03-2019 , 09:00   Re: Respawn Bug on Course maps
Reply With Quote #10

Quote:
Originally Posted by Bacardi View Post
I would recommend 0.0 timer than next frame.
Any reason to use a timer rather than requestframe?
foon 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 15:17.


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