08.04.2018, 18:48
Hello guys i have a little question, why this system works when i am alone on server but when sm1 joins
it get's a little bug my 1st car wont despawn but it says it did like everything is ok but the cars is still
there and if i enter the car it still say's is mine.
COMMAND
DIALOG
it get's a little bug my 1st car wont despawn but it says it did like everything is ok but the cars is still
there and if i enter the car it still say's is mine.
COMMAND
Код HTML:
CMD:v(playerid) { new Cache:r, string[256]; mysql_format(handle, string, sizeof(string), "SELECT * FROM `personalcars` WHERE `Owner` = '%e'", GetName(playerid)); r = mysql_query(handle, string); if(!cache_num_rows()) return SCM(playerid, -1, "[Server-In-Lucru]: Nu ai vehicule personale."); else { tospawn[playerid] = 0; new query[4], query2[4], string1[128], string2[300], tstring[128], coordsstring[64] = "Slot\tStatus\tNume\tTimp Despawn\n"; format(tstring, sizeof(tstring),"{FFFFFF}Garajul lui {B8DBFF}%s {FFFFFF}- %d Sloturi", GetName(playerid), PlayerInfo[playerid][pMaxCarSlot]); for(new i, j = cache_num_rows(); i != j; ++i) { masinacars[playerid][i] = 0; cache_get_value_name_int(i, "CarID", CarInfo[playerid][pcCarID]); format(query2, 4, CarInfo[playerid][pcCarID]); cache_get_value_name_int(i, "ID", CarInfo[playerid][pcID]); format(query, 4, CarInfo[playerid][pcID]); format(Selected[i][scarid], 4, query); if(CarInfo[Selected[i][scarid]][pcStatus] == 1) format(string1, sizeof(string1), "{FFFFFF}%d\t{12c20a}Spawned{FFFFFF}\t%s\t%d min\n", i+1, CarInfo[Selected[i][scarid]][pcDescription], TimerToDespawnCar[query2[i]]), strcat(string2, string1); else format(string1, sizeof(string1), "{FFFFFF}%d\t{ff0000}Despawned{FFFFFF}\t%s\tNo Time\n", i+1, CarInfo[Selected[i][scarid]][pcDescription]), strcat(string2, string1); masinacars[playerid][i] = Selected[i][scarid]; } strins(string2, coordsstring, 0); ShowPlayerDialog(playerid, DIALOG_OWNEDCARS, DIALOG_STYLE_TABLIST_HEADERS, tstring, string2, "Alege","Iesi"); } cache_delete®; return 1; }
Код HTML:
case DIALOG_OWNEDCARS2: { if(!response) return 1; new strings[120], Float:x, Float:y, Float:z, Float:a, pcar = GetPlayerVehicleID(playerid), selectedcar = tospawn[playerid]; if(response) { format(strings, sizeof(strings), "Nume: [%s] - DBID: [%d] - CarModel: [%d]", CarInfo[selectedcar][pcDescription], selectedcar, CarInfo[selectedcar][pcCarModel]); SCM(playerid, -1, strings); switch(listitem) { case 0: { new string[35], mesaj[75]; format(string, sizeof(string), "Vehicle info [%s]", CarInfo[selectedcar][pcDescription]); if(TimerToDespawnCar[CarInfo[selectedcar][pcCarID]] == 0) format(mesaj, sizeof(mesaj), "Owner: [%s]\nDespawn Time: [No Time]\nInsurances: [%d]", CarInfo[selectedcar][pcOwner], CarInfo[selectedcar][pcInsurance]); if(TimerToDespawnCar[CarInfo[selectedcar][pcCarID]] > 0) format(mesaj, sizeof(mesaj), "Owner: [%s]\nDespawn Time: [%d min]\nInsurances: [%d]", CarInfo[selectedcar][pcOwner], TimerToDespawnCar[CarInfo[selectedcar][pcCarID]], CarInfo[selectedcar][pcInsurance]); ShowPlayerDialog(playerid, DIALOG_CARINFO, DIALOG_STYLE_MSGBOX, string, mesaj, "Close", ""); } case 1: { if(CarInfo[selectedcar][pcStatus] == 1) return SCM(playerid, -1, "[Server-In-Lucru]: Acest vehicul este deja spawnat."); new car2 = CreateVehicle(CarInfo[selectedcar][pcCarModel], CarInfo[selectedcar][pcPosX], CarInfo[selectedcar][pcPosY], CarInfo[selectedcar][pcPosZ], CarInfo[selectedcar][pcPosA], CarInfo[selectedcar][pcColor1], CarInfo[selectedcar][pcColor2], -1); SetVehicleNumberPlate(car2, CarInfo[selectedcar][pcCarPlate]); SetVehicleParamsEx(car2, VEHICLE_PARAMS_OFF, lights, alarm, CarInfo[selectedcar][pcLock], bonnet, boot, objective); SetVehicleParamsForPlayer(car2, playerid, 0, 0); StopDespawnTimer[car2] = repeat DespawnTimer(car2); StopTimer[car2] = defer DespawnVeh(car2); CarInfo[selectedcar][pcStatus] = 1; pcUpdate(selectedcar, pcStatus); CarInfo[selectedcar][pcCarID] = car2; pcUpdate(selectedcar, pcCarID); TimerToDespawnCar[selectedcar] = 30; Fuel[car2] = CarInfo[selectedcar][pcFuel]; vDBID[car2] = selectedcar; DespawnCar[car2] = selectedcar; format(strings, sizeof(strings), "[Server-In-Lucru]: Ti-ai spawnat vehiculul [%s] id-ul ei este [%d].", CarInfo[selectedcar][pcDescription], car2); SCM(playerid, -1, strings); } case 2: { if(CP[playerid] == 30) return SCM(playerid, -1, "[Server-In-Lucru]: Ai un punct rosu activ foloseste /killcp mai intai."); if(CarInfo[selectedcar][pcStatus] == 0) return SCM(playerid, -1, "[Server-In-Lucru]: Acest vehicul este deja despawnat."); DestroyVehicle(CarInfo[selectedcar][pcCarID]); vDBID[CarInfo[selectedcar][pcCarID]] = 0; TimerToDespawnCar[CarInfo[selectedcar][pcCarID]] = 0; DespawnCar[CarInfo[selectedcar][pcCarID]] = selectedcar; stop StopTimer[CarInfo[selectedcar][pcCarID]]; stop StopDespawnTimer[CarInfo[selectedcar][pcCarID]]; UpdateVeh(selectedcar); format(strings, sizeof(strings), "[Server-In-Lucru]: Ti-ai despawnat vehiculul [%s].", CarInfo[selectedcar][pcDescription]); SCM(playerid, -1, strings); CarInfo[selectedcar][pcStatus] = 0; pcUpdate(selectedcar, pcStatus); CarInfo[selectedcar][pcCarID] = 0; pcUpdate(selectedcar, pcCarID); } } } }