Raised This Month: $ Target: $400
 0% 

Double Array - Manual Defining


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 01-13-2007 , 17:11   Double Array - Manual Defining
Reply With Quote #1

I'm trying to create a double array and define the values manually.

Code:
new CONFIG_CVARS[6][32] = {     "configs" => "config.ini",     "users" => "users.ini" }

Does not work. I believe that is the way I could do it in PHP, but what is the correct format to do this in PAWN?
__________________

mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
Salepate
Junior Member
Join Date: Jan 2007
Old 01-13-2007 , 18:16   Re: Double Array - Manual Defining
Reply With Quote #2

If it does not work, then pawn does not support string arrays.
Salepate is offline
dutchmeat
Senior Member
Join Date: Sep 2006
Old 01-13-2007 , 18:17   Re: Double Array - Manual Defining
Reply With Quote #3

use [ small ] tags...

try this: (not tested)

Code:
#define MAXSTRING 3 CONFIG_CVARS[MAXSTRING]{"config.ini","users.ini"} new config = CONFIG_CVARS[0] new users = CONFIG_CVARS[1]
__________________
before you criticize someone, you should walk a mile in their shoes. that way, when you criticize them, you're a mile away and you have their shoes.

Last edited by dutchmeat; 01-13-2007 at 18:20.
dutchmeat is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 01-13-2007 , 18:23   Re: Double Array - Manual Defining
Reply With Quote #4

Code:
 #define MAX_STRINGS 2
 new const CONFIG_CVARS[MAX_STRINGS][32] = 
 {
	"config.ini", "users.ini"
 }
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 01-13-2007 , 18:50   Re: Double Array - Manual Defining
Reply With Quote #5

May be I need a triple array for this.

I want to place "users" in row 1, cell 0, I want to place "users.ini" in row 1 cell 1.

You all eliminated what I tried to do in the code :-\.
__________________

mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 01-13-2007 , 19:12   Re: Double Array - Manual Defining
Reply With Quote #6

Code:
new array[][][] = {     { "config", "configs.ini" },     { "users", "users.ini" } }

Last edited by [ --<-@ ] Black Rose; 01-13-2007 at 19:16.
[ --<-@ ] Black Rose is offline
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 01-13-2007 , 19:19   Re: Double Array - Manual Defining
Reply With Quote #7

Quote:
Originally Posted by [ --<-@ ] Black Rose View Post
Code:
new array[][][] = {     { "config", "configs.ini" },     { "users", "users.ini" } }
Ah, thank you very much .
__________________

mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
lamamba
Junior Member
Join Date: Oct 2006
Old 02-26-2007 , 20:35   Re: Double Array - Manual Defining
Reply With Quote #8

Quote:
Originally Posted by [ --<-@ ] Black Rose View Post
Code:
     new array[][][] = { { "config", "configs.ini" }, 
{ "users", "users.ini" } }
hi
how loop through this kind of arrays without exact sizes (how check end of every dimension or how find out size of this) ? thx

Last edited by lamamba; 02-26-2007 at 20:39.
lamamba is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 01-13-2007 , 23:38   Re: Double Array - Manual Defining
Reply With Quote #9

For the record, they're referred to a 2D-arrays (2 dimensional).
__________________
Brad is offline
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 02-27-2007 , 03:40   Re: Double Array - Manual Defining
Reply With Quote #10

@lamamba
use the sizeof parameter

@goku
http://forums.alliedmods.net/showthread.php?t=26634
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
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:20.


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