01.02.2012, 11:54
I have a problem! I made a House system and now we do not want to load the house! Store house goes through sqlite
Код:
stock SQLLoadStanSystem(DB:db) { new reload[256],string[256]; new red = 0; new DBResult:rezultat = db_query(db, "SELECT * FROM `stan`"); red = db_num_rows(rezultat); printf("Broj Stanova u bazi : %d",red); if(red != 0) { for(new i = 0; i < red; i++) { if(red >= 0 && red <= sizeof(StanStats)) { db_get_field_assoc(rezultat, "string", string, sizeof(string)); strmid(reload,string,0,256,256); new data2[2][128]; sscanf(reload, "p<,>d\ ffffff\ s[24]s[64]\ ddddddddddd", StanStats[i][StanSlot], StanStats[i][StanUlaz][0],StanStats[i][StanUlaz][1],StanStats[i][StanUlaz][2], StanStats[i][StanIzlaz][0],StanStats[i][StanIzlaz][1],StanStats[i][StanIzlaz][2], data2[0],data2[1], StanStats[i][StanCjena],StanStats[i][StanLock],StanStats[i][StanKupljen], StanStats[i][StanInt],StanStats[i][StanVWorld],StanStats[i][StanRent], StanStats[i][StanLevel],StanStats[i][StanHealthUp],StanStats[i][StanArmorUp], StanStats[i][StanOrmarUp],StanStats[i][StanOrmar]); strmid(StanStats[i][StanVlasnik], data2[0], 0, strlen(data2[0]), 128); strmid(StanStats[i][StanOpis], data2[1], 0, strlen(data2[1]), 128); if(StanStats[i][StanSlot] == 1){BrojStanova++;} db_next_row(rezultat); } } }else{print("SQL STAN: Nema stanova u bazi!");} db_free_result(rezultat); return 1; }
Код:
stock MakeStanFnc(playerid,interior,cjena,Float:X,Float:Y,Float:Z) { for(new i = 0; i < sizeof(StanStats); i++ ) { if(StanStats[i][StanSlot] == 0) { new string[128]; BrojStanova++; StanStats[i][StanSlot] = 1; StanStats[i][StanUlaz][0] = X; StanStats[i][StanUlaz][1] = Y; StanStats[i][StanUlaz][2] = Z; StanStats[i][StanIzlaz][0] = aUlazi[interior][0]; StanStats[i][StanIzlaz][1] = aUlazi[interior][1]; StanStats[i][StanIzlaz][2] = aUlazi[interior][2]; StanStats[i][StanCjena] = cjena; strmid(StanStats[i][StanVlasnik], "Nitko", 0, strlen("Nitko"), 999); strmid(StanStats[i][StanOpis], OpisKuca_Stanova[interior], 0, strlen(OpisKuca_Stanova[interior]), 255); StanStats[i][StanLock] = 0; StanStats[i][StanKupljen] = 0; StanStats[i][StanVWorld] = 500+BrojStanova; StanStats[i][StanLevel] = 5; StanStats[i][StanInt] = aIntovi[interior][0]; format(string, sizeof(string), "[XDRIVE]:Opis: %s ,ID stana: %d , Cjena stana:%d $ , Level: %d", OpisKuca_Stanova[interior], BrojStanova, cjena, StanStats[i][StanLevel]); SCM(playerid, COLOR_LIGHTRED, string); SQLUpdateStanSystem(GlavnaBaza,i); break; } } return 0; }