Raised This Month: $ Target: $400
 0% 

Variable already declared?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PreDominance
Member
Join Date: Jul 2014
Old 08-08-2014 , 12:02   Re: Variable already declared?
Reply With Quote #1

Here's the full function.
PHP Code:
transferToArray(name[], value[], numbool:consistent)
{
    static 
i;
    if (
strfind(name"name") != -1copy(RACE_NAMES[num], 19value);
    else if (
strfind(name"author") != -1)            copy(RACE_AUTHORS[num], 19value);
    else if (
strfind(name"required_level") != -1RACE_REQ_LEVEL[num] = str_to_num(value);
    else if (
strfind(name"maximum_level") != -1)    RACE_MAX_LEVEL[num] = str_to_num(value);
    else if (
strfind(name"teamlimit") != -1)         RACE_TEAM_LIMIT[num] = str_to_num(value);
    else if (
strfind(name"numberofskills") != -1RACE_NUM_SKILLS[num] = str_to_num(value);
    else if (
strfind(name"allow_only") != -1) {
        new 
arrIds[RACE_MAX_PRIVATE_ID][35], i;
        
util_explodeString(arrIdsRACE_MAX_PRIVATE_ID34value'|');
        for (
0RACE_MAX_PRIVATE_IDi++) RACE_ALLOW_ONLY[num][i] = arrIds[i];}
    else if (
strfind(name"numberoflevels") != -1) {
        if (
consistent) {
            for (
0RACE_MAXSKILLSi++) RACE_SKILL_LEVELS[num][i] = str_to_num(value);
        } else {
            new 
arrIds[RACE_MAXSKILLS][3];
            
util_explodeString(arrIdsRACE_MAXSKILLS2value'|');
            for (
0RACE_MAXSKILLSi++) RACE_SKILL_LEVELS[num][i] = str_to_num(arrIds[i]);
        }
    } else if (
strfind(name"skillnames") != -1) {
        new 
arrIds[RACE_MAXSKILLS][20]; //<-- Why is this ok?
        
util_explodeString(arrIdsRACE_MAXSKILLS19value'|');
        for (
0RACE_MAXSKILLSi++) RACE_SKILL_NAMES[num][i] = arrIds[i];
    } else if (
strfind(name"skilldesc") != -1) {
        new 
arrIds[RACE_MAXSKILLS][50]; //<-- Line 79, error.
        
util_explodeString(arrIdsRACE_MAXSKILLS49value'|');
        for (
0RACE_MAXSKILLSi++) RACE_SKILL_INFO[num][i] = arrIds[i];
    } else if (
strfind(name"skillreqlevel") != -1) {
        new 
arrIds[RACE_MAXSKILLS][3];
        
util_explodeString(arrIdsRACE_MAXSKILLS2value'|');
        for (
0RACE_MAXSKILLSi++) RACE_SKILL_REQ_LEVEL[num][i] = str_to_num(arrIds[i]);
    }

My thought process is that if I'd already declared arrIds[] elsewhere in the code, the line right above 79 wouldn't work right.

*Edit
Bad indenting on here. Picture might be easier to read.

Last edited by PreDominance; 08-08-2014 at 12:16.
PreDominance 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 12:58.


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