02.04.2018, 10:24
Код:
stock VEHICLEFROMDB(dbid) { for(new i = 1; i <= GetVehiclePoolSize(); i++) { if(vDBID[i] == dbid) return i; } return 0; }
I had rather do it somehow like that (I might be wrong in what I coded, but I hope you get the general idea)
Код:
function DespawnPlayerVehicle(playerid) { new gQuery[85]; mysql_format(handle, gQuery, sizeof(gQuery), "SELECT * FROM `personalcars` WHERE `Owner` = '%s'", GetName(playerid)); new Cache:r = mysql_query(handle, gQuery); for(new i; i < cache_num_rows(); i++) { new dbid = cache_get_value_name_int(i, "ID", CarInfo[playerid][pcID]); for(new i = 1; i <= GetVehiclePoolSize(); i++) { if(vDBID[i] == dbid) { if(PCarID) { CarInfo[vDBID[PCarID]][pcStatus] = 0; pcUpdate(vDBID[PCarID], pcStatus); DestroyVehicle(PCarID); vDBID[PCarID] = 0; } } } } cache_delete®; }