AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   General (https://forums.alliedmods.net/forumdisplay.php?f=7)
-   -   Anyone knows how to spawn instantly, after changing teams? (https://forums.alliedmods.net/showthread.php?t=328750)

Mmiicchhaaeell 11-23-2020 22:35

Anyone knows how to spawn instantly, after changing teams?
 
Anyone knows how to spawn instantly, after changing teams? Or after joining the server, if the round just started, I would say within 3-5 seconds. Because right now, I have to wait, until the round ends and then start when the game starts. Same thing if I want to switch teams, it makes me wait one round before I can start playing. Sometimes it makes me wait, even if I switch teams at the end of the round. It still makes me wait one round. Is there a cmd, or a plugin to make the spawn instant? I have seen in other servers, they have several seconds and they still can spawn after the game starts.


Thanks

Bugsy 11-24-2020 19:02

Re: Anyone knows how to spawn instantly, after changing teams?
 
Are you creating a plugin for this? If yes, have you tried Ham_CS_RoundRespawn?

JaC k 11-26-2020 03:39

Re: Anyone knows how to spawn instantly, after changing teams?
 
If you are using ReAPI, just use this simple code:
PHP Code:

/*
*    This plugin will automatically respawn player directly after manual team change
*    This plugin require ReAPI (Have no idea how to convert to AMXX)
*
*    Code idea from our Zombie Escape Mod
*/

#include <amxmodx>
#include <reapi>

new bool:g_bSwitched[33]

public 
plugin_init()
{
    
register_plugin("Respawn After Team Change""1.0""Raheem")
    
    
RegisterHookChain(RG_HandleMenu_ChooseTeam"HC_HandleMenu_ChooseTeam_Pre"false)
    
RegisterHookChain(RG_HandleMenu_ChooseAppearance"HC_HandleMenu_ChoosedAppearance_Post"true)
    
RegisterHookChain(RG_RoundEnd"HC_RoundEnd_Post"true)
}

public 
HC_HandleMenu_ChooseTeam_Pre(idMenuChooseTeam:iSlot)
{
    if (
iSlot == MenuChoose_CT || iSlot == MenuChoose_T)
    {
        if (
is_user_alive(id))
        {
            
g_bSwitched[id] = true
        
}
    }
}

public 
HC_HandleMenu_ChoosedAppearance_Post(const id, const slot)
{
    if (
g_bSwitched[id])
    {
        
rg_round_respawn(id)
        
g_bSwitched[id] = false
    
}
}

public 
HC_RoundEnd_Post(WinStatus:statusScenarioEventEndRound:eventFloat:tmDelay)
{
    
arrayset(g_bSwitchedfalsecharsmax(g_bSwitched))


In ReGameDLL you can control also the time that during the game where player still respawned:
PHP Code:

// Player cannot respawn until next round
// if more than N seconds has elapsed since the beginning round
//
// Default value: "20"
mp_roundrespawn_time 5 

So using first plugin will respawn the player directly after switching team. And using mp_roundrespawn_time 5 will allow players join the game if not more than 5 seconds elapsed from the round.

Mmiicchhaaeell 11-28-2020 00:45

Re: Anyone knows how to spawn instantly, after changing teams?
 
not using reapi. Not very familiar with reapi. I have heard about the module though.


All times are GMT -4. The time now is 08:28.

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