AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   maxplayers (https://forums.alliedmods.net/showthread.php?t=304152)

Saint Sinner 01-06-2018 04:18

maxplayers
 
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;
}


fysiks 01-06-2018 16:30

Re: maxplayers
 
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?

Saint Sinner 01-06-2018 17:57

Re: maxplayers
 
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


All times are GMT -4. The time now is 09:30.

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