Raised This Month: $ Target: $400
 0% 

Array Problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ProIcons
Senior Member
Join Date: Jan 2009
Location: Greece - Salonica
Old 04-20-2012 , 13:32   Array Problem
Reply With Quote #1

I created an array

PHP Code:
enum Substatus Status,Time };
new 
g_activesub[32][Substatus]; 
And i want to set the status of a sub of a user example.

g_activesub[ProIcons][Status]="Searching..." ...

i tried to achieve that with

g_activesub[ret_getuser_id(id)][Status]=status;
g_activesub[user][Status]=status;
format(g_activesub[ret_getuser_id(id)][Status],31,"%s",status);
copy(g_activesub[ret_getuser_id(id)][Status],31,status);

but anyway i allready knew that they wouldn't gonna work. but i just test them, any idea? how can i do it...
__________________
function rb return $regsubex($$1-,/(.)/g,$+($chr(2) $+ $chr(3),$r(2,15),$chr(2),\1))
ProIcons is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 04-20-2012 , 13:38   Re: Array Problem
Reply With Quote #2

PHP Code:
enum /* Steps */
{
  
STEP_READING 1STEP_WATCHINGSTEPS_COUNT
};

new 
g_iStepsSTEPS_COUNT ];

enum /* Statuses */
{
  
STATUS_IDLE 1STATUS_ACTIVESTATUSES_COUNT
};

new 
g_sPlayersStatuses33 /* MAX_PLAYERS */ ][ STATUSES_COUNT ][ 32 /* Maximum characters in string */ ];

/* Now you'll be able to do this: */

formatexg_sPlayersStatusesiPlayer ][ STATUS_IDLE ], 31"%s""Staying inactived" );
formatexg_sPlayersStatusesiPlayer ][ STATUS_ACTIVE ], 31"%s""Doing something" ); 
And about this, please check function formatex to see the diference between format and formatex.

Quote:
Originally Posted by ProIcons View Post
format(g_activesub[ret_getuser_id(id)][Status],31,"%s",status);

Last edited by claudiuhks; 04-20-2012 at 13:48.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
Old 04-20-2012, 13:42
BadJoke
This message has been deleted by asherkin. Reason: Spam.
ProIcons
Senior Member
Join Date: Jan 2009
Location: Greece - Salonica
Old 04-20-2012 , 13:42   Re: Array Problem
Reply With Quote #3

Not sure if i can follow you... what exactly different did you make?
__________________
function rb return $regsubex($$1-,/(.)/g,$+($chr(2) $+ $chr(3),$r(2,15),$chr(2),\1))
ProIcons is offline
ProIcons
Senior Member
Join Date: Jan 2009
Location: Greece - Salonica
Old 04-20-2012 , 13:48   Re: Array Problem
Reply With Quote #4

PHP Code:
enum Substatus 
    
Status,Time 
};
new 
g_activesub[32][Substatus];

else if (
is(text,".sub")) {
    if (
g_administrate == 0) {
        new 
user[32]
        
getuser_id(user,id);
        if (!
istok(g_subqueue,user,32)) {
            
format(g_subqueue,strlen(g_subqueue),"%s %s",g_subqueue,user);
            
msg("[Sub][%s] You are now on the queue list of Subs.",user);
            
msg("[Sub][%s] Queue Position (%d/%d).",user,findtok(g_subqueue,user,32),numtok(g_subqueue,32));
            if (
findtok(g_subqueue,user,32) == 1) {
                new 
status[32];
                
format(status,31,"Searching...");
                
formatex(g_activesub[user][Status],31,"%s",status);
                
//sub
            
}
        }
        else { 
msg("[Sub][%s] You are allready on the Sub Queue. Please Wait...",user); }
    }

I just asked how can i set that array...

Edit: the edit shit make me like an idiot, like i'm writing by my self. stop doing that. Thanks.
__________________
function rb return $regsubex($$1-,/(.)/g,$+($chr(2) $+ $chr(3),$r(2,15),$chr(2),\1))

Last edited by ProIcons; 04-20-2012 at 14:00.
ProIcons is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 04-20-2012 , 13:51   Re: Array Problem
Reply With Quote #5

You are unable to format a variable with one cell. You need at least, a variable with two cells.

PHP Code:
new g_iDecimal;
formatg_iDecimal31"%s""?????????????" ); // NONONONO

new g_cChar32 ];
formatg_cChar31"%s""!!!!!!!!!!!!!!!!" ); 
PHP Code:
new g_iDecimal32 ];
formatg_iDecimal15 ], 31"%s""?????????????" ); // NONONONO

new g_cChar32 ][ 32 ];
formatg_cChar15 ], 31"%s""!!!!!!!!!!!!!!!!" ); 

Last edited by claudiuhks; 04-20-2012 at 13:54.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
ProIcons
Senior Member
Join Date: Jan 2009
Location: Greece - Salonica
Old 04-20-2012 , 13:54   Re: Array Problem
Reply With Quote #6

PHP Code:
enum Substatus 
    
Status,Time 
};
new 
g_activesub[32][Substatus][32];
formatex(g_activesub[user][Status],31,"%s","Searching..."); 
(724) : error 033: array must be indexed (variable "user")
__________________
function rb return $regsubex($$1-,/(.)/g,$+($chr(2) $+ $chr(3),$r(2,15),$chr(2),\1))

Last edited by ProIcons; 04-20-2012 at 13:55.
ProIcons is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 04-20-2012 , 13:55   Re: Array Problem
Reply With Quote #7

Don't you see the difference!?

Replace

PHP Code:
new g_activesub[32][Substatus]; 
PHP Code:
new g_activesub[32][Substatus][32]; 
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
ProIcons
Senior Member
Join Date: Jan 2009
Location: Greece - Salonica
Old 04-20-2012 , 13:56   Re: Array Problem
Reply With Quote #8

I have replace it maybe?

The error is on array "user" says that is Un-indexed

PHP Code:
new user[32]
                
getuser_id(user,id); 
__________________
function rb return $regsubex($$1-,/(.)/g,$+($chr(2) $+ $chr(3),$r(2,15),$chr(2),\1))

Last edited by ProIcons; 04-20-2012 at 13:57.
ProIcons is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 04-20-2012 , 13:59   Re: Array Problem
Reply With Quote #9

PHP Code:
new g_cChar33 ][ 32 ];
new 
iClient;

formatexg_cChariClient ], 31"%s""Is staying" );

new 
cClient32 ];

formatexg_cCharcClient ], 31"%s""Is staying" ); // NONONONO 
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
ProIcons
Senior Member
Join Date: Jan 2009
Location: Greece - Salonica
Old 04-20-2012 , 14:01   Re: Array Problem
Reply With Quote #10

thats the way i would wanted with String, but its ok i thing. i will do it with IDs, thats the answer i was seeking all this time.
__________________
function rb return $regsubex($$1-,/(.)/g,$+($chr(2) $+ $chr(3),$r(2,15),$chr(2),\1))
ProIcons 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 07:50.


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