Storing seperate data for each player
#1

Im making something like mission system, and i want to make every mission for each player different.

I dont want to use enum like,

pMission1
pMission2
pMission3.... and so on, i hope there is better way.

I tried to make something like

new Mission1[MAX_PLAYERS];
but later it mix with other players

can i make something to store for each player for example 20 missions and later to add more, but not to put in for example PlayerInfo who have enum like

pCash
pMoney... but seperate one, for each player. Not to mix. I hope you understand. Thank you
Reply
#2

Something like so? I'm not sure if missions or player have to be first but anyway, I have to code for a while.
Still, I think this is what you are looking for.

PHP код:
#define MAX_MISSIONS 10
enum missions
{
    
pCash,
    
pShit
};
new
    
mInfo[MAX_MISSIONS][MAX_PLAYERS][missions]

Reply
#3

Код:
mInfo[MAX_MISSIONS][MAX_PLAYERS][missions]
Talk about over thinking the problem
Reply
#4

I have enum for player stats for example

pLevel,
pCash
...


Now i want to make for example 20 missions for each player but is there any other way for creating it, not under this player enum but new one pMission1, pMission2...?
Reply
#5

Well, creating them like pMission1[MAX_PLAYERS]; is just fine, if its mixing up then you are probably not clearing the variable after being used? I mean, clearing them when their mission fails, when they complete the mission or when they connect to the server.

I'd still go with enum rather than this.
Reply
#6

Can i create new enum for 20 Missions for each player. To have:

Player enum:
pLevel,
pCash
....


And new enum missions
pMission01,
pMission02
...
For each seperate player?
Reply
#7

Yes, i have player's account data in one enum and mission data in other. It goes like this for me;

Код:
enum E_PLAYERDATA
{
	data1,
	data2
}
new pInfo[MAX_PLAYERS][E_PLAYERDATA];
Код:
enum E_MISSIONDATA
{
      data1,
      data2
}
new g_MissionInfo[MAX_PLAYERS][E_MISSIONDATA];
I don't see any problems creating separate enums for separate kind of data.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)