14.10.2012, 09:38
Hello,
i need help,
if i load my houses i need a label for all my houses i creat befor.
now with my code it only show the last label on the datebase.
I Know i must put my "CreateDynamic3DTextLabel" into the while body but where i must put my "format(string,sizeof(string),"[ID] %d\n[BESITZER] %s\n[LEVEL] %d\n[PREIS] %d", hID, hUser, hLevel, hPrice);" than?
hope for help
i need help,
if i load my houses i need a label for all my houses i creat befor.
now with my code it only show the last label on the datebase.
Код:
stock AddHouseFromFile() { new Str[200], string[200], pTotal, hID, hUser, hLevel, Float:hEnterX, Float:hEnterY, Float:hEnterZ, Float:hExitX, Float:hExitY, Float:hExitZ, hInterior, hPrice, hVirtualWorld, hLocked; mysql_query("SELECT * FROM `House`"); mysql_store_result(); if(mysql_num_rows() > 0) { while(mysql_fetch_row(Str)) { sscanf(Str, "p<|>isiffffffiiii", hID, hUser, hLevel, hEnterX, hEnterY, hEnterZ, hExitX, hExitY, hExitZ, hInterior, hPrice, hVirtualWorld, hLocked); hID = CreateDynamicPickup(1273, 1, hEnterX, hEnterY, hEnterZ, -1, -1, -1, PICKUPDISTANCE); pTotal++; } format(string,sizeof(string),"[ID] %d\n[BESITZER] %s\n[LEVEL] %d\n[PREIS] %d", hID, hUser, hLevel, hPrice); CreateDynamic3DTextLabel(string, white, hEnterX, hEnterY, hEnterZ, 100.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, TEXTLABELDISTANCE); } mysql_free_result(); printf("--> %i Houses Loaded FromMySQL", pTotal); return 1; }
Код:
while(mysql_fetch_row(Str)) { sscanf(Str, "p<|>isiffffffiiii", hID, hUser, hLevel, hEnterX, hEnterY, hEnterZ, hExitX, hExitY, hExitZ, hInterior, hPrice, hVirtualWorld, hLocked); hID = CreateDynamicPickup(1273, 1, hEnterX, hEnterY, hEnterZ, -1, -1, -1, PICKUPDISTANCE); CreateDynamic3DTextLabel(string, white, hEnterX, hEnterY, hEnterZ, 100.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, TEXTLABELDISTANCE); pTotal++; }