AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [ Help ] command at the beginning of the round (https://forums.alliedmods.net/showthread.php?t=308583)

Fuck For Fun 06-26-2018 09:19

[ Help ] command at the beginning of the round
 
What is the difference between these and what is more effective:

Code:

new bool:g_freezetime = true;

register_event( "HLTV", "EventNewRound", "a", "1=0", "2=0" );

public EventNewRound( )
{
        g_freezetime = true;
}

- >
Code:

new bool:g_freezetime = true;

register_logevent( "LogEventNewRound", 2, "1=Round_Start" );

public LogEventNewRound( )
{
        g_freezetime = false;
}

The test is like Variables, for example:
PHP Code:

    new Float:maxspeed;
    
pevclientpev_maxspeedmaxspeed );
    
    if( 
maxspeed != 1.0 )
    {
        if( !
g_freezetime )
        {
            switch( 
read_data) )
            {
                case 
CSW_SCOUT:                    maxspeed 260.0;
                case 
CSW_P90:                    maxspeed 245.0;
                case 
CSW_XM1014,CSW_AUG,CSW_GALIL,CSW_FAMAS:    maxspeed 240.0;
                case 
CSW_SG552 :                maxspeed 235.0;
                case 
CSW_M3,CSW_M4A1 :                maxspeed 230.0;
                case 
CSW_AK47 :                    maxspeed 221.0
                case 
CSW_M249 :                     maxspeed 220.0;
                case 
CSW_AWP,CSW_SG550,CSW_G3SG1 :         maxspeed 210.0;
                default :                     
maxspeed 250.0;
            }
        }
        
        
set_pevclientpev_maxspeedmaxspeed );
    } 


maqi 06-26-2018 10:12

Re: [ Help ] command at the beginning of the round
 
HLTV is actually called on round start,

Round start is called after the freeze time

^SmileY 06-26-2018 10:15

Re: [ Help ] command at the beginning of the round
 
Quote:

Originally Posted by maqi (Post 2599365)
HLTV is actually called on round start,

Round start is called after the freeze time

A bit confuse no?

HLTV event called when freezetime starts,
Round_Start is called after freezetime.

Both events will work to set user speed, but i recommend set after freezetime.
Also if server have mp_freezetime to 0 logevent will be called instantly too.

And in your example, g_freezetime do not need to be used. :crab:

Ghosted 06-27-2018 12:48

Re: [ Help ] command at the beginning of the round
 
HLTV is called before players spawn.

edon1337 06-27-2018 13:05

Re: [ Help ] command at the beginning of the round
 
Quote:

Originally Posted by Ghosted (Post 2599551)
HLTV is called before players spawn.

It's called after they spawn.

PHP Code:

#include < amxmodx >

public plugin_init( )
{
    
register_event("HLTV""OnNewRound""a" )  ;
}

public 
OnNewRound( )
{
    new 
szPlayers32 ], iNumiTempIDszName32 ];
    
get_playersszPlayersiNum );

    for( new 
iiNumi++ )
    {
        
iTempID szPlayers];
        
get_user_nameiTempIDszNamecharsmaxszName ) );
        
log_to_file"Test.txt""Player: %s %s"szNameis_user_aliveiTempID ) ? "ALIVE" "DEAD" );
    }


Quote:

L 06/27/2018 - 19:02:44: Player: DoNii ALIVE
L 06/27/2018 - 19:02:49: Player: DoNii ALIVE
L 06/27/2018 - 19:02:49: Player: [P*D]U're Dead (100) ALIVE

Ghosted 06-27-2018 13:13

Re: [ Help ] command at the beginning of the round
 
Quote:

Originally Posted by edon1337 (Post 2599554)
It's called after they spawn.

PHP Code:

#include < amxmodx >

public plugin_init( )
{
    
register_event("HLTV""OnNewRound""a" )  ;
}

public 
OnNewRound( )
{
    new 
szPlayers32 ], iNumiTempIDszName32 ];
    
get_playersszPlayersiNum );

    for( new 
iiNumi++ )
    {
        
iTempID szPlayers];
        
get_user_nameiTempIDszNamecharsmaxszName ) );
        
log_to_file"Test.txt""Player: %s %s"szNameis_user_aliveiTempID ) ? "ALIVE" "DEAD" );
    }




You don't have parameters, so this event will be called too many times and this will be OnHLTV and not OnNewRound.

[Parameters:
Code:

"1=0", "2=0"
I Meant NewRound when i was talking about HLTV event]

edon1337 06-27-2018 13:18

Re: [ Help ] command at the beginning of the round
 
Quote:

Originally Posted by Ghosted (Post 2599558)
You don't have parameters, so this event will be called too many times and this will be OnHLTV and not OnNewRound.

[Parameters:
Code:

"1=0", "2=0"
I Meant NewRound when i was talking about HLTV event]

If I put parameters it will filter out some cases, HLTV is called twice each round, once to reset all players health and once to reset all player FOV. What does the name of the function have to do with anything? It could be any name.

NewRound event doesn't exist.

Ghosted 06-27-2018 13:24

Re: [ Help ] command at the beginning of the round
 
Quote:

Originally Posted by edon1337 (Post 2599561)
If I put parameters it will filter out some cases, HLTV is called twice each round, once to reset all players health and once to reset all player FOV. What does the name of the function have to do with anything? It could be any name.

NewRound event doesn't exist.

I've tested and HLTV was before player spawn.

------------

Quote:

Originally Posted by edon1337 (Post 2599561)
NewRound event doesn't exist.

Oh, rly?

edon1337 06-27-2018 13:58

Re: [ Help ] command at the beginning of the round
 
Quote:

Originally Posted by Ghosted (Post 2599564)
I've tested and HLTV was before player spawn.

I already tested and gave you the results, why would I lie about it?

Quote:

Originally Posted by Ghosted (Post 2599564)
Oh, rly?

Yes, there's no NewRound event in this site.

Ghosted 06-27-2018 14:00

Re: [ Help ] command at the beginning of the round
 
Quote:

Originally Posted by edon1337 (Post 2599571)
I already tested and gave you the results, why would I lie about it?



Yes, there's no NewRound event in this site.

No u dont lie but when i used ur style it printed too many times => before and after spawn.


Quote:

Originally Posted by edon1337 (Post 2599571)
Yes, there's no NewRound event in this site.

Oh, rly?


All times are GMT -4. The time now is 12:25.

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