Symbolic subscript arrays, tags
#1

Why don't they work in sa-mp?

pawn Code:
new EX_g_Map[bool: .init,.name{32},bool: .cache];
EX_g_Map[.init] = true;
The above code goes highwire and spits a couple errors. I wonder why?

Also: Is there a way to create your own tags? Since it doesn't seem to work for me trying constants at least.

pawn Code:
const Map: {init=0,name[32],cache};
The above doesn't work either. So yeah, is it possible to define your own tags or will you have to depend on #defines?

Thanks for the answers, couldn't really find much on it.
Reply
#2

i dont know the answer to the first question sorry but for the second.



yes it is just add it in front of the var / function



pawn Code:
//no tag
new VarWithoutTag;

stock SomeFunc(Arg)
{




}


//with custom tag
new MyTag:VarWithTag;

stock MyTag:SomeFunc(MyTag:Arg)
{




}


//

const Map:init=0,Map:name[32],Map:cache;

but note they are still all integers!
Reply
#3

Hey,

thanks for your answer but I am afraid that what you show me for a tag is just not good enough for my needs. I could obviously use an enumerator to get what I want done though I'd of preferred to achieve a typedef sort of thing with the tags.

Though the first one is still open for question because that could also solve my problems. Could someone tell me why they do not work? Any help on that would be appreciated.
Reply
#4

What exactly do you want to use the tags for?
Reply
#5

Quote:
Originally Posted by Y_Less
View Post
I believe the way you are trying to do that is from the very recent PAWN 4.0 language. SA-MP still uses PAWN 3.0 which is different in several places, I hope this is mainly for compatibility. In fact technically SA-MP uses a custom version of 3.0, for the full documentation on the exact version used, see this topic:

https://sampforum.blast.hk/showthread.php?tid=289258
Ah, alright.

That solves the whole thing, too bad though I was really looking forward to making that work the way it looks :P

Regards.
Reply
#6

Quote:
Originally Posted by Y_Less
View Post
You can still do everything you posted, just very slightly differently, mainly using enum. It seems PAWN 4.0 split the two main uses of enum up in to two different systems (I'm not an expert on that version though):

pawn Code:
enum E_G_MAP
{
    bool:init,
    name[32],
    bool:cache
}
new EX_g_Map[E_G_MAP];
EX_g_Map[init] = true;

enum Map
{
    init=0,
    name[32],
    cache
}
Obviously you can't use both of those at once as "init" etc are defined twice (with two different tags).
Quote:
Originally Posted by Extremo
View Post
Hey,

thanks for your answer but I am afraid that what you show me for a tag is just not good enough for my needs. I could obviously use an enumerator to get what I want done though I'd of preferred to achieve a typedef sort of thing with the tags.

Though the first one is still open for question because that could also solve my problems. Could someone tell me why they do not work? Any help on that would be appreciated.
Thanks a lot Y_Less. I know I could have but I was actually more or less intriguid by the inline enumerator thing haha. Obviously it's not like sa-mp needs it in anyway since everything I stated can already be done I was just interested to know why exactly they don't work.

Thanks a lot =).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)