31.03.2018, 16:21
Hey guys i have a personal vehicle system but i have a problem with the cars, when a player
disconnect's and his cars are spawned and let's say he has more than 1 car only first
car will despawn(destroyed) but the other one wont any idea what is wrong with this
script ?
disconnect's and his cars are spawned and let's say he has more than 1 car only first
car will despawn(destroyed) but the other one wont any idea what is wrong with this
script ?
Код HTML:
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]); new PCarID = VEHICLEFROMDB(dbid); if(PCarID) { CarInfo[cData[PCarID]][pcStatus] = 0; pcUpdate(cData[PCarID], pcStatus); DestroyVehicle(PCarID); cData[PCarID] = 0; } } cache_delete®; }
Код HTML:
stock VEHICLEFROMDB(dbid) { for(new i = 1; i <= GetVehiclePoolSize(); i++) { if(cData[i] == dbid) return i; } return 0; }