function LoadHouses() { new casee=0; new idx,string[256]; mysql_query("SELECT * FROM `houses`"); mysql_store_result(); while(mysql_retrieve_row()) { idx++; mysql_fetch_field_row(string, "ID"); HouseInfo[idx][hID] = strval(string); mysql_fetch_field_row(string, "Entrancex"); HouseInfo[idx][hEntrancex] = floatstr(string); mysql_fetch_field_row(string, "Entrancey"); HouseInfo[idx][hEntrancey] = floatstr(string); mysql_fetch_field_row(string, "Entrancez"); HouseInfo[idx][hEntrancez] = floatstr(string); mysql_fetch_field_row(string, "Exitx"); HouseInfo[idx][hExitx] = floatstr(string); mysql_fetch_field_row(string, "Exity"); HouseInfo[idx][hExity] = floatstr(string); mysql_fetch_field_row(string, "Exitz"); HouseInfo[idx][hExitz] = floatstr(string); mysql_fetch_field_row(string, "Healthx"); HouseInfo[idx][hHealthx] = strval(string); mysql_fetch_field_row(string, "Healthy"); HouseInfo[idx][hHealthy] = strval(string); mysql_fetch_field_row(string, "Healthz"); HouseInfo[idx][hHealthz] = strval(string); mysql_fetch_field_row(string, "Armourx"); HouseInfo[idx][hArmourx] = strval(string); mysql_fetch_field_row(string, "Armoury"); HouseInfo[idx][hArmoury] = strval(string); mysql_fetch_field_row(string, "Armourz"); HouseInfo[idx][hArmourz] = strval(string); mysql_fetch_field_row(string, "Owner"); strmid(HouseInfo[idx][hOwner], string, 0, strlen(string), 255); mysql_fetch_field_row(string, "Discription"); strmid(HouseInfo[idx][hDiscription], string, 0, strlen(string), 255); mysql_fetch_field_row(string, "Value"); HouseInfo[idx][hValue] = strval(string); mysql_fetch_field_row(string, "Hel"); HouseInfo[idx][hHel] = strval(string); mysql_fetch_field_row(string, "Arm"); HouseInfo[idx][hArm] = strval(string); mysql_fetch_field_row(string, "Int"); HouseInfo[idx][hInt] = strval(string); mysql_fetch_field_row(string, "Lock"); HouseInfo[idx][hLock] = strval(string); mysql_fetch_field_row(string, "Owned"); HouseInfo[idx][hOwned] = strval(string); mysql_fetch_field_row(string, "Rooms"); HouseInfo[idx][hRooms] = strval(string); mysql_fetch_field_row(string, "Rent"); HouseInfo[idx][hRent] = strval(string); mysql_fetch_field_row(string, "Rentabil"); HouseInfo[idx][hRentabil] = strval(string); mysql_fetch_field_row(string, "Takings"); HouseInfo[idx][hTakings] = strval(string); mysql_fetch_field_row(string, "Vec"); HouseInfo[idx][hVec] = strval(string); if(HouseInfo[idx][hVec] == 457) { HouseInfo[idx][hVec] = 411; } mysql_fetch_field_row(string, "Vcol1"); HouseInfo[idx][hVcol1] = strval(string); mysql_fetch_field_row(string, "Vcol2"); HouseInfo[idx][hVcol2] = strval(string); mysql_fetch_field_row(string, "Date"); HouseInfo[idx][hDate] = strval(string); mysql_fetch_field_row(string, "Level"); HouseInfo[idx][hLevel] = strval(string); mysql_fetch_field_row(string, "World"); HouseInfo[idx][hWorld] = strval(string); mysql_fetch_field_row(string, "Drugs"); HouseInfo[idx][hDrugs] = strval(string); mysql_fetch_field_row(string, "Materials"); HouseInfo[idx][hMaterials] = strval(string); casee++; } mysql_free_result(); printf("-Houses: %d", casee); return 1; }
use BLUEg MySQL the fastest in the biz otherwise create variable when only already made houses are created
|
Use threads and caching. Don't use fetch_field_row. String searches are always (a lot?) slower than integer searches.
|
or just use files. Much faster and MySQL is a bit overkill on SA:MP anyways, because unless you have multiple servers, you don't need the house information to be on MySQL. MySQL is in my opinion only good for communicating between the server and a website, and i don't think that you have to have house information on a website.
|