AlliedModders

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

Ax3l 08-15-2012 11:31

Efficient Scripting
 
According to this : http://forums.alliedmods.net/showthread.php?t=88792

This is the right mode to script , right : ?

Code:

new Bot[ 33 ];
new Connected[ 33 ];
new Alive[ 33 ];

public plugin_init( )
{
        register_plugin( " " , " " , " " );
       
        RegisterHam( Ham_Spawn , "player" , "fw_PlayerSpawn" , 1 );
}

public client_putinserver( iPlayer )
{
        if( is_user_bot( iPlayer ) )
        {
                Bot[ iPlayer ] = true;
        }
       
        else if( is_user_connected( iPlayer ) )
        {
                Connected[ iPlayer ] = true;
        }
}

public fw_PlayerSpawn( iPlayer )
{
        if( is_user_alive( iPlayer ) )
        {
                Alive[ iPlayer ] = true;
        }
}

I just want to know ... :)

lucas_7_94 08-15-2012 11:52

Re: Efficient Scripting
 
Its efficient , yes , but only you evade some calls to module , nothing more.

Exolent[jNr] 08-15-2012 11:53

Re: Efficient Scripting
 
Quote:

Originally Posted by Ax3l (Post 1772094)
Code:

public client_putinserver( iPlayer )
{
        if( is_user_connected( iPlayer ) )


Makes no sense. How can the user not be connected but in the server?

ConnorMcLeod 08-15-2012 12:29

Re: Efficient Scripting
 
Don't cache alive status, can be messed up by some plugins.
I wouldn't cache connected status either.


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

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