AlliedModders

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

.MMYTH. 01-03-2011 09:51

Efficient index string
 
I want know wath is more efficient:

PHP Code:

new vip[33

or
PHP Code:

new g_maxplayers

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
g_maxplayers get_maxplayers()
}

new 
vip[g_maxplayers


Arkshine 01-03-2011 09:57

Re: Efficient index string
 
Damn, learn to test yourself and you will see you can't use a non-constant value to be used in an array declaration.

xakintosh 01-03-2011 10:21

Re: Efficient index string
 
Maybe
Code:
#include <amxmodx> #define MAX_PLAYERS 32 new g_maxplayers[MAX_PLAYERS] public plugin_init() {     register_plugin("x","x","x") }

.MMYTH. 01-03-2011 10:46

Re: Efficient index string
 
PHP Code:

#define MAX_PLAYERS 32 

to
PHP Code:

#define MAX_PLAYERS 33 


ConnorMcLeod 01-03-2011 10:54

Re: Efficient index string
 
For readability, better to let
#define MAX_PLAYERS 32

Either you do :
new g_iVariable[ MAX_PLAYERS + 1 ]

or you do
new g_iVariable[ 33 ]


P.S. : Please don't release a vip plugin.

.MMYTH. 01-03-2011 11:03

Re: Efficient index string
 
no, here has a lot of vip plugin, and I don't like to do this kind...
it's only a example, I headed than that 33 is the valve ghost

I don't know if is true, but I believe.

ConnorMcLeod 01-03-2011 12:16

Re: Efficient index string
 
Suggestion : stay in Multilingual forum
I'm not good at english, but yours is horrible.


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

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