Raised This Month: $ Target: $400
 0% 

Efficient Scripting


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ax3l
Member
Join Date: Nov 2009
Old 08-15-2012 , 11:31   Efficient Scripting
Reply With Quote #1

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 ...
__________________
Ax3l is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 08-15-2012 , 11:52   Re: Efficient Scripting
Reply With Quote #2

Its efficient , yes , but only you evade some calls to module , nothing more.
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-15-2012 , 11:53   Re: Efficient Scripting
Reply With Quote #3

Quote:
Originally Posted by Ax3l View Post
Code:
public client_putinserver( iPlayer )
{
	if( is_user_connected( iPlayer ) )
Makes no sense. How can the user not be connected but in the server?
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-15-2012 , 12:29   Re: Efficient Scripting
Reply With Quote #4

Don't cache alive status, can be messed up by some plugins.
I wouldn't cache connected status either.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Reply



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 22:10.


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