Jump to content
  • 0

[Ajutor] Creare tabel in baza de date


TheRive

Question

Vreau sa creez un tabel in baza de date pentru niste apartamente , am incercat dar nu a functionat.

Daca ma puteti ajuta.

 

function load_apartaments() {
	new
	    x,
	    result[32],
	    apartaments,
		Cache: db = mysql_query(SQL, "SELECT * FROM `apartaments` ORDER BY `apartaments`.`ID` ASC");

 	for(new i, j = cache_get_row_count (); i != j; ++i) {
       	cache_get_field_content(i, "ID", result); 			x = strval(result);
		cache_get_field_content(i, "X", result); 			apartamentInfo[x][apPos][0] = floatstr(result);
		cache_get_field_content(i, "Y", result); 			apartamentInfo[x][apPos][1] = floatstr(result);
		cache_get_field_content(i, "Z", result); 			apartamentInfo[x][apPos][2] = floatstr(result);
		cache_get_field_content(i, "Angle", result); 		apartamentInfo[x][apPos][3] = floatstr(result);
        cache_get_field_content(i, "UserID", result); 		apartamentInfo[x][apUser] = strval(result);
        cache_get_field_content(i, "Value", result); 		apartamentInfo[x][apValue] = strval(result);
        cache_get_field_content(i, "Lock", result); 		apartamentInfo[x][apLock] = strval(result);
        
        cache_get_field_content(i, "Owner", result); 		format(apartamentInfo[x][apOwner], 32, result);
        apartaments ++;
        
        apartamentInfo[x][apLabel] = CreateDynamic3DTextLabel("", -1, apartamentInfo[x][apPos][0], apartamentInfo[x][apPos][1], apartamentInfo[x][apPos][2], 25, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, 0, -1, -1, 100.0);
        refresh_label(x);
	}
	cache_delete(db);


    CreateDynamicMapIcon(apartamentInfo[0][apPos][0], apartamentInfo[0][apPos][1], apartamentInfo[0][apPos][2],31,0,0,0,-1,500.0);    
   	CreateDynamicMapIcon(apartamentInfo[1][apPos][0], apartamentInfo[1][apPos][1], apartamentInfo[1][apPos][2],31,0,0,0,-1,500.0);    

        
	for(new i = 0; i < 24; i++)
		apartament_door_status[i] = 0;

 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0
Acum 10 ore, TheRive a spus:

Vreau sa creez un tabel in baza de date pentru niste apartamente , am incercat dar nu a functionat.

Daca ma puteti ajuta.

 


function load_apartaments() {
	new
	    x,
	    result[32],
	    apartaments,
		Cache: db = mysql_query(SQL, "SELECT * FROM `apartaments` ORDER BY `apartaments`.`ID` ASC");

 	for(new i, j = cache_get_row_count (); i != j; ++i) {
       	cache_get_field_content(i, "ID", result); 			x = strval(result);
		cache_get_field_content(i, "X", result); 			apartamentInfo[x][apPos][0] = floatstr(result);
		cache_get_field_content(i, "Y", result); 			apartamentInfo[x][apPos][1] = floatstr(result);
		cache_get_field_content(i, "Z", result); 			apartamentInfo[x][apPos][2] = floatstr(result);
		cache_get_field_content(i, "Angle", result); 		apartamentInfo[x][apPos][3] = floatstr(result);
        cache_get_field_content(i, "UserID", result); 		apartamentInfo[x][apUser] = strval(result);
        cache_get_field_content(i, "Value", result); 		apartamentInfo[x][apValue] = strval(result);
        cache_get_field_content(i, "Lock", result); 		apartamentInfo[x][apLock] = strval(result);
        
        cache_get_field_content(i, "Owner", result); 		format(apartamentInfo[x][apOwner], 32, result);
        apartaments ++;
        
        apartamentInfo[x][apLabel] = CreateDynamic3DTextLabel("", -1, apartamentInfo[x][apPos][0], apartamentInfo[x][apPos][1], apartamentInfo[x][apPos][2], 25, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, 0, -1, -1, 100.0);
        refresh_label(x);
	}
	cache_delete(db);


    CreateDynamicMapIcon(apartamentInfo[0][apPos][0], apartamentInfo[0][apPos][1], apartamentInfo[0][apPos][2],31,0,0,0,-1,500.0);    
   	CreateDynamicMapIcon(apartamentInfo[1][apPos][0], apartamentInfo[1][apPos][1], apartamentInfo[1][apPos][2],31,0,0,0,-1,500.0);    

        
	for(new i = 0; i < 24; i++)
		apartament_door_status[i] = 0;

 

tabel-ul cu tot cu apartamente

apartaments.sql

YouTube : Click

Discord : CosminAK47#8524

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.