21.11.2017, 16:51
Код:
stock SaveGangLocker(id) { new string[1024]; format(string, sizeof(string), "UPDATE `ganglockers` SET \ `PosX`=%f, \ `PosY`=%f, \ `PosZ`=%f, \ `VW`=%d, \ `Int`=%d, \ `Type`=%d, \ `Family`=%d WHERE `id`=%d", GangLockers[id][glockerPosX], GangLockers[id][glockerPosY], GangLockers[id][glockerPosZ], GangLockers[id][glockerVW], GangLockers[id][glockerInt], GangLockers[id][glockerType], GangLockers[id][glockerFamily], id+1 ); mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD); }
Код:
stock SaveGangLockers() { for(new i = 0; i < MAX_GANGLOCKER; i++) { SaveGangLocker(i); } return 1; } stock RehashGangLocker(id) { DestroyDynamic3DTextLabel(GangLockers[id][glockerTextID]); GangLockers[id][glockerSQLId] = 1; GangLockers[id][glockerPosX] = 0.0; GangLockers[id][glockerPosY] = 0.0; GangLockers[id][glockerPosZ] = 0.0; GangLockers[id][glockerVW] = 0; GangLockers[id][glockerInt] = 0; GangLockers[id][glockerType] = 0; GangLockers[id][glockerFamily] = 0; LoadGangLocker(id); } stock RehashGangLockers() { printf("[RehashGangLockers] Deleting Gang Lockers from server..."); for(new i = 0; i < MAX_GANGLOCKER; i++) { RehashGangLocker(i); } LoadGangLockers(); } stock LoadGangLocker(id) { new string[128]; format(string, sizeof(string), "SELECT * FROM `ganglockers` WHERE `id`=%d", id); mysql_function_query(MainPipeline, string, true, "OnLoadGangLocker", "i", id); } stock LoadGangLockers() { printf("[LoadGangLockers] Loading data from database..."); mysql_function_query(MainPipeline, "SELECT * FROM `ganglockers`", true, "OnLoadGangLockers", ""); }