AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Transfer from spec or no-team (https://forums.alliedmods.net/showthread.php?t=185021)

doondook 05-12-2012 01:41

Transfer from spec or no-team
 
There is a bug when u join a team (T or CT) by admin transfer command (using default plugin) from spectators or no team chosen (w/o spawned once, just after connect). So if player spawns after such action he gets no weapon and HUD is not displayed. I know how to catch this bad spawn, but dunno how to improve. Any ideas?

hornet 05-12-2012 04:22

Re: Transfer from spec or no-team
 
Perhaps you could use a variable to detect whether it's their first spawn and if they came from Spec, and then when they spawn respawn them using Ham_CS_RoundRespawn. Idea not tested.

doondook 05-12-2012 06:16

Re: Transfer from spec or no-team
 
Respawn doesn't help after first bad spawn, only reconnect and manual choosing team improves it. Must be some key values that I need to set, but dunno which.

hornet 05-16-2012 11:11

Re: Transfer from spec or no-team
 
Here's a test subject that I wrote to try and solve this issue. I think it could be quite useful to you. Although I still can't figure out why it won't instant spawn me.

PHP Code:

#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>

#define m_iPlayerTeam        114 
#define m_iJoinedState        121

#define STATE_INGAME        5

public plugin_init()
{
    
register_clcmd"say /unspec""cmd_UnSpec" );
}

public 
cmd_UnSpecid )
{
    
set_pdata_intidm_iPlayerTeam);
    
set_pdata_intidm_iJoinedStateSTATE_INGAME );
    
    
set_pevidpev_deadflagDEAD_RESPAWNABLE );
    
    
ExecuteHamHam_CS_RoundRespawnid );



doondook 05-16-2012 16:42

Re: Transfer from spec or no-team
 
Thanks, rly useful! Working version:
PHP Code:

#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <fun>

#define m_iJoinedState     121

#define STATE_INGAME     5

public plugin_init(){
    
register_clcmd"say /unspec""cmd_UnSpec" );
}

public 
cmd_UnSpec(id){
    
set_pdata_int(idm_iJoinedStateSTATE_INGAME// that was the problem
    
    
set_pev(idpev_deadflagDEAD_RESPAWNABLE)

    
set_task(0.1"SpawnPlayer"id// need delay
 
}

public 
SpawnPlayer(id){
    
ExecuteHam(Ham_CS_RoundRespawnid)


Mb someone would find more accurate method.

mottzi 05-16-2012 18:08

Re: Transfer from spec or no-team
 
ExecuteHam(Ham_CS_RoundRespawn, id) is actually spawning the Player, you rather delay that instead of adding nonsens to the plugin :)

hornet 05-16-2012 21:30

Re: Transfer from spec or no-team
 
Quote:

Originally Posted by mottzi (Post 1710276)
ExecuteHam(Ham_CS_RoundRespawn, id) is actually spawning the Player, you rather delay that instead of adding nonsens to the plugin :)

Did that make any sense?


Hmmm I did try adding a task for spawning but maybe I did that before I'd found the other issue. No probs.

joropito 06-22-2012 10:51

Re: Transfer from spec or no-team
 
Try to set m_iDefaultItems (120) before PlayerSpawn
Also, as I remember, maybe there's another offset to set to update hud


All times are GMT -4. The time now is 00:29.

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