• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] How to optimize this code
#1
I have this enum that stores the information of organizations stored with mysql.

PHP Code:
enum oInfo
{
    
oID,
    
oName[50],
    
oMoney,
    
oMaterials,
    
oMaconha,
    
oCrack,
    
oCocaina,
    
oOrgVip,
    
oOrgVipTime,
    
Float:oPosX,
    
Float:oPosY,
    
Float:oPosZ,
    
Float:oPosA,
    
oInterior,
    
oWorld,
    
oSkinLider,
    
oSkinLiderF,
    
oSkinMember,
    
oSkinMember2,
    
oSkinMember3,
    
oSkinMember4,
    
oSkinMember5,
    
oSkinMemberF,
    
oSalaryLider,
    
oSalaryMember,
    
oSalaryMember2,
    
oSalaryMember3,
    
oSalaryMember4,
    
oSalaryMember5,
    
oLider[MAX_PLAYER_NAME],
    
oSubLider[MAX_PLAYER_NAME],
    
oMember1[MAX_PLAYER_NAME],
    
oMember2[MAX_PLAYER_NAME],
    
oMember3[MAX_PLAYER_NAME],
    
oMember4[MAX_PLAYER_NAME],
    
oMember5[MAX_PLAYER_NAME],
    
oMember6[MAX_PLAYER_NAME],
    
oMember7[MAX_PLAYER_NAME],
    
oMember8[MAX_PLAYER_NAME],
    
oMember9[MAX_PLAYER_NAME],
    
oMember10[MAX_PLAYER_NAME],
    
oMember11[MAX_PLAYER_NAME],
    
oMember12[MAX_PLAYER_NAME],
    
oMember13[MAX_PLAYER_NAME],
    
oMember14[MAX_PLAYER_NAME],
    
oMember15[MAX_PLAYER_NAME],
    
oMember16[MAX_PLAYER_NAME],
    
oMember17[MAX_PLAYER_NAME],
    
oMember18[MAX_PLAYER_NAME],
    
oMember19[MAX_PLAYER_NAME],
    
oMember20[MAX_PLAYER_NAME],
    
oMember21[MAX_PLAYER_NAME],
    
oMember22[MAX_PLAYER_NAME],
    
oMember23[MAX_PLAYER_NAME],
    
oMember24[MAX_PLAYER_NAME],
    
oMember25[MAX_PLAYER_NAME],
    
oMember26[MAX_PLAYER_NAME],
    
oMember27[MAX_PLAYER_NAME],
    
oMember28[MAX_PLAYER_NAME],
    
oMember29[MAX_PLAYER_NAME],
    
oMember30[MAX_PLAYER_NAME]

};
new 
OrgInfo[MAX_ORGS][oInfo]; 

There is a situation, in which I will display all the members of the organization, however as we can see there are more than 30 members and the current way in which I do this is to write the code for each member.

PHP Code:
format(stringsizeof(string), "Member 1: %s\n"OrgInfo[org][oMember1]);
strcat(membersListstring);

format(stringsizeof(string), "Member 2: %s\n"OrgInfo[org][oMember2]);
strcat(membersListstring);

.... 
30 Code Very Long

ShowPlayerDialog
(playeridDIALOG_ORG_BACKDIALOG_STYLE_TABLIST_HEADERS"Membros da Organiza??o"membersList"Voltar""Fechar"); 

I would like to know if there is any way, to access the variable of each member without having to be one by one. Perhaps with the use of some repetition loop? It's possible?
  Reply


Messages In This Thread
How to optimize this code - by RhaegarX - 2021-01-21, 08:30 PM
RE: How to optimize this code - by Pinch - 2021-01-21, 09:56 PM
RE: How to optimize this code - by RhaegarX - 2021-01-21, 11:54 PM
RE: How to optimize this code - by Markski - 2021-01-22, 08:44 PM
RE: How to optimize this code - by RhaegarX - 2021-01-23, 02:18 AM
RE: How to optimize this code - by Pinch - 2021-01-21, 11:59 PM

Forum Jump: