PDA

View Full Version : Custom array keys


Hunter-Digital
05-02-2008, 01:24
I knew how to do this but forgot :oops: something like:
new array[3]
array["test"] = "something"
array["anotherthing"] = "..."
etc...

Alka
05-02-2008, 03:46
enum ArrayEnum {

SET1 = 0,
SET2,
SET3
}

new Array[ArrayEnum];

Array[SET1] = "lol"
Array[SET2] = "Hum...what is this?"
Array[SET3] = "somehting else"
And to asing a value to array you can use format[ex].

Hunter-Digital
05-02-2008, 04:18
Uhm...
enum nodearray {
ID,
ENT,
HP,
TEAM,
UC
}
new node[nodearray]

node[ID] = 0
node[ENT] = 0
node[HP] = 0
node[TEAM] = 0
node[UC] = 0

and... the result:
error 010: invalid function or declaration

at the line with node[ID] = 0

:|

Same warning does for your exact code too :(

Alka
05-02-2008, 04:37
No, mine and yours works fine, but you must asign a value into a func

Eg.

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plugin"
#define VERSION "1.0"
#define AUTHOR "Alka"

enum nodearray {
ID,
ENT,
HP,
TEAM,
UC
}
new node[nodearray];

public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR);

node[ID] = 0;
node[ENT] = 0;
node[HP] = 0;
node[TEAM] = 0;
node[UC] = 0;
}

Hunter-Digital
05-02-2008, 04:40
ooooooooooohhhhhhhh :lol: ok, thanks :P