Raised This Month: $32 Target: $400
 8% 

Dynamic array issue


Post New Thread Reply   
 
Thread Tools Display Modes
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 07-10-2012 , 00:45   Re: Dynamic array issue
Reply With Quote #11

Alright. Thanks for your quality help
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-10-2012 , 01:02   Re: Dynamic array issue
Reply With Quote #12

If you preferred the old fashioned way:
PHP Code:
#pragma dynamic 55000 

//GetStringPos( Entity index (0 to NumEntities-1) , String to retrieve )
#define GetStringPos(%1,%2)    (%1*(NumItems * MaxLength)+%2)

public Test()
{
    const 
NumEntities 100;
    const 
NumItems 16;
    const 
MaxLength 32;
    const 
DataSize NumEntities NumItems MaxLength;

    
enum (+=32)
    {
        
String1,
        
String2,
        
String3
        
/* ... */
    
}
    
    new 
szStringsDataSize ];
    
    
//Entity 1
    
copyszStringsGetStringPosString1 ) ] , MaxLength "Entity 1 string 1" );
    
copyszStringsGetStringPosString2 ) ] , MaxLength "Entity 1 string 2" );
    
copyszStringsGetStringPosString3 ) ] , MaxLength "Entity 1 string 3" );
    
server_printszStringsGetStringPosString1 ) ] );
    
server_printszStringsGetStringPosString2 ) ] );
    
server_printszStringsGetStringPosString3 ) ] );
    
    
//Entity 2
    
copyszStringsGetStringPosString1 ) ] , MaxLength "Entity 2 string 1" );
    
copyszStringsGetStringPosString2 ) ] , MaxLength "Entity 2 string 2" );
    
copyszStringsGetStringPosString3 ) ] , MaxLength "Entity 2 string 3" );
    
server_printszStringsGetStringPosString1 ) ] );
    
server_printszStringsGetStringPosString2 ) ] );
    
server_printszStringsGetStringPosString3 ) ] );    

__________________

Last edited by Bugsy; 07-10-2012 at 01:04.
Bugsy is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-10-2012 , 01:56   Re: Dynamic array issue
Reply With Quote #13

I'm a bit perplex on what you are doing and on the use of dynamic array since you seems to have lot of pre-defined things.
Could you put a concrete example on what you are doing ?
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-10-2012 , 09:17   Re: Dynamic array issue
Reply With Quote #14

Are you talking to me or hornet?
__________________
Bugsy is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 07-10-2012 , 11:05   Re: Dynamic array issue
Reply With Quote #15

Quote:
Originally Posted by ConnorMcLeod View Post
I'm a bit perplex on what you are doing and on the use of dynamic array since you seems to have lot of pre-defined things.
Could you put a concrete example on what you are doing ?
If your asking me sir, then yes my example was probably bad to have predefined strings to insert. I was hoping that - that part was not going be looked at too much.

Quote:
Originally Posted by Bugsy View Post
Are you talking to me or hornet?
And to answer to both, exactly what I'm after is the first solution that Bugsy gave me ( but thanks for the second one aswell ). It works flawlessly! Cheers.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet 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 17:01.


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