07.04.2013, 17:26
Hi! I have tried many ways to load factions, but no one of them worked. Whats wrong with this code?
Код:
stock LoadFactions() { new kint[25]; new fetch[16]; new string[200]; new query[400]; for(new i; i < MAX_FRAKCIJU; i++) { format(query, sizeof(query), "SELECT * FROM frakcijos WHERE ID = %d", i); mysql_query(query); mysql_store_result(); if(mysql_num_rows()) if(mysql_fetch_row_format(query,"|")) { mysql_get_field( fetch, "ID" ); fData[i][fID] = strval(fetch); mysql_get_field("pavadinimas", kint); format(fData[i][fPavadinimas],40,"%s", kint); mysql_get_field("lyderis", kint); format(fData[i][fLyderis],40,"%s", kint); mysql_get_field( fetch, "x" ); fData[i][fX] = floatstr(fetch); mysql_get_field( fetch, "y" ); fData[i][fY] = floatstr(fetch); mysql_get_field( fetch, "z" ); fData[i][fZ] = floatstr(fetch); printf("Frakcija %s uћkrauta, jos lyderis %s. (%f,%f,%f)",fData[i][fPavadinimas], fData[i][fLyderis], fData[i][fX], fData[i][fY], fData[i][fZ]); format(string,400,"{CC9900}Frakcija:{FFFFFF} %s\n{CC9900}Frakcijos lyderis:{FFFFFF} %s", fData[i][fPavadinimas], fData[i][fLyderis]); fData[i][fLabel] = Create3DTextLabel(string, 0xFFFFFFFF, fData[i][fX],fData[i][fY],fData[i][fZ],8,0); fData[i][fPickup] = CreatePickup(1239, 2, fData[i][fX], fData[i][fY], fData[i][fZ], 0); } } mysql_free_result(); }