Raised This Month: $12 Target: $400
 3% 

maxplayers


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Saint Sinner
Senior Member
Join Date: Feb 2016
Old 01-06-2018 , 04:18   maxplayers
Reply With Quote #1

I Have 2 players

1 Team CT
1 Team T

If i have 3 players i want to get command only for last player which comes!

But player 3 can be player 1,2

Someone can show me how to do that?

Code:
public client_PreThink(id)
{
	if(!task_exists(TASK_ID) || !is_user_alive(id)) 
	{
		g_ProtectionTime[id] = -1
		g_InTheZone[id] = false
		
		return PLUGIN_CONTINUE
	}
	
	if(!check_players(id))
	{
		g_InTheZone[id] = false
		g_ProtectionTime[id] = -1
		
		return PLUGIN_CONTINUE
	}

	if(!check_origin(id))
	{
		g_InTheZone[id] = false
		g_ProtectionTime[id] = -1
		
		return PLUGIN_CONTINUE
	}
	
	new protectionDelay = get_pcvar_num(cvar_delay)
	if(g_ProtectionTime[id] < protectionDelay)
	{
		if(g_fDelay[id] + 1.0 < get_gametime())
		{
			g_ProtectionTime[id] += 1
			g_fDelay[id] = get_gametime()
		}
		
		set_hudmessage(255, 0, 0, -1.0, -1.0, _, _, 0.5, _, _, 4)
		show_hudmessage(id, "Protection in %d...", (protectionDelay - g_ProtectionTime[id]))
	}
	else if(g_ProtectionTime[id] >= protectionDelay)
		g_InTheZone[id] = true
	
	new tmp[2], weap = get_user_weapon(id, tmp[0], tmp[1])
	if(weap != CSW_KNIFE) client_cmd(id, "weapon_knife")
            set_pev( id, pev_velocity, g_toucheR_velocity[ id ] );
            g_toucheR_velocity[ id ][ 0 ] = 0.0;
            g_toucheR_velocity[ id ][ 1 ] = 0.0;
            g_toucheR_velocity[ id ][ 2 ] = 0.0;
            velocity_by_aim( id, PLAYER_PUSH_FORCE, g_toucheR_velocity[ id ] )

	    return PLUGIN_CONTINUE
}

stock check_players()
{
	new iNum[2];
	for(new i = 1 ; i >= g_iMaxPlayers ; i++)
	{
		if(!is_user_alive(i))
			continue;
		
		if(get_user_team(i) == 1)
			++iNum[0];
		else if(get_user_team(i) == 2)
			++iNum[1];
	}
	if((iNum[0] == 1) && (iNum[1] == 1))
		return true;
	
	return false;
}

Last edited by Saint Sinner; 01-06-2018 at 06:10.
Saint Sinner is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-06-2018 , 16:30   Re: maxplayers
Reply With Quote #2

You want to get the last (most recent) player that joined the server? How does that have anything to do with "maxplayers" or the code you posted?
__________________

Last edited by fysiks; 01-06-2018 at 16:30.
fysiks is offline
Saint Sinner
Senior Member
Join Date: Feb 2016
Old 01-06-2018 , 17:57   Re: maxplayers
Reply With Quote #3

this is a original code...
https://forums.alliedmods.net/showthread.php?t=20396

player 1 and player 2 can entry in this zone succesffully

if i create a zone i want to get for example velocity_by_aim to player 3

Last edited by Saint Sinner; 01-06-2018 at 18:03.
Saint Sinner is offline
Reply


Thread Tools
Display Modes

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 17:39.


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