OrbTanT Posted April 5, 2020 Share Posted April 5, 2020 guys I used the map of the resource interiors to make the script work my way, it's almost 100% working but there is a problem that I couldn't solve, the entry and exit are done using an id, for some reason when I leave the interior, I end up leaving in a totally different interior, and from the print it looks like it ran for 4 more interiors, I didn't find the error. grateful to those who help. =) https://prnt.sc/rtbvdy local interiors = {} function createInteriors(id, data, type) if not (interiors[id]) then interiors[id] = {} end if (type == "entry") then interiors[id]["entry"] = data elseif (type == "return") then interiors[id]["return"] = data end local x, y, z, rot, dim, int = unpack(data) local col = createColSphere(x, y, z, 1.5) col:setDimension(dim) col:setInterior(int) col:setData("interior", true) col:setData("id", id) col:setData("type", type) local arrow = createObject(1318, x, y, z + 1) arrow:setDimension(dim) arrow:setInterior(int) arrow:setData("interior", true) arrow:setData("type", type) arrow:setData("animation", {z+0.5, z+1.6}) end addEventHandler("onColShapeHit", getRootElement(), function(element) if (element:getType() == "player" and not element:getOccupiedVehicle()) then if not (source:getData("interior")) then return end if (element:getData("interiorHit")) then return end local id = source:getData("id") if not (id) then return end if (interiors[id]) then local type = source:getData("type") if (type) then if (type == "entry") then local data = interiors[id]["return"] if not (data) then return end warpPlayerInterior(element, unpack(data)) elseif (type == "return") then print(id) local data = interiors[id]["entry"] if not (data) then return end warpPlayerInterior(element, unpack(data)) end end end end end) function warpPlayerInterior(player, x, y, z, rot, dim, int) fadeCamera(player, false, 0.5) player:setAlpha(175) Timer(function(player) player:setData("interiorHit", true) player:setDimension(dim) player:setInterior(int) player:setPosition(x, y, z+1) player:setRotation(0, 0, rot) if (int ~= 0) then toggleControl(player, "fire", false) toggleControl(player, "aim_weapon", false) else toggleControl(player, "fire", true) toggleControl(player, "aim_weapon", true) end Timer(fadeCamera, 1000, 1, player, true, 1) Timer(function(player) player:setAlpha(255) player:setData("interiorHit", nil) end, 2000, 1, player) end, 500, 1, player) end addEventHandler("onResourceStart", resourceRoot, function() for key, interior in ipairs (getElementsByType("interiorEntry", resourceRoot)) do local id = getElementData(interior, "id") local x = tonumber(getElementData(interior, "posX")) local y = tonumber(getElementData(interior, "posY")) local z = tonumber(getElementData(interior, "posZ")) local rot = tonumber(getElementData(interior, "rotation")) local dim = tonumber(getElementData(interior, "dimension")) local int = tonumber(getElementData(interior, "interior")) createInteriors(id, {x, y, z, rot, dim, int}, "entry") end for key, interior in ipairs (getElementsByType("interiorReturn", resourceRoot)) do local id = getElementData(interior, "refid") local x = tonumber(getElementData(interior, "posX")) local y = tonumber(getElementData(interior, "posY")) local z = tonumber(getElementData(interior, "posZ")) local rot = tonumber(getElementData(interior, "rotation")) local dim = tonumber(getElementData(interior, "dimension")) local int = tonumber(getElementData(interior, "interior")) createInteriors(id, {x, y, z, rot, dim, int}, "return") end for _, player in ipairs (getElementsByType("player")) do player:setData("interiorHit", nil) end end) Link to comment
The_GTA Posted April 5, 2020 Share Posted April 5, 2020 Hello OrbTanT, your script seems to use external map data that is not provided in your post. But you mention the map of a potential MTA resource. Could you please try to find the map lines in question that show the erratic behavior in connection with your script? We would like to have data that we can test instead of combing through potentially an entire map file. Link to comment
OrbTanT Posted April 5, 2020 Author Share Posted April 5, 2020 interiors.map. Thank you for answer <interiorEntry id="AMMUN1" posX="1368.35" posY="-1279.06" posZ="12.55" rotation="-0.100006" dimension="0" interior="0" /> <interiorReturn refid="AMMUN1" posX="286.15" posY="-41.54" posZ="1000.57" rotation="90" interior="1" dimension="0" /> <interiorEntry id="AMMUN1 (2)" posX="-2625.85" posY="208.345" posZ="3.98935" rotation="0" dimension="0" interior="0" /> <interiorReturn refid="AMMUN1 (2)" posX="286.15" posY="-41.54" posZ="1000.57" rotation="5400.06" interior="1" dimension="1" /> <interiorEntry id="AMMUN2" posX="242.668" posY="-178.478" posZ="0.621441" rotation="-0.100006" dimension="0" interior="0" /> <interiorReturn refid="AMMUN2" posX="285.8" posY="-85.45" posZ="1000.54" rotation="-269.903" interior="4" dimension="0" /> <interiorEntry id="AMMUN2 (2)" posX="2333.43" posY="61.5173" posZ="25.7342" rotation="0" dimension="0" interior="0" /> <interiorReturn refid="AMMUN2 (2)" posX="285.8" posY="-85.45" posZ="1000.54" rotation="-90" interior="4" dimension="1" /> <interiorEntry id="AMMUN2 (3)" posX="2159.51" posY="943.329" posZ="9.82339" rotation="0" dimension="0" interior="0" /> <interiorReturn refid="AMMUN2 (3)" posX="285.8" posY="-85.45" posZ="1000.54" rotation="-3870.01" interior="4" dimension="2" /> <interiorEntry id="AMMUN2 (4)" posX="2539.04" posY="2083.56" posZ="9.82222" rotation="0" dimension="0" interior="0" /> <interiorReturn refid="AMMUN2 (4)" posX="285.8" posY="-85.45" posZ="1000.54" rotation="90" interior="4" dimension="3" /> <interiorEntry id="AMMUN3" posX="777.231" posY="1871.47" posZ="3.97687" rotation="-0.100006" dimension="0" interior="0" /> <interiorReturn refid="AMMUN3" posX="296.92" posY="-111.97" posZ="1000.57" rotation="300.994" interior="6" dimension="3" /> <interiorEntry id="AMMUN3 (2)" posX="-315.676" posY="829.868" posZ="13.4266" rotation="0" dimension="0" interior="0" /> <interiorReturn refid="AMMUN3 (2)" posX="296.92" posY="-111.97" posZ="1000.57" rotation="300.994" interior="6" dimension="4" /> <interiorEntry id="AMMUN3 (3)" posX="-2093.51" posY="-2464.79" posZ="29.6404" rotation="0" dimension="0" interior="0" /> <interiorReturn refid="AMMUN3 (3)" posX="296.92" posY="-111.97" posZ="1000.57" rotation="319" interior="6" dimension="5" /> <interiorEntry id="AMMUN3 (4)" posX="2400.5" posY="-1981.48" posZ="12.5604" rotation="0" dimension="0" interior="0" /> <interiorReturn refid="AMMUN3 (4)" posX="296.92" posY="-111.97" posZ="1000.57" rotation="0" interior="6" dimension="6" /> <interiorEntry id="AMMUN5" posX="-1508.89" posY="2610.8" posZ="54.8902" rotation="-0.100006" dimension="0" interior="0" /> <interiorReturn refid="AMMUN5" posX="316.53" posY="-169.61" posZ="998.66" rotation="180" interior="6" dimension="0" /> Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now