RestricLocation = {}
TeleportLocation = {}
RestricLocation["location1"] = {1920.3017578125,1018.3994140625,12.11952495575} --Координты верхнего противоположного угла
RestricLocation["location2"] = {1894.4609375,968.177734375,10.8203125} --Координаты нижнего угла
TeleportLocation = {1914.9658203125,960.185546875,10.8203125} --Куда телепортирует машину
local limit = 1 -- Максимальное колчество машин на базе всего / false - бесканечно
vehicleAcces = {
}
---Система
function enterZone(hitElement,thePlayer)
if getElementType( hitElement ) == "vehicle" then
if limit == false then return end
local model = getElementModel(hitElement)
local vehiclesInBase = getElementsWithinColShape(ColCuboid,"vehicle")
local vehAmount = table.maxn(vehiclesInBase)
if vehAmount > limit then
setElementPosition(hitElement,TeleportLocation[1],TeleportLocation[2],TeleportLocation[3])
setElementFrozen(hitElement, true)
outputChatBox("Przekroczyles Limit Bazy",getVehicleOccupant(hitElement),255,255,255)
setElementFrozen(hitElement, false)
else
outputChatBox("Twoj Limit: "..limit.." Masz Pojazdow: "..vehAmount,getVehicleOccupant(hitElement),255,255,255)
end
end
end
function LoadLocations()
local RX, RY, RZ, WRX, WRX, WRX
if(RestricLocation["location1"][1] > RestricLocation["location2"][1]) then
RestricLocation["maxx"] = RestricLocation["location1"][1]
RestricLocation["minx"] = RestricLocation["location2"][1]
else
RestricLocation["maxx"] = RestricLocation["location2"][1]
RestricLocation["minx"] = RestricLocation["location1"][1]
end
if(RestricLocation["location1"][2] > RestricLocation["location2"][2]) then
RestricLocation["maxy"] = RestricLocation["location1"][2]
RestricLocation["miny"] = RestricLocation["location2"][2]
else
RestricLocation["maxy"] = RestricLocation["location2"][2]
RestricLocation["miny"] = RestricLocation["location1"][2]
end
if(RestricLocation["location1"][3] > RestricLocation["location2"][3]) then
RestricLocation["maxz"] = RestricLocation["location1"][3]
RestricLocation["minz"] = RestricLocation["location2"][3]
else
RestricLocation["maxz"] = RestricLocation["location2"][3]
RestricLocation["minz"] = RestricLocation["location1"][3]
end
end
LoadLocations()
function CreateCollision()
ColCuboid = createColCuboid (1894.46, 968.18, 9.82, 27.33, 51.19, 5.67)
if ColCuboid then
addEventHandler ( "onColShapeHit", ColCuboid, enterZone )
end
end
CreateCollision()
function ResourceStop( )
destroyElement ( ColCuboid )
end
addEventHandler( "onResourceStop", getResourceRootElement( getThisResource() ),ResourceStop)
---------------------------------------------------------------------------------------------------------------------------------
How i can add limits to helicopters and cars because now i have limit only for "vehicles" i want limit heli on 1-2 and cars 1-5 etc