08.11.2014, 20:02
Quote:
You can't allocate IDs, just store them. When you create a pickup for a house, remember the ID it returns and compare that instead.
|
Код:
stock LoadHouses() { new Str[255], hID, Float:intX, Float:intY, Float:intZ, Float:exitX, Float:exitY, Float:exitZ, hOwner[24], hWorld, hPrice, hIntID, hLocked; mysql_query("SELECT * FROM `houses`"); mysql_store_result(); new haI = 1; if(mysql_num_rows() > 0) { while(mysql_fetch_row(Str)) { sscanf(Str, "p<|>iffffffs[24]iiii", hID, intX, intY, intZ, exitX, exitY, exitZ, hOwner, hWorld, hPrice, hIntID, hLocked); HousePickup[hID] = CreatePickup(1273, 1, exitX, exitY, exitZ); iHos[haI][haID] = haI; iHos[haI][haIntX] = intX; iHos[haI][haIntY] = intY; iHos[haI][haIntZ] = intZ; iHos[haI][haExitX] = exitX; iHos[haI][haExitY] = exitY; iHos[haI][haExitZ] = exitZ; iHos[haI][haIntID] = hIntID; iHos[haI][haPrice] = hPrice; iHos[haI][haLocked] = hLocked; iHos[haI][haWorld] = hWorld; format(iHos[haI][haOwner], 24, "%s", hOwner); haI++; hTotal++; } } mysql_free_result(); printf("** %i\t<->\tHouses Loaded from\t<->\tMySQL\t\t **", hTotal); new FormatBuffer[255]; format(FormatBuffer,sizeof(FormatBuffer),"ID: %i", HousePickup[hID]); print(FormatBuffer); return 1; }