11.03.2012, 17:28
pawn Код:
public OnQueryFinish( query[], resultid, extraid, connectionHandle ) {
if(resultid == 1) {
mysql_store_result(sqlconnection);
new resultline[128], data[14][128];
while(mysql_fetch_row_format(resultline,"|"))
{
if(mysql_num_rows(sqlconnection) == 0) continue;
new hid = strval(data[0]);
split(resultline, data, '|');
printf("Loading House id %d", hid);
HouseData[hid][EntrancePos][0] = floatstr(data[1]);
HouseData[hid][EntrancePos][1] = floatstr(data[2]);
HouseData[hid][EntrancePos][2] = floatstr(data[3]);
HouseData[hid][hInterior] = strval(data[4]);
HouseData[hid][ExitPos][0] = floatstr(data[5]);
HouseData[hid][ExitPos][1] = floatstr(data[6]);
HouseData[hid][ExitPos][2] = floatstr(data[7]);
HouseData[hid][hPrice] = strval(data[8]);
format(HouseData[hid][Owner], MAX_PLAYER_NAME, data[9]);
HouseData[hid][Locked] = strval(data[10]);
format(HouseData[hid][Description], MAX_PLAYER_NAME,data[11]);
HouseData[hid][Owned] = strval(data[12]);
HouseData[hid][HouseStructure][0] = CreatePickup(1273,1,HouseData[hid][EntrancePos][0], HouseData[hid][EntrancePos][1], HouseData[hid][EntrancePos][2],-1);
if(HouseData[hid][Owned] == 1)
{
new string[256];
houselab = Create3DTextLabel("house",-1,HouseData[hid][EntrancePos][0],HouseData[hid][EntrancePos][1],HouseData[hid][EntrancePos][2],10, 0, 1);
format(string,sizeof(string),"House Owned By ||| %s |||",HouseData[hid][Owner]);
Update3DTextLabelText(houselab,COLOR_RED,string);
}
if(HouseData[hid][Owned] == 0)
{
new string[256];
houselab = Create3DTextLabel("house",-1,HouseData[hid][EntrancePos][0],HouseData[hid][EntrancePos][1],HouseData[hid][EntrancePos][2],10, 0, 1);
format(string,sizeof(string),"House Isn't Owned\nPrice:%d\nDescription:%s",HouseData[hid][hPrice],HouseData[hid][Description]);
Update3DTextLabelText(houselab,COLOR_GREEN,string);
}
new eid[8][128];
new hids = strval(eid[0]);
//split(resultline, data, '|');
printf("Loading Entrance id %d", hids);
EntranceData[hids][EntrancePos][0] = floatstr(eid[1]);
EntranceData[hids][EntrancePos][1] = floatstr(eid[2]);
EntranceData[hids][EntrancePos][2] = floatstr(eid[3]);
EntranceData[hids][hInterior] = strval(eid[4]);
EntranceData[hids][ExitPos][0] = floatstr(eid[5]);
EntranceData[hids][ExitPos][1] = floatstr(eid[6]);
EntranceData[hids][ExitPos][2] = floatstr(eid[7]);
EntranceData[hids][HouseStructure][0] = CreateDynamicPickup(1314,1,EntranceData[hids][EntrancePos][0], EntranceData[hids][EntrancePos][1], EntranceData[hids][EntrancePos][2],-1);
Create3DTextLabel("Press [F] To Enter The Building ",-1,EntranceData[hids][EntrancePos][0],EntranceData[hids][EntrancePos][1],EntranceData[hids][EntrancePos][2],10, 0, 1);
}
}
}
Код:
[21:23:55] Loading House id 0 [21:23:55] Loading Entrance id 0 [21:23:55] Loading House id 1 [21:23:55] Loading Entrance id 0 [21:23:55] Loading House id 2 [21:23:55] Loading Entrance id 0 [21:23:55] Loading House id 4 [21:23:55] Loading Entrance id 0 [21:23:55] Loading House id 3 [21:23:55] Loading Entrance id 0 [21:23:55] Loading House id 99 [21:23:55] Loading Entrance id 0
Код:
[21:23:55] Loading House id 0 [21:23:55] Loading House id 1 [21:23:55] Loading House id 2 [21:23:55] Loading House id 4 [21:23:55] Loading House id 3 [21:23:55] Loading House id 99 [21:23:55] Loading Entrance id 0