10.12.2017, 04:17
Quote:
PHP Code:
|
Code:
isValidVehicleModel(modelid) return (400 <= modelid <= 611); GetVehicleMaxPassengers(iModel) { if(isValidVehicleModel(iModel)) { static s_MaxPassengers[] = { 271782163, 288428337, 288559891, -2146225407, 327282960, 271651075, 268443408, 286339857, 319894289, 823136512, 805311233, 285414161, 286331697, 268513553, 18026752, 286331152, 286261297, 286458129, 856765201, 286331137, 856690995, 269484528, 51589393, -15658689, 322109713, -15527663, 65343 }; new result = ((s_MaxPassengers[(iModel -= 400) >>> 3] >>> ((iModel & 7) << 2)) & 0xF); switch(iModel) { case 449: result = 3; // Tram case 483: result = 2; // Camper } return result; } return 0xF; } getFreeVehicleSeat(vehicleid, startSeat = 1) { if(!(vehicleid >= 1 && vehicleid < MAX_VEHICLES)) return -1; new bool:sVehicleSeats[8] = {false, ...}, seatid, maxSeats = GetVehicleMaxPassengers(GetVehicleModel(vehicleid)); if(maxSeats == 0) return -1; if(maxSeats > 8) maxSeats = 8; foreach(new i : Character) { if(IsPlayerInVehicle(i, vehicleid)) { seatid = GetPlayerVehicleSeat(i); if(seatid >= startSeat && seatid <= maxSeats && seatid != 128) sVehicleSeats[seatid] = true; } } for (new i = startSeat; i <= maxSeats; ++i) { if(!sVehicleSeats[i]) return i; } return -1; }
#KCNRCode