Dynamic Org
#1

I have dyanmic org system but I have one problem.

Here is enum
PHP код:
enum orgInfo
{
    
oID,
    
oName[32],
    
oLeader[25],
    
Float:oExitX,
    
Float:oExitY,
    
Float:oExitZ,
    
Float:oIntX,
    
Float:oIntY,
    
Float:oIntZ,
    
oMember1[25],
    
oMember2[25],
    
oMember3[25],
    
oMember4[25],
    
oMember5[25],
    
oMember6[25],
    
oMember7[25],
    
oMember8[25],
    
oMember9[25],
    
oMember10[25],
    
oSef,
    
oMoney,
    
oDrugs,
    
Float:oSefX,
    
Float:oSefY,
    
Float:oSefZ,
     
oInt,
    
oVW,
    
boolorgExist,

that bool is there so I can check if org exist.. I set it to true when I load orgs and when I create orgs.
PHP код:
CMD:orgname(playeridparams[])
{
    if(
PlayerInfo[playerid][Admin] < 5)
    
/*
                 blah blah blah
        */
    
if(OrgInfo[org][orgExist])
    {
        
ERROR(playerid"ID does not exist");
        return 
1;
    } 
It says that ID does not exist even if it exist.. any ideas??
Reply
#2

You don't seem to have fully grasped the concept of "dynamic" yet seeing that each org has a static maximum member count of 10. I don't know what saving system you're using so I'm not going to expand on what the best way to do it might be.

The problem at hand is you simply having your logic backwards: you're returning an error when the value is true.
Reply
#3

As Vince said, you have it backwards. The way you currently have it is your checking if the value is positive and if it is show error message.

Код:
if(!OrgInfo[org][orgExist]) // put a '!' to check for the value being negative.
{ 
	ERROR(playerid, "ID does not exist"); 
	return 1; 
}
As for your Enum, I would suggest taking a look at a few more threads on arrays / enums.

Tutorial on Arrays & Enums: Link
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)