array problem
#1

pawn Code:
enum arenaDB
{
HitRec[35],
HitRecName[35]
};
I want to assign HitRecName to a player name, and doing HitRecName[35][20] doesn't work.The first slot is meant for a weapon id and second would be a string for a player's name, I've done something like this similar but not in enum. Anyone knows why it gives me an error if i add [20]? Or is there another way?
Reply
#2

number's are not use on enum ... You can keep using it with out numbers But in cmd you will use as it's own named function.
Reply
#3

Show, how did you declared array for enum.
Reply
#4

If the first var in the enum is an ID, why is it a string?

Do this:

pawn Code:
enum arenaDB // name the enum
{
   HitRec, // add a variable to store weapon ID's (numerical values)
   HitRecName[MAX_PLAYER_NAME] // add a string var to store a player's name
};

new arenaInfo[MAX_PLAYERS][arenaDB]; // create the variable you can use the enum with

// so, you can use it by doing arenaInfo[playerid][HitRec] or arenaInfo[playerid][HitRecName]
Reply
#5

Im storing the records made by players of specific arena's which are declared as ID'S. In each arena you can make a Hit record with a weapon which I do HitRec[35], 35 is the 0-34 weapon id's. And I want to store the name for the record. Storing the name like this: HitRecName[MAX_PLAYER_NAME] won't do, because each weapon id will have a different record holder.
Reply
#6

Quote:
Originally Posted by EV007
View Post
Im storing the records made by players of specific arena's which are declared as ID'S. In each arena you can make a Hit record with a weapon which I do HitRec[35], 35 is the 0-34 weapon id's. And I want to store the name for the record. Storing the name like this: HitRecName[MAX_PLAYER_NAME] won't do, because each weapon id will have a different record holder.
You mean.. (?)
pawn Code:
ArenaInfo[arena_id][weaponid] = "Player_Name";
Reply
#7

Isn't there a simpler way? Cause i'd have to define every weaponid in the enum then and afterwards make checks of what weapon id the record was made and eventually establish the needed string's value..
Reply
#8

So..

pawn Code:
Arena[arena_id][HitRecordName] = Player_Name;
Arena[arena_id(same as above)][HitRecordWeaponID] = weapon_id
Reply
#9

..... Like I said, this way, only one recorder will be possible because it will overwrite the name when someone makes record with the DIFFERENT weapon.
Quote:

I want to store the name for the record. Storing the name like this: HitRecName[MAX_PLAYER_NAME] won't do, because each weapon id will have a different record holder.

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)