04.04.2013, 17:37
Hello once more,
Still working on this Dynamic system and I have noticed that there was lag when it came to where the doors were placed. Now I brain stormed and determined it was an issue with a loop which created more than 1 door. More like 100 per one location (lol).
I went ahead and put a printf where the function to load doors were created and found it loaded every single door, even though only three were made:
Here is where the loop is:
and the function to spawn the doors:
Any ideas?
Still working on this Dynamic system and I have noticed that there was lag when it came to where the doors were placed. Now I brain stormed and determined it was an issue with a loop which created more than 1 door. More like 100 per one location (lol).
I went ahead and put a printf where the function to load doors were created and found it loaded every single door, even though only three were made:
Код:
[13:59:49] Door_0 Loaded [13:59:49] Door_1 Loaded [13:59:49] Door_2 Loaded [13:59:49] Door_3 Loaded [13:59:49] Door_4 Loaded [13:59:49] Door_5 Loaded [13:59:49] Door_6 Loaded [13:59:49] Door_7 Loaded [13:59:50] Door_8 Loaded [13:59:50] Door_9 Loaded [13:59:50] Door_10 Loaded [13:59:50] Door_11 Loaded [13:59:50] Door_12 Loaded [13:59:50] Door_13 Loaded [13:59:50] Door_14 Loaded [13:59:50] Door_15 Loaded [13:59:50] Door_16 Loaded [13:59:50] Door_17 Loaded [13:59:50] Door_18 Loaded [13:59:50] Door_19 Loaded [13:59:50] Door_20 Loaded [13:59:50] Door_21 Loaded [13:59:50] Door_22 Loaded [13:59:50] Door_23 Loaded [13:59:50] Door_24 Loaded [13:59:50] Door_25 Loaded [13:59:50] Door_26 Loaded [13:59:50] Door_27 Loaded [13:59:50] Door_28 Loaded [13:59:50] Door_29 Loaded [13:59:50] Door_30 Loaded [13:59:50] Door_31 Loaded [13:59:50] Door_32 Loaded [13:59:50] Door_33 Loaded [13:59:50] Door_34 Loaded [13:59:50] Door_35 Loaded [13:59:50] Door_36 Loaded [13:59:50] Door_37 Loaded [13:59:50] Door_38 Loaded [13:59:50] Door_39 Loaded [13:59:50] Door_40 Loaded [13:59:50] Door_41 Loaded [13:59:50] Door_42 Loaded [13:59:50] Door_43 Loaded [13:59:50] Door_44 Loaded [13:59:50] Door_45 Loaded [13:59:50] Door_46 Loaded [13:59:50] Door_47 Loaded [13:59:50] Door_48 Loaded [13:59:50] Door_49 Loaded [13:59:50] Door_50 Loaded [13:59:50] Door_51 Loaded [13:59:50] Door_52 Loaded [13:59:50] Door_53 Loaded [13:59:50] Door_54 Loaded [13:59:50] Door_55 Loaded [13:59:50] Door_56 Loaded [13:59:50] Door_57 Loaded [13:59:50] Door_58 Loaded [13:59:50] Door_59 Loaded [13:59:51] Door_60 Loaded [13:59:51] Door_61 Loaded [13:59:51] Door_62 Loaded [13:59:51] Door_63 Loaded [13:59:51] Door_64 Loaded [13:59:51] Door_65 Loaded [13:59:51] Door_66 Loaded [13:59:51] Door_67 Loaded [13:59:51] Door_68 Loaded [13:59:51] Door_69 Loaded [13:59:51] Door_70 Loaded [13:59:51] Door_71 Loaded [13:59:51] Door_72 Loaded [13:59:51] Door_73 Loaded [13:59:51] Door_74 Loaded [13:59:51] Door_75 Loaded [13:59:51] Door_76 Loaded [13:59:51] Door_77 Loaded [13:59:51] Door_78 Loaded [13:59:51] Door_79 Loaded [13:59:51] Door_80 Loaded [13:59:51] Door_81 Loaded [13:59:51] Door_82 Loaded [13:59:51] Door_83 Loaded [13:59:51] Door_84 Loaded [13:59:51] Door_85 Loaded [13:59:51] Door_86 Loaded [13:59:51] Door_87 Loaded [13:59:51] Door_88 Loaded [13:59:51] Door_89 Loaded [13:59:51] Door_90 Loaded [13:59:51] Door_91 Loaded [13:59:51] Door_92 Loaded [13:59:51] Door_93 Loaded [13:59:51] Door_94 Loaded [13:59:51] Door_95 Loaded [13:59:51] Door_96 Loaded [13:59:51] Door_97 Loaded [13:59:51] Door_98 Loaded [13:59:51] Door_99 Loaded
Here is where the loop is:
pawn Код:
for(new d=0;d<MAX_DOORS;d++)
{
new string[128];
format(string, sizeof(string),"Door_%d Loaded",d);
printf(string);
Door_Spawn(d);
}
and the function to spawn the doors:
pawn Код:
stock Door_Spawn(id)
{
DestroyDynamicPickup(DoorData[dCount][dPickup]);
new query[300], savingstring[20];
format(query, sizeof(query), "SELECT * FROM DDoors");
Iter_Add(Doors, Iter_Count(Doors)+1);
dCount = Iter_Count(Doors);
mysql_query(query);
mysql_store_result();
while(mysql_fetch_row_format(query,"|"))
{
mysql_fetch_field_row(savingstring, "dID"); DoorData[id][dID] = strval(savingstring);
mysql_fetch_field_row(savingstring, "Pickup"); DoorData[id][dPickup] = strval(savingstring);
mysql_fetch_field_row(savingstring, "ExteriorInt"); DoorData[id][dExteriorInt] = strval(savingstring);
mysql_fetch_field_row(savingstring, "ExteriorVW"); DoorData[id][dExteriorVW] = strval(savingstring);
mysql_fetch_field_row(savingstring, "InteriorInt"); DoorData[id][dInteriorInt] = strval(savingstring);
mysql_fetch_field_row(savingstring, "InteriorVW"); DoorData[id][dInteriorVW] = strval(savingstring);
mysql_fetch_field_row(savingstring, "InteriorX"); DoorData[id][dInteriorX] = floatstr(savingstring);
mysql_fetch_field_row(savingstring, "InteriorY"); DoorData[id][dInteriorY] = floatstr(savingstring);
mysql_fetch_field_row(savingstring, "InteriorZ"); DoorData[id][dInteriorZ] = floatstr(savingstring);
mysql_fetch_field_row(savingstring, "ExteriorX"); DoorData[id][dExteriorX] = floatstr(savingstring);
mysql_fetch_field_row(savingstring, "ExteriorY"); DoorData[id][dExteriorY] = floatstr(savingstring);
mysql_fetch_field_row(savingstring, "ExteriorZ"); DoorData[id][dExteriorZ] = floatstr(savingstring);
mysql_fetch_field_row(savingstring, "InteriorA"); DoorData[id][dInteriorA] = floatstr(savingstring);
mysql_fetch_field_row(savingstring, "ExteriorA"); DoorData[id][dExteriorA] = floatstr(savingstring);
mysql_fetch_field_row(savingstring,"DName"); format(DoorData[id][dName],sizeof(savingstring),savingstring);
new string[128];
format(string, sizeof(string), "%s\nDoor ID: %d",DoorData[id][dName],DoorData[id][dID]);
CreateDynamic3DTextLabel(string, COLOR_YELLOW, DoorData[id][dExteriorX], DoorData[id][dExteriorY], DoorData[id][dExteriorZ]+1,10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, DoorData[id][dExteriorVW], DoorData[id][dExteriorInt], -1);
Itter_Add(Doors, Iter_Count(Doors) + 1);
DoorData[dCount][dPickup] = CreateDynamicPickup(1318, 1, DoorData[dCount][dExteriorX], DoorData[dCount][dExteriorY], DoorData[dCount][dExteriorZ], DoorData[dCount][dExteriorVW], DoorData[dCount][dExteriorInt], -1, 50.0);
}
mysql_free_result();
return 1;
}
Any ideas?