Sign in to follow this  
D4rkX

Can't find answer

Recommended Posts

I've searched through a lot of help tutorials etc, but I can't find how I teleport to an interior ( I have the coordinates and the ID of it ) so that I can add objects and make it solid.

Thanks in advance.

Share this post


Link to post

Are you trying to 1) make a marker thingy like in singleplayer, or 2) do you just want to be in there?

1) I took this script straight from my map, you can modify it easily, note I used a table to store the colshapes and markers for rater reference, perhaps you don't need to.

-- teleporting the player in the casino, making the teleport marker invisible
function enterCasino ( player, dimension )
setElementInterior ( player, 1, 2233.85, 1698.85, 1008.35 )
setPedRotation ( player, 180 )
end
 
-- teleporting the player outside, making the teleport marker visible again
function leaveCasino ( player, dimension )
setElementInterior ( player, 0, 2183.67, 1677.30, 11.07 )
end
 
local cols = {}
 
-- create 2 col markers that let you in and out the casino
function scriptCreateCasino()
local x, y, z = 2195.28, 1677.15, 12.37
local x2, y2, z2 = 2234.00, 1713.55, 1012.17
cols.teleCol = createColCircle ( x, y, 2 )
cols.teleCol2 = createColCircle ( x2, y2, 2 )
cols.teleMarker = createMarker ( x, y, z + 1.8, "arrow", 2, 255, 128, 64, 255 )
cols.teleMarker2 = createMarker ( x2, y2, z2 + 1.8, "arrow", 2, 255, 128, 64, 255 )
cols.teleBlip = createBlipAttachedTo ( cols.teleMarker, 31 )
setElementInterior ( cols.teleMarker2, 1 )
addEventHandler ( "onColShapeHit", cols.teleCol, enterCasino )
addEventHandler ( "onColShapeHit", cols.teleCol2, leaveCasino )
end

2) This script teleports all players in the interior from the start, you may want to randomize spawnpoints so they don't get stuck in one point.

function teleportPlayer ( player )
source = source or player
setElementInterior ( source, 1, 2233.85, 1698.85, 1008.35 )
end
 
function teleportPlayers()
for i, v in ( getElementsByType ( "player" ) ) do
	teleportPlayer ( v )
end
end
 
addEventHandler ( "onPlayerJoin", getRootElement(), teleportPlayer )
addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource ), teleportPlayers )

With objects it's just a matter of setting their interior to that ID.

Share this post


Link to post
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.