Best Way to Store Org Members?
#1

Hey,

I recently created an org system,that stores orginfo in an enum, and then writes the data to file using Yini.however atm i'm having issues figuring out how to store members efficiently, as i feel atm the way i'm doing it is wrong and limits functionality.

atm i'm storing all members in the org enum:
Код:
enum OrgInfo
{
oID,
    Name[40],
    Type, // 0 = Gangs, 1= Law , 2 = Mafias, 3 = Gangs 4= PB
	Color[25],
	oLeader[128],
	Skins[3],
	Members,
	Vehicles,
	MemLimit,
	VehLimit,
	Float:CP[3],
	Float:Interior[3],
	Wep[4],
	WepAmmo[4],
	oBalance,
	oWage,
	oRank1[30],
	oRank2[30],
	oRank3[30],
	oRank4[30],
	oRank5[30],
	oRank6[30],
	Member1[30],
	Member2[30],
	Member3[30],
	Member4[30],
	Member5[30],
	Member6[30],
	Member7[30],
	Member8[30],
	Member9[30],
	Member10[30],
	Member11[30],
	Member12[30],
	Member13[30],
	Member14[30],
	Member15[30],
	Member16[30],
	Member17[30],
	Member18[30],
	Member19[30],
	Member20[30],
	Member21[30],
	Member22[30],
	Member23[30],
	Member24[30],
	Member25[30],
	VehicleID[20],
	VehicleModel[20],
	Vehiclecolor1[20],
	Vehiclecolor2[20],
	Float:VehiclePosX[20],
	Float:VehiclePosY[20],
	Float:VehiclePosZ[20],
	Float:VehiclePosA[20],
	Vehicle1fuel[20]
	
}
and then these are saving to file like:

Код:
[Organization Data]
OrgID = 1
Name = The Cobras
Type = 1
Color = COLOR_BLUE
Leader = 
Skin1 = 276
Skin2 = 163
Skin3 = 279
Members = 0
Vehicles = 0
MemberLimit = 5
VehicleLimit = 10
CPX = -2669.562988
CPY = 595.637268
CPZ = 14.453125
Wep 1 = 31
Wep 1 Ammo = 1000
Wep 2 = 25
Wep 2 Ammo = 20
Wep 3 = 18
Wep 3 Ammo = 1
Wep 4 = 1
Wep 4 Ammo = 1
OrgBalance = 10000
OrgWage = 100
Member1 = 
Member2 = 
Member3 = 
Member4 = 
.
.
etc
I would however like to store the Members in an array within the enum like Members[25][30], however I've read its not possible to store an array of strings within an enum?I ideally need something similar to an array of strings, so I can later read all members into a members list. Any suggestions would be great.

I have already tried the Members[25][30] in the enum and was just met with errors.

Thanks for any advice i recieve.
Dan
Reply
#2

You'd better add a player variable like pOrg[MAX_PLAYERS], store Org id
Reply
#3

Apply different ids to different orgs,like when the first org is created on the server give it an id "0", the second one created will have id "1" and so on.And save these ids,after that make a "Members" folder in "scriptfiles" folder and make an automatic system that saves a file named "(the org's id).txt" in the "Members" folder whenever an org is created,then whenever a member joins the org,save his/her name in the specific org's file.
Reply
#4

Shinja would that allow me to create a members cmd? To show all members of the org online and offline?

K0P if I did that how would I need to then load that as an enum? In order to add, remove and retrieve all entries in the file?... It'd work though cause my org files are named after the I'd they are created under anyway. 1.ini etc

Thanks so far guys
Reply
#5

Yes ofcourse
Reply
#6

Quote:
Originally Posted by marley
Посмотреть сообщение
K0P if I did that how would I need to then load that as an enum? In order to add, remove and retrieve all entries in the file?... It'd work though cause my org files are named after the I'd they are created under anyway. 1.ini etc

This way is not for enum but a single global array:


Read the file and get the ammount of the lines,make a multi-dimensional array to store the values according to the amount of lines.

And with saperate file its easy keep tack/edit/delete/load members.

EDIT: Show the errors (if any) when you create the array.
Reply
#7

So, I get that I have a global array, that stores all the members of the orgs

so something new oMembers[oCount][30]

but for the file, do I just add the names?, Unsure how would I iterate through the file and extract the names into the global array? and when I write using YINI is it essential that I have entries:Values ? if so what would I call the entry? Apologies for all the questions, I just can't get my head around YINI, it's the thing i've always been iffy with.

Dan
Reply
#8

Quote:
Originally Posted by marley
Посмотреть сообщение
So, I get that I have a global array, that stores all the members of the orgs

so something new oMembers[oCount][30]

but for the file, do I just add the names?, Unsure how would I iterate through the file and extract the names into the global array? and when I write using YINI is it essential that I have entries:Values ? if so what would I call the entry? Apologies for all the questions, I just can't get my head around YINI, it's the thing i've always been iffy with.

Dan
It will be better if every player/account in the server has an account id,so you have to save the player ids in the org members file.And the loading will be easy.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)