Raised This Month: $ Target: $400
 0% 

Auto Respawn


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Foxa
Member
Join Date: Nov 2018
Location: Croatia
Old 07-30-2020 , 11:29   Re: Auto Respawn
Reply With Quote #10

They won't get respawned if they join a team from spectators, lets say an admin transfers a user to spectators for being afk, once the user is back they would have to wait for the whole round to be respawned after they pick a team, also i'm pretty sure that if they don't choose a team in the given delay they wouldn't be respawned (which is why I added the DELAY+4.0 in my code, since <5 seconds should be enough to pick a player model). Your way would work if the server is running a plugin that doesn't let the user pick a team.

Also, probably hooking the "joinclass" command would be better than join team event (again if the server is not running some kind of auto team join plugin + it removes the question of "what if they don't pick a model in a given time frame")

PHP Code:
#include <amxmodx>

#include <hamsandwich>

#pragma semicolon 1

#define IsPlayer(%1) (1<=%1<=32)
#define DELAY 1.0

public plugin_init(){
    
register_plugin("MY""NAME""JEFF");
    
    
RegisterHam(Ham_Killed"player""ham_PlayerKilledPost"1);
    
    
register_clcmd("joinclass""clcmd_JoinClass");
}

public 
ham_PlayerKilledPost(id){
    if(!
task_exists(id))
        
set_task(DELAY"task_Respawn"id);
}

public 
clcmd_JoinClass(id){
    if(!
task_exists(id))
        
set_task(DELAY"task_Respawn"id);
}

public 
task_Respawn(id){
    if(
get_user_team(id)!=&& IsPlayer(id))
        
ExecuteHamB(Ham_CS_RoundRespawnid);


Last edited by Foxa; 07-30-2020 at 11:30.
Foxa is offline
 



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 09:02.


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