bool:char arrays in enums
#1

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?
Reply
#2

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

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?
Reply
#4

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 :<
Reply
#5

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


Forum Jump:


Users browsing this thread: 1 Guest(s)