Raised This Month: $ Target: $400
 0% 

Transfer from spec or no-team


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
doondook
Member
Join Date: Dec 2010
Old 05-12-2012 , 01:41   Transfer from spec or no-team
Reply With Quote #1

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?
doondook is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 05-12-2012 , 04:22   Re: Transfer from spec or no-team
Reply With Quote #2

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.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.

Last edited by hornet; 05-12-2012 at 04:22.
hornet is offline
doondook
Member
Join Date: Dec 2010
Old 05-12-2012 , 06:16   Re: Transfer from spec or no-team
Reply With Quote #3

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.
doondook is offline
Old 05-16-2012, 04:07
doondook
This message has been deleted by Exolent[jNr]. Reason: Don't bump until 2 weeks have passed since last post.
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 05-16-2012 , 11:11   Re: Transfer from spec or no-team
Reply With Quote #5

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 );

__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
doondook
Member
Join Date: Dec 2010
Old 05-16-2012 , 16:42   Re: Transfer from spec or no-team
Reply With Quote #6

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.

Last edited by doondook; 05-17-2012 at 12:34. Reason: EDIT: post below ( just forgot (: )
doondook is offline
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 05-16-2012 , 18:08   Re: Transfer from spec or no-team
Reply With Quote #7

ExecuteHam(Ham_CS_RoundRespawn, id) is actually spawning the Player, you rather delay that instead of adding nonsens to the plugin
__________________
Quote:
#define true ((rand() % 2)? true: false) //Happy debugging suckers
mottzi is offline
Send a message via MSN to mottzi
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 05-16-2012 , 21:30   Re: Transfer from spec or no-team
Reply With Quote #8

Quote:
Originally Posted by mottzi View Post
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.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 06-22-2012 , 10:51   Re: Transfer from spec or no-team
Reply With Quote #9

Try to set m_iDefaultItems (120) before PlayerSpawn
Also, as I remember, maybe there's another offset to set to update hud
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.
joropito is offline
Send a message via MSN to joropito
Reply



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:29.


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