SA-MP Forums Archive
bool:char arrays in enums - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: bool:char arrays in enums (/showthread.php?tid=433228)



bool:char arrays in enums - MP2 - 26.04.2013

pawn Код:
enum E_TEST
{
    bool:boolTest[50 char]
}

new PD[E_TEST];

public OnFilterScriptInit()
{
    PD[boolTest]{0} = false; // Line from which errors originate
    return 1;
}
Quote:

warning 215: expression has no effect
error 001: expected token: ";", but found "{"
warning 215: expression has no effect
error 001: expected token: ";", but found "}"
warning 217: loose indentation
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Is is not possible to use char-arrays in enums?


Re: bool:char arrays in enums - Djole1337 - 26.04.2013

I don't think so. A while ago I've tried the same but no success.


Re: bool:char arrays in enums - Lordzy - 26.04.2013

I guess the problem is in using the wrong bracket '{'. This works fine:
pawn Код:
enum E_TEST
{
    bool:boolTest[50 char]
}

new PD[E_TEST];

public OnFilterScriptInit()
{
    PD[boolTest][0] = false;
    return 1;
}
Or, isn't it the thing you thought to?


Re: bool:char arrays in enums - MP2 - 26.04.2013

But that's not a char-array then.

pawn Код:
#include a_samp
#include generic // Some custom functions etc. I made

enum E_TEST
{
    bool:boolTest[10 char]
}

new PD[E_TEST];

public OnFilterScriptInit()
{
    PD[boolTest][0] = true;
   
    print(CharArrayToString(PD[boolTest], 10));
    return 1;
}
Should output:

1000000000

Actual output:

0001000000


It works perfectly fine when not in an enum :<


Re: bool:char arrays in enums - MP2 - 26.04.2013

I know they're not, but why does a normal array work but not a char-array? The dimensions are exactly the same?