Raised This Month: $ Target: $400
 0% 

CS_RespawnPlayer sometimes kills player on spawn


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
altex
Veteran Member
Join Date: May 2009
Location: Russia
Old 01-02-2010 , 17:02   CS_RespawnPlayer sometimes kills player on spawn
Reply With Quote #1

Realy can not figure it out how it is possible that CS_RespawnPlayer sometimes kills player just on spawn. It happens only when player connects (on map change too) and then join to T or CT team, and after spawn he just been slayed.
__________________
altex is offline
API
Veteran Member
Join Date: May 2006
Old 01-02-2010 , 18:27   Re: CS_RespawnPlayer sometimes kills player on spawn
Reply With Quote #2

While I have never personally had this issue, it is important to remember that CS_RespawnPlayer is actually a wrapper of the engine function CCSPlayer::RoundRespawn()
It isn't something SourceMod can fix, my best advice would be only to use this when the player is dead, and instead use TeleportEntity when they are already alive.
__________________
API is offline
Send a message via AIM to API
altex
Veteran Member
Join Date: May 2009
Location: Russia
Old 01-02-2010 , 20:23   Re: CS_RespawnPlayer sometimes kills player on spawn
Reply With Quote #3

I use it only on dead players
if ( client && IsClientInGame(client) && (GetClientTeam(client) > 1) && (!IsPlayerAlive(client)) )
{
CS_RespawnPlayer(client);
}

and i run this code after 2 seconds after player joins team
__________________
altex is offline
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 01-02-2010 , 22:06   Re: CS_RespawnPlayer sometimes kills player on spawn
Reply With Quote #4

Quote:
Originally Posted by altex View Post
and i run this code after 2 seconds after player joins team
Make sure theyve also chosen a class (model) before running the function. At least if its their first team join, although it may cause complications on later team joins too. You can hook the command "joinclass".
__________________
plop
p3tsin is offline
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Old 01-03-2010 , 01:36   Re: CS_RespawnPlayer sometimes kills player on spawn
Reply With Quote #5

There is also an event player_class. Never tested it before, but theoretically it should work. But then again, knowing Valve, you shouldn't count on it.

Hooking joinclass is a solid method as well, as p3tsin suggested.
__________________
Greyscale is offline
altex
Veteran Member
Join Date: May 2009
Location: Russia
Old 01-03-2010 , 04:59   Re: CS_RespawnPlayer sometimes kills player on spawn
Reply With Quote #6

Ha, i've just tested it, and if i join team and do not join a class then spawn and after join class i've been slayed.

Great, thanks a lot!
__________________
altex is offline
exvel
SourceMod Donor
Join Date: Jun 2006
Location: Russia
Old 01-03-2010 , 07:46   Re: CS_RespawnPlayer sometimes kills player on spawn
Reply With Quote #7

It is important to know that engine tries to respawn player only after he joined class but if player already alive it will kill him. I used this in my antirejoin script for blocking player's respawn by blocking joinclass command.
__________________
For admins: My plugins

For developers: Colors library
exvel is offline
Send a message via ICQ to exvel
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 19:07.


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