Raised This Month: $ Target: $400
 0% 

Efficient index string


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
.MMYTH.
BANNED
Join Date: Sep 2010
Location: Brasil - RS
Old 01-03-2011 , 09:51   Efficient index string
Reply With Quote #1

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
.MMYTH. is offline
Send a message via MSN to .MMYTH.
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-03-2011 , 09:57   Re: Efficient index string
Reply With Quote #2

Damn, learn to test yourself and you will see you can't use a non-constant value to be used in an array declaration.
__________________
Arkshine is offline
xakintosh
I run no-steam servers!
Join Date: Feb 2010
Location: Edge of nowhere
Old 01-03-2011 , 10:21   Re: Efficient index string
Reply With Quote #3

Maybe
Code:
#include <amxmodx> #define MAX_PLAYERS 32 new g_maxplayers[MAX_PLAYERS] public plugin_init() {     register_plugin("x","x","x") }
__________________
As soon as possible.
xakintosh is offline
Send a message via Yahoo to xakintosh Send a message via Skype™ to xakintosh
.MMYTH.
BANNED
Join Date: Sep 2010
Location: Brasil - RS
Old 01-03-2011 , 10:46   Re: Efficient index string
Reply With Quote #4

PHP Code:
#define MAX_PLAYERS 32 
to
PHP Code:
#define MAX_PLAYERS 33 
.MMYTH. is offline
Send a message via MSN to .MMYTH.
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-03-2011 , 10:54   Re: Efficient index string
Reply With Quote #5

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.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
.MMYTH.
BANNED
Join Date: Sep 2010
Location: Brasil - RS
Old 01-03-2011 , 11:03   Re: Efficient index string
Reply With Quote #6

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.
.MMYTH. is offline
Send a message via MSN to .MMYTH.
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-03-2011 , 12:16   Re: Efficient index string
Reply With Quote #7

Suggestion : stay in Multilingual forum
I'm not good at english, but yours is horrible.
__________________
- 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 02:12.


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