Raised This Month: $7 Target: $400
 1% 

Solved [HLDM] Send player to Spectator on join


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
gabuch2
AlliedModders Donor
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)

Code:
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.
Code:
public player_killed_post(id) {     [...]     if (g_bRoundStarted)         set_task(5.0, "send_player_to_spec", id + TASK_SENDVICTIMTOSPEC); }

Code:
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
__________________

Last edited by gabuch2; 04-16-2019 at 16:36.
gabuch2 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 00:11.


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