Raised This Month: $82 Target: $400

Solved [HLDM] Send player to Spectator on join

Post New Thread Reply   
Thread Tools Display Modes
Author Message
Gabe Iggy
Veteran Member
Join Date: Mar 2011
Location: Chile
Old 04-13-2019 , 11:06   [HLDM] Send player to Spectator on join
Reply With Quote #1

Hello, I try to send a player to spectator when he joins, however when I do so they get sent into a "limbo" state, unable to do anything. (origin 0,0,0 - camera tilted as if they were dead)

public player_spawn_pre(id) {     if(g_bRoundStarted || get_playersnum() < 2)     {         hl_set_user_spectator(id, true);         return HAM_SUPERCEDE;     }     return HAM_IGNORED; }

If I send them to spectator again when they are killed (assuming they spawned normally), they go to spectator without problems.
public player_killed_post(id) {     [...]     if (g_bRoundStarted)         set_task(5.0, "send_player_to_spec", id + TASK_SENDVICTIMTOSPEC); }

public send_player_to_spec(taskid) {     new id = taskid - TASK_SENDVICTIMTOSPEC;     if (is_user_connected(id))     {         if (!is_user_alive(id) || is_user_bot(id))             hl_set_user_spectator(id, true);     } }

What's the cause of this?

EDIT: Fixed it myself by moving this operation to a task set on post

Current Handle Name: G.I. | Gabe Iggy (Steam)
Public Plugins:
Static.cfg Restoration | Sven Co-op Player vs Player | Hide Donator Icons
Discord: http://discord.daijobu.org/

Last edited by Gabe Iggy; 04-16-2019 at 16:36.
Gabe Iggy is offline

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 04:36.

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