26.12.2013, 14:43
They don't save in the database can someone help please if so post a reply or help me via skype mattekingen
Код:
stock SaveHouse(houseid) { new string[2048]; format(string, sizeof(string), "UPDATE `houses` SET \ `Owned`=%d, \ `Level`=%d, \ `HInteriorWorld`=%d, \ `Description`='%s', \ `Owner`='%s', \ `ExteriorX`=%f, \ `ExteriorY`=%f, \ `ExteriorZ`=%f, \ `ExteriorR`=%f, \ `InteriorX`=%f, \ `InteriorY`=%f, \ `InteriorZ`=%f, \ `InteriorR`=%f,", HouseInfo[houseid][hOwned], HouseInfo[houseid][hLevel], HouseInfo[houseid][hHInteriorWorld], HouseInfo[houseid][hDescription], HouseInfo[houseid][hOwner], HouseInfo[houseid][hExteriorX], HouseInfo[houseid][hExteriorY], HouseInfo[houseid][hExteriorZ], HouseInfo[houseid][hExteriorR], HouseInfo[houseid][hInteriorX], HouseInfo[houseid][hInteriorY], HouseInfo[houseid][hInteriorZ], HouseInfo[houseid][hInteriorR] ); format(string, sizeof(string), "%s \ `Lock`=%d, \ `Rentable`=%d, \ `RentFee`=%d, \ `Value`=%d, \ `SafeMoney`=%d, \ `Pot`=%d, \ `Crack`=%d, \ `Materials`=%d, \ `Weapons0`=%d, \ `Weapons1`=%d, \ `Weapons2`=%d, \ `Weapons3`=%d, \ `Weapons4`=%d, \ `GLUpgrade`=%d, \ `CustomInterior`=%d, \ `CustomExterior`=%d, \ `ExteriorA`=%f, \ `InteriorA`=%f WHERE `id`=%d", string, HouseInfo[houseid][hLock], HouseInfo[houseid][hRentable], HouseInfo[houseid][hRentFee], HouseInfo[houseid][hValue], HouseInfo[houseid][hSafeMoney], HouseInfo[houseid][hPot], HouseInfo[houseid][hCrack], HouseInfo[houseid][hMaterials], HouseInfo[houseid][hWeapons][0], HouseInfo[houseid][hWeapons][1], HouseInfo[houseid][hWeapons][2], HouseInfo[houseid][hWeapons][3], HouseInfo[houseid][hWeapons][4], HouseInfo[houseid][hGLUpgrade], HouseInfo[houseid][hCustomInterior], HouseInfo[houseid][hCustomExterior], HouseInfo[houseid][hExteriorA], HouseInfo[houseid][hInteriorA], houseid+1 ); // Array starts from zero, MySQL starts at 1 (this is why we are adding one). mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD); } stock CreateHouse(houseid) { new string[2048]; format(string, sizeof(string), "INSERT INTO `houses` VALUES \ `Owned`=%d, \ `Level`=%d, \ `HInteriorWorld`=%d, \ `Description`='%s', \ `Owner`='%s', \ `ExteriorX`=%f, \ `ExteriorY`=%f, \ `ExteriorZ`=%f, \ `ExteriorR`=%f, \ `InteriorX`=%f, \ `InteriorY`=%f, \ `InteriorZ`=%f, \ `InteriorR`=%f,", HouseInfo[houseid][hOwned], HouseInfo[houseid][hLevel], HouseInfo[houseid][hHInteriorWorld], HouseInfo[houseid][hDescription], HouseInfo[houseid][hOwner], HouseInfo[houseid][hExteriorX], HouseInfo[houseid][hExteriorY], HouseInfo[houseid][hExteriorZ], HouseInfo[houseid][hExteriorR], HouseInfo[houseid][hInteriorX], HouseInfo[houseid][hInteriorY], HouseInfo[houseid][hInteriorZ], HouseInfo[houseid][hInteriorR] ); format(string, sizeof(string), "%s \ `Lock`=%d, \ `Rentable`=%d, \ `RentFee`=%d, \ `Value`=%d, \ `SafeMoney`=%d, \ `Pot`=%d, \ `Crack`=%d, \ `Materials`=%d, \ `Weapons0`=%d, \ `Weapons1`=%d, \ `Weapons2`=%d, \ `Weapons3`=%d, \ `Weapons4`=%d, \ `GLUpgrade`=%d, \ `CustomInterior`=%d, \ `CustomExterior`=%d, \ `ExteriorA`=%f, \ `InteriorA`=%f WHERE `id`=%d", string, HouseInfo[houseid][hLock], HouseInfo[houseid][hRentable], HouseInfo[houseid][hRentFee], HouseInfo[houseid][hValue], HouseInfo[houseid][hSafeMoney], HouseInfo[houseid][hPot], HouseInfo[houseid][hCrack], HouseInfo[houseid][hMaterials], HouseInfo[houseid][hWeapons][0], HouseInfo[houseid][hWeapons][1], HouseInfo[houseid][hWeapons][2], HouseInfo[houseid][hWeapons][3], HouseInfo[houseid][hWeapons][4], HouseInfo[houseid][hGLUpgrade], HouseInfo[houseid][hCustomInterior], HouseInfo[houseid][hCustomExterior], HouseInfo[houseid][hExteriorA], HouseInfo[houseid][hInteriorA], houseid+1 ); // Array starts from zero, MySQL starts at 1 (this is why we are adding one). mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD); } stock SaveHouses() { for(new i = 0; i < MAX_HOUSES; i++) { SaveHouse(i); } return 1; } stock LoadHouse(houseid) { new string[128]; printf("[LoadHouse] Loading HouseID %d's data from database...", houseid); format(string, sizeof(string), "SELECT * FROM `houses` WHERE `id`=%d",houseid+1); // Array starts at zero, MySQL starts at one. mysql_function_query(MainPipeline, string, true, "OnLoadHouse", "i", houseid); } forward OnLoadHouse(index); public OnLoadHouse(index) { new string[64]; new rows, fields; cache_get_data(rows, fields, MainPipeline); for(new field;field<fields;field++) { cache_get_row(index, field, string, MainPipeline); switch(field) { case 0: HouseInfo[index][hSQLId] = strval(string); case 1: HouseInfo[index][hOwned] = strval(string); case 2: HouseInfo[index][hLevel] = strval(string); case 3: HouseInfo[index][hHInteriorWorld] = strval(string); case 4: format(HouseInfo[index][hDescription], 16, "%s", string); case 5: format(HouseInfo[index][hOwner], 24, "%s", string); case 6: HouseInfo[index][hExteriorX] = floatstr(string); case 7: HouseInfo[index][hExteriorY] = floatstr(string); case 8: HouseInfo[index][hExteriorZ] = floatstr(string); case 9: HouseInfo[index][hExteriorR] = floatstr(string); case 10: HouseInfo[index][hInteriorX] = floatstr(string); case 11: HouseInfo[index][hInteriorY] = floatstr(string); case 12: HouseInfo[index][hInteriorZ] = floatstr(string); case 13: HouseInfo[index][hInteriorR] = floatstr(string); case 14: HouseInfo[index][hLock] = strval(string); case 15: HouseInfo[index][hRentable] = strval(string); case 16: HouseInfo[index][hRentFee] = strval(string); case 17: HouseInfo[index][hValue] = strval(string); case 18: HouseInfo[index][hSafeMoney] = strval(string); case 19: HouseInfo[index][hPot] = strval(string); case 20: HouseInfo[index][hCrack] = strval(string); case 21: HouseInfo[index][hMaterials] = strval(string); case 22: HouseInfo[index][hWeapons][0] = strval(string); case 23: HouseInfo[index][hWeapons][1] = strval(string); case 24: HouseInfo[index][hWeapons][2] = strval(string); case 25: HouseInfo[index][hWeapons][3] = strval(string); case 26: HouseInfo[index][hWeapons][4] = strval(string); case 27: HouseInfo[index][hGLUpgrade] = strval(string); case 28: HouseInfo[index][hPickupID] = strval(string); case 29: HouseInfo[index][hCustomInterior] = strval(string); case 30: HouseInfo[index][hCustomExterior] = strval(string); case 31: HouseInfo[index][hExteriorA] = floatstr(string); case 32: HouseInfo[index][hInteriorA] = floatstr(string); } } if(HouseInfo[index][hOwned]) { if(!HouseInfo[index][hRentable]) format(string, sizeof(string), "This house is owned by\n%s\nLevel: %d\nID: %d",HouseInfo[index][hOwner], HouseInfo[index][hLevel], index); else format(string, sizeof(string), "This house is owned by\n%s\nRent: $%d\nLevel: %d\nID: %d\nType /rentroom to rent a room", HouseInfo[index][hOwner], HouseInfo[index][hRentFee], HouseInfo[index][hLevel], index); } else format(string, sizeof(string), "This house is\n for sale!\n Description: %s\nCost: $%d\n Level: %d\nID: %d\nTo buy this house type /buyhouse",HouseInfo[index][hDescription],HouseInfo[index][hValue],HouseInfo[index][hLevel],index); HouseInfo[index][hPickupID] = CreatePickupEx(1273, 23, HouseInfo[index][hExteriorX], HouseInfo[index][hExteriorY], HouseInfo[index][hExteriorZ]); HouseInfo[index][hTextID] = CreateDynamic3DTextLabel(string, COLOR_GREEN, HouseInfo[index][hExteriorX..