0 Üye ve 1 Ziyaretçi konuyu incelemekte.
function giveMeVehicles(vehicles) if type(vehicles) == 'number' then vehicles = { vehicles } end local px, py, pz, prot local radius = 3 local playerVehicle = getPedOccupiedVehicle(source) if playerVehicle and isElement(playerVehicle) then px, py, pz = getElementPosition(playerVehicle) prot, prot, prot = getVehicleRotation(playerVehicle) else px, py, pz = getElementPosition(source) prot = getPedRotation(source) end local offsetRot = math.rad(prot) local vx = px + radius * math.cos(offsetRot) local vy = py + radius * math.sin(offsetRot) local vz = pz + 2 local vrot = prot local vehicleList = g_PlayerData[source].vehicles local vehicle if ( not vehicles ) then return end for i,vehID in ipairs(vehicles) do if i > getOption('vehicles.maxperplayer') then break end if vehID < 400 or vehID > 611 then errMsg(vehID ..' is incorrect vehicle model', source) elseif not table.find(getOption('vehicles.disallowed'), vehID) then if #vehicleList >= getOption('vehicles.maxperplayer') then unloadVehicle(vehicleList[1]) end vehicle = createVehicle(vehID, vx, vy, vz, 0, 0, vrot) warpPedIntoVehicle(source, vehicle) if (not isElement(vehicle)) then return end setElementInterior(vehicle, getElementInterior(source)) setElementDimension(vehicle, getElementDimension(source)) table.insert(vehicleList, vehicle) g_VehicleData[vehicle] = { creator = source, timers = {} } if vehID == 464 then warpPedIntoVehicle(source, vehicle) elseif not g_Trailers[vehID] then if getOption('vehicles.idleexplode') then g_VehicleData[vehicle].timers.fire = setTimer(commitArsonOnVehicle, getOption('vehicles.maxidletime'), 1, vehicle) end g_VehicleData[vehicle].timers.destroy = setTimer(unloadVehicle, getOption('vehicles.maxidletime') + (getOption('vehicles.idleexplode') and 10000 or 0), 1, vehicle) end vx = vx + 4 vz = vz + 4 else errMsg(getVehicleNameFromModel(vehID):gsub('y$', 'ie') .. 's are not allowed', source) end endend
addEventHandler('onVehicleExit', root,
addEventHandler('onVehicleExit', root, function(player, seat) if not g_VehicleData[source] then return end if not g_VehicleData[source].timers.fire then for i=0,getVehicleMaxPassengers(source) or 1 do if getVehicleOccupant(source, i) then return end end if getOption('vehicles.idleexplode') then g_VehicleData[source].timers.fire = setTimer(commitArsonOnVehicle, getOption('vehicles.maxidletime'), 1, source) end if g_ArmedVehicles[getElementModel(source)] then toggleControl(player, 'vehicle_fire', true) toggleControl(player, 'vehicle_secondary_fire', true) end if g_PlayerData[player].previousGravity then setPedGravity(player, g_PlayerData[player].previousGravity) g_PlayerData[player].previousGravity = nil end end)
Bu kezde hiç almıyor araç
addEventHandler('onVehicleExit', root, function(player, seat) if not g_VehicleData[source] then return end if not g_VehicleData[source].timers.fire then for i=0,getVehicleMaxPassengers(source) or 1 do if getVehicleOccupant(source, i) then return end end if getOption('vehicles.idleexplode') then g_VehicleData[source].timers.fire = setTimer(commitArsonOnVehicle, getOption('vehicles.maxidletime'), 1, source) end end if g_ArmedVehicles[getElementModel(source)] then toggleControl(player, 'vehicle_fire', true) toggleControl(player, 'vehicle_secondary_fire', true) end if g_PlayerData[player].previousGravity then setPedGravity(player, g_PlayerData[player].previousGravity) g_PlayerData[player].previousGravity = nil end end)
g_VehicleData[vehicle].timers.destroy = setTimer(unloadVehicle, getOption('vehicles.maxidletime') + (getOption('vehicles.idleexplode') and 10000 or 0), 1, vehicle)