function checkVehpos(veh, dbid) local requires = getElementData(veh, "requires.vehpos") if (requires) then if (requires==1) then local id = tonumber(getElementData(veh, "dbid")) if (id==dbid) then exports.logs:logMessage("[VEHPOS DELETE] car #" .. id .. " was deleted", 9) destroyElement(veh) local query = dbExec(exports.mysql:getConnection(),"DELETE FROM vehicles WHERE id='" .. mysql:escape_string(id) .. "' LIMIT 1") call( getResourceFromName( "item-system" ), "clearItems", veh ) call( getResourceFromName( "item-system" ), "deleteAll", 3, id ) end end end end -- VEHPOS local PershingSquareCol = createColRectangle( 1420, -1775, 130, 257 ) local HospitalCol = createColRectangle( 1166, -1384, 52, 92 ) function setVehiclePosition(thePlayer, commandName) local veh = getPedOccupiedVehicle(thePlayer) if not veh or getElementData(thePlayer, "realinvehicle") == 0 then outputChatBox("You are not in a vehicle.", thePlayer, 255, 0, 0) else if call( getResourceFromName("tow-system"), "cannotVehpos", thePlayer, veh ) then outputChatBox("Aracınız buraya park edilemez.", thePlayer, 255, 0, 0) elseif isElementWithinColShape( thePlayer, HospitalCol ) and getElementData( thePlayer, "faction" ) ~= 2 and not exports.global:isPlayerAdmin(thePlayer) then outputChatBox("Only Los Santos Emergency Service is allowed to park their vehicles in front of the Hospital.", thePlayer, 255, 0, 0) elseif isElementWithinColShape( thePlayer, PershingSquareCol ) and getElementData( thePlayer, "faction" ) ~= 1 and not exports.global:isPlayerAdmin(thePlayer) then outputChatBox("Only Los Santos Police Department is allowed to park their vehicles on Pershing Square.", thePlayer, 255, 0, 0) else local playerid = getElementData(thePlayer, "dbid") local playerfl = getElementData(thePlayer, "factionleader") local playerfid = getElementData(thePlayer, "faction") local owner = getElementData(veh, "owner") local dbid = getElementData(veh, "dbid") local carfid = getElementData(veh, "faction") local x, y, z = getElementPosition(veh) local TowingReturn = call(getResourceFromName("tow-system"), "CanTowTruckDriverVehPos", thePlayer) -- 2 == in towing and in col shape, 1 == colshape only, 0 == not in col shape if (owner==playerid and TowingReturn == 0) or (exports.global:hasItem(thePlayer, 3, dbid)) or (TowingReturn == 2) or (exports.global:isPlayerAdmin(thePlayer) and exports.logs:logMessage("[AVEHPOS] " .. getPlayerName( thePlayer ) .. " parked car #" .. dbid .. " at " .. x .. ", " .. y .. ", " .. z, 9)) then if (dbid<0) then outputChatBox("Bu araç kalıcı değil, geçici olarak oluşturulmuş.", thePlayer, 255, 0, 0) else if (call(getResourceFromName("tow-system"), "CanTowTruckDriverGetPaid", thePlayer)) then -- pd has to pay for this impound exports.global:giveMoney(getTeamFromName("Hex Tow 'n Go"), 75) exports.global:takeMoney(getTeamFromName("Hex Tow 'n Go"), 75) end exports['anticheat-system']:changeProtectedElementDataEx(veh, "requires.vehpos") local rx, ry, rz = getVehicleRotation(veh) local interior = getElementInterior(thePlayer) local dimension = getElementDimension(thePlayer) local query = dbExec(exports.mysql:getConnection(),"UPDATE vehicles SET x='" .. mysql:escape_string(x) .. "', y='" .. mysql:escape_string(y) .."', z='" .. mysql:escape_string(z) .. "', rotx='" .. mysql:escape_string(rx) .. "', roty='" .. mysql:escape_string(ry) .. "', rotz='" .. mysql:escape_string(rz) .. "', currx='" .. mysql:escape_string(x) .. "', curry='" .. mysql:escape_string(y) .. "', currz='" .. mysql:escape_string(z) .. "', currrx='" .. mysql:escape_string(rx) .. "', currry='" .. mysql:escape_string(ry) .. "', currrz='" .. mysql:escape_string(rz) .. "', interior='" .. mysql:escape_string(interior) .. "', currinterior='" .. mysql:escape_string(interior) .. "', dimension='" .. mysql:escape_string(dimension) .. "', currdimension='" .. mysql:escape_string(dimension) .. "' WHERE id='" .. mysql:escape_string(dbid) .. "'") setVehicleRespawnPosition(veh, x, y, z, rx, ry, rz) exports['anticheat-system']:changeProtectedElementDataEx(veh, "respawnposition", {x, y, z, rx, ry, rz}, false) exports['anticheat-system']:changeProtectedElementDataEx(veh, "interior", interior) exports['anticheat-system']:changeProtectedElementDataEx(veh, "dimension", dimension) outputChatBox("#00FF00[!] #FFFFFFAracınız başarıyla park edildi.", thePlayer,255,255,255,true) exports.logs:dbLog(thePlayer, 4, { veh }, "PARK") for key, value in ipairs(destroyTimers) do if (tonumber(destroyTimers[key][2]) == dbid) then local timer = destroyTimers[key][1] if (isTimer(timer)) then killTimer(timer) table.remove(destroyTimers, key) end end end if ( getElementData(veh, "Impounded") or 0 ) > 0 then local owner = getPlayerFromName( exports['cache']:getCharacterName( getElementData( veh, "owner" ) ) ) if isElement( owner ) and exports.global:hasItem( owner, 2 ) then outputChatBox("((Hex Tow 'n Go)) #921 [SMS]: Your " .. getVehicleName(veh) .. " has been impounded. Head over to the Impound to release it.", owner, 120, 255, 80) end end end end end end end addCommandHandler("vehpos", setVehiclePosition, false, false) addCommandHandler("park", setVehiclePosition, false, false)