Questions Regarding coding
#1

Today, as I was watching the Tutorials, I Saw a house Tutorial and ofcourse I'm new in Scripting, So I don't know much.. I saw That After defining Max Houses and enums There Was a Line written like this
PHP код:
new HouseInfo[MAX_HOUSES][hInfo]; 
I wanna know that why have we put "Max_Houses" and "hInfo" in brackets with Houseinfo ?

PHP код:
#define MAX_HOUSES 200 
PHP код:
enum hInfo
{
    
Float:hEnterX//Entrance X. It's an float! example: 0.0000000. I'm gonna use the same with the other entrances/exits
    
Float:hEnterY
    
Float:hEnterZ,
    
Float:hExitX,
    
Float:hExitY,
    
Float:hExitZ,
    
hInsideInt//The inside interior.. DUH!
    
hInsideVir//Already subscribed above
    
hOutsideInt,
    
hOutsideVir,
    
bool:hOwned//boolean! Is house owned? NO = False, YES = True
    
hOwner[MAX_PLAYER_NAME], //The house owner! I'm gonna use MAX_PLAYER_NAME, because a player can't have a longer name :')
    
hPrice//Will store the price
    
hPickup//The pickup. This is used to remove/move the pickup icon!
    
hIcon//The map icon. Also used to remove/move it! We are going to need an ID. Without an ID we can't do NOTHING!
    
hVecModel//The housecar's model
    
Float:hVecX//X location. En float too.
    
Float:hVecY,
    
Float:hVecZ,
    
Float:hVecA
}; 
Reply
#2

They're defining the array.

Think of it like this

string[4];
That creates a "string" which has a size of 4 characters. so [][][][]. Then when we format the string to add text to it, it fills in those 4 slots with characters. So [h][e][l][p] where h is in the 0 slot, e in the 1, l 2, p 3.

Same thing for HouseInfo. It's defining the limit as 200.

HouseInfo[MAX_HOUSES][hInfo]

Since max houses is defined as 200, each house (0-200) is applied.

hInfo is the enumerator where the data is organized. You'll notice that there is variables inside of the hInfo enumerator, which each hold certain values.

HouseInfo[0-200][Any of the variables from hInfo enumerator]

Example:
HouseInfo[0][hInsideInt] = 51;

That's setting the interior ID of house ID 0 to 51.

Not sure how well I explained this, but I hope I helped. Rep+ appreciated
Reply
#3

Dude, You're Awesome.. thnx +Rep...
Reply
#4

No problem man, if you have any more questions feel free to PM me.
Reply
#5

Okay.. (^_^)
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)