Raised This Month: $ Target: $400
 0% 

[HELP] Ham_CS_RoundRespawn bug


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Lightokun
Member
Join Date: Oct 2009
Old 12-30-2010 , 12:43   [HELP] Ham_CS_RoundRespawn bug
Reply With Quote #1

So, a have latest war3ft on my linux server.
Sometimes(randomly) when i buy scroll of respawning, player is transfered to team_spectator (team 3).
The part of code:
Code:
public _SHARED_Spawn( id )
{
	id -= TASK_SPAWN;
	
	if(id < 1 && id > MAXPLAYERS)
		return;
	
	// Respawning isn't necessary w/CSDM - so lets not do that!
	if ( CVAR_csdm_active > 0 && get_pcvar_num( CVAR_csdm_active ) == 1 )
	{
		return;
	}

	// User is no longer connected or is not on a team
	if ( !p_data_b[id][PB_ISCONNECTED] )
	{
		SHARED_SetUserMoney( id, SHARED_GetUserMoney( id ) + ITEM_Cost( id, ITEM_SCROLL ) );
		return;
	}
	
	if( !SHARED_IsOnTeam( id ) ) {
		client_print( id, print_chat, "%s Unable to respawn because of the bug", g_MODclient );
		SHARED_SetUserMoney( id, SHARED_GetUserMoney( id ) + ITEM_Cost( id, ITEM_SCROLL ) );
		return;
	}
	
	if ( is_user_alive( id ) )
	{
		return;
	}

	// Round has ended, lets give money back if they bought a scroll
	if ( g_EndRound )
	{
		if ( p_data[id][P_RESPAWNBY] == RESPAWN_ITEM )
		{
			client_print( id, print_chat, "%s Unable to respawn because the round is over, here is your money back", g_MODclient );

			SHARED_SetUserMoney( id, SHARED_GetUserMoney( id ) + ITEM_Cost( id, ITEM_SCROLL ) );
		}

		return;
	}

	// Reset items when the user spawns!
	g_iShopMenuItems[id][ITEM_SLOT_ONE]	= ITEM_NONE;
	g_iShopMenuItems[id][ITEM_SLOT_TWO] = ITEM_NONE;

	// Give the user godmode for a little
	//set_user_godmode( id, 1 );
	p_data_b[id][PB_NO_DAMAGE] = true;

	// Save their previous weapons!
	SHARED_CopySavedWeapons( id );

	// Ignore the armor settaging...
	bIgnoreArmorSet[id] = true;

	// We don't want to call a crap-ton of WC3 functions when we're spawning them 3 times do we ?
	bIgnorePlayerSpawning[id] = true;

	// Spawn the player
	ExecuteHamB(Ham_CS_RoundRespawn,id);
	
	p_data_b[id][PB_SLOWED]		= false;
	p_data_b[id][PB_STUNNED]	= false;
	p_data_b[id][PB_GIVEITEMS]	= true;
	
	// Reset the user's skin to normal
	SHARED_ChangeSkin( id, SKIN_RESET );

	// The user should no longer be a mole!
	p_data_b[id][PB_MOLE] = false;

	set_task( 0.2, "_SHARED_Spawn_Final", TASK_SPAWNPLAYER + id );
	set_task( 0.4, "_SHARED_CS_GiveWeapons", TASK_GIVEITEMS + id );
	set_task( 1.0, "_SHARED_SpawnRemoveGod", TASK_SPAWNREMOVEGOD + id );

	return;
}
I did a lot of checks. So, when i'm dead my team is CT or T and it's normal. But when Ham_CS_RoundRespawn executed sometimes player transfered to spectator team. I put the client_print stuff like:
Code:
client_print(id, print_chat, "%d",cs_get_user_team(id));
ExecuteHamB(Ham_CS_RoundRespawn,id);
client_print(id, print_chat, "%d",cs_get_user_team(id));
And it shows:
2
3
And i'm transfered to spec team.
Sometimes it works well. So, what's the reason for this and if there exists another way to respawn player with correct team?
So, i'm thinking of writing my own module or fixing ham for respawn. Can anyone tell me where to find part of code where Ham_CS_RoundRespawn respawns a player?
__________________

Last edited by Lightokun; 12-30-2010 at 12:59.
Lightokun 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 02:07.


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