AlliedModders

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

GhostMan 07-10-2012 06:19

round start
 
PHP Code:

        register_event("HLTV""event_round_start""a""1=0""2=0")
    
register_logevent("round_start"2"0=World triggered""1=Round_Start")
    
register_logevent("round_start"2"0=World triggered""1=Game_Commencing")
    
register_logevent("round_start"2"0=World triggered""1&Restart_Round_"

whats the difference between all those "round start" events?

<VeCo> 07-10-2012 06:25

Re: round start
 
You can see the last arguments:
1. Called on round start (after freezetime)
2. Called on "Game Commencing" (when the game restarts after a second player enters the server)
3. Called on round restarting (sv_restart/sv_restartround)

They can all be set in only one native call:
PHP Code:

register_logevent("round_start"2"0=World triggered""1=Round_Start","1=Game_Commencing","1&Restart_Round_"


GhostMan 07-10-2012 06:39

Re: round start
 
Okay, then whats the difference between those 3 you mentioned and this one?

register_event("HLTV", "event_round_start", "a", "1=0", "2=0")

<VeCo> 07-10-2012 06:45

Re: round start
 
This one is called on round start BEFORE freezetime.

GhostMan 07-10-2012 07:41

Re: round start
 
If im doing team_count
PHP Code:

public team_count() {
    
g_TeamAlive[CS_TEAM_UNASSIGNED] = 0
    g_TeamAlive
[CS_TEAM_T] = 0
    g_TeamAlive
[CS_TEAM_CT] = 0
    g_TeamAlive
[CS_TEAM_SPECTATOR] = 0
    
for(new 1<= g_max_clientsi++)
        if(
is_user_connected(i))
            if(
is_user_alive(i))
                
g_TeamAlive[cs_get_user_team(i)]++


So i guess its better to do it on round start like this

register_logevent("round_start", 2, "0=World triggered", "1=Round_Start","1=Game_Commencing","1&Restart_Round_")

<VeCo> 07-10-2012 08:41

Re: round start
 
You can use get_players native for better work.

hornet 07-10-2012 10:56

Re: round start
 
Quote:

Originally Posted by GhostMan (Post 1747287)
So i guess its better to do it on round start like this

Good choice. The player's won't have spawned on HLTV Event.

This is better, and don't forget that unassigned players and spectators are not alive.
Code:
new iPlayers[ 32 ]; get_players( iPlayers, g_TeamAlive[ CS_TEAM_CT ], "aeh", "CT" ); get_players( iPlayers, g_TeamAlive[ CS_TEAM_T ], "aeh", "TERRORIST" );

GhostMan 07-10-2012 11:31

Re: round start
 
Okay, so now im useing this team_count to get know when theres 2 alive t's left so that /box function would be available.

PHP Code:

public cmd_box(id) {
    if(
is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_CT) {    
        if(
g_TeamAlive[CS_TEAM_T] <= get_pcvar_num(gp_BoxMax) && g_TeamAlive[CS_TEAM_T] > && !g_BoxStarted) {
            static 
i
            
for(1<= g_max_clientsi++)
                if(
is_user_alive(i) && cs_get_user_team(i) == CS_TEAM_T)
                    
set_user_health(i100)

            
boxon true
            set_cvar_num
("mp_tkpunish"0)
            
set_cvar_num("mp_friendlyfire"1)
            
            
g_BoxStarted true
            
            set_hudmessage
(025500.080.2422.06.00.050.22)
            new 
name[33]; get_user_name(idnamecharsmax(name))
            
ShowSyncHudMsg(0g_HudSync"Priziuretojas %s Ijunge BOKSO rezima!"name)
        }
        else {
            
set_hudmessage(255000.080.2422.06.00.050.22)
            
ShowSyncHudMsg(idg_HudSync"Ijungti BOKSO rezimo dabar negalima!")
        }
    }
    return 
PLUGIN_HANDLED
}

public 
team_count() {
    
g_TeamAlive[CS_TEAM_UNASSIGNED] = 0
    g_TeamAlive
[CS_TEAM_T] = 0
    g_TeamAlive
[CS_TEAM_CT] = 0
    g_TeamAlive
[CS_TEAM_SPECTATOR] = 0
    
for(new 1<= g_max_clientsi++)
        if(
is_user_connected(i))
            if(
is_user_alive(i))
                
g_TeamAlive[cs_get_user_team(i)]++


I run team_count when round start, player disconnect and on DeathMsg. But you saind, that i can delete all that team_count stuff and to just like that?

PHP Code:

public cmd_box(id) {

    new 
iPlayers32 ];

    if(
is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_CT) {    

        
get_playersiPlayersg_TeamAliveCS_TEAM_T ], "aeh""TERRORIST" );

        if(
g_TeamAlive[CS_TEAM_T] <= get_pcvar_num(gp_BoxMax) && g_TeamAlive[CS_TEAM_T] > && !g_BoxStarted) {
            static 
i
            
for(1<= g_max_clientsi++)
                if(
is_user_alive(i) && cs_get_user_team(i) == CS_TEAM_T)
                    
set_user_health(i100)

            
boxon true
            set_cvar_num
("mp_tkpunish"0)
            
set_cvar_num("mp_friendlyfire"1)
            
            
g_BoxStarted true
            
            set_hudmessage
(025500.080.2422.06.00.050.22)
            new 
name[33]; get_user_name(idnamecharsmax(name))
            
ShowSyncHudMsg(0g_HudSync"Priziuretojas %s Ijunge BOKSO rezima!"name)
        }
        else {
            
set_hudmessage(255000.080.2422.06.00.050.22)
            
ShowSyncHudMsg(idg_HudSync"Ijungti BOKSO rezimo dabar negalima!")
        }
    }
    return 
PLUGIN_HANDLED




All times are GMT -4. The time now is 15:22.

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