Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/01/20 in all areas

  1. Hi everyone! Release small, but maybe useful resource for servers with default map without any mapping. This resource allows for you use getGroundPosition (without Z axis) on server-side. How it works? All map heights wrotten to file, and resource just read it for get Z position. Not 100% accuracy, but anyway it works. What bugs you can detect with this resource? 1. Float positions will be always rounded to nearby integer. 2. If you remove world models, script dont know about that and will return position on removed object. 3. If you add new objects to map, script dont know about that and will return position on world object. How use that? exports.ground:getGroundPosition(x, y) Where it can be used? 1. Random airdrops? 2. Unbug script with random position nearby player? 3. Random forest generation on server-side? Future plans 1. Add method for check water in position. 2. Add method for get material in position. 3. Add method for get object info in position (world/custom, id) 4. Release script for capture map heights. Little demo Download link https://drive.google.com/open?id=1JCYiKPRcv7a6Cw4g2MZgbsVEk3G6H_t8
    1 point
  2. local playersVehicles = {}; function serverSpawn(selectedList1,playerxyz) local x, y, z = getElementPosition(playerxyz) local rx,ry,rz = getElementRotation(playerxyz) if (getPedOccupiedVehicle(playerxyz)) then removePedFromVehicle(playerxyz); destroyElement(getPedOccupiedVehicle(playerxyz)); end if (playersVehicles[playerxyz]) then local veh = playersVehicles[playerxyz]; if (isElement(veh)) then destroyElement(veh); end end local playerVehicle = createVehicle ( selectedList1, x+1, y+1, z+0.5, rx,ry,rz ) local playerCreatedVehicle = getPedOccupiedVehicle ( playerxyz ) warpPedIntoVehicle ( playerxyz, playerVehicle ) playersVehicles[playerxyz] = playerVehicle; end addEvent("spawncar",true) addEventHandler("spawncar",getRootElement(),serverSpawn)
    1 point
  3. Looks like something like this local respawnPoints = { {0, 0, 3}, } local function findNearestRespawnPoint(x, y, z) local nearestPoint = { distance = 99999, index = 1 } for i, v in ipairs(respawnPoints) do local distance = getDistanceBetweenPoints3D(x, y, z, v[1], v[2], v[3]) if distance < nearestPoint.distance then nearestPoint = { distance = distance, index = i } end end return respawnPoints[nearestPoint.index] end local function respawnPlayer(player) local x, y, z = getElementPosition(player) local point = findNearestRespawnPoint(x, y, z) spawnPlayer(player, point[1], point[2], point[3]) end addEventHandler("onPlayerWasted", root, function() setTimer(respawnPlayer, 1000, 1, source) end)
    1 point
  4. Here scanning 1x1 units, and in my way dont need save X,Y positions.
    1 point
  5. 1 point
  6. As linha que editei eu comentei. Dai quando o cara sentar você seta o inUse como true para outra pessoa não conseguir sentar. Dai você vai precisar fazer os bindKey local posChairs = { [1] = {1579.4000244141,-1675.8000488281 ,15.199999809265}, -- cadeira interrogado (suspeito) 1 [2] = {1580, -1677.5, 15.199999809265}, -- cadeira interrogado (suspeito) 2 [3] = {1582.0999755859, -1676.3000488281, 15.199999809265}, -- -- cadeira interrogador (policial) } local chairDatas = { -- Tabela com algumas "config" da cadeira. ID = {}, -- ID da cadeira. inUse = {}, -- Se a cadeira está em uso. } local chairTable = {} function resStart() for i, chair in ipairs(posChairs) do chairTable[i] = createMarker(chair[1], chair[2], chair[3], "cylinder", 1.2, 255,0, 0, 100) chairDatas.ID[chairTable[i]] = i -- Seta o ID na tabela chairDatas chairDatas.inUse[chairTable[i]] = false -- Seta o inUse como false na tabela chairDatas outputChatBox(tostring(chairTable[i])) addEventHandler("onMarkerHit", chairTable[i], hittingMk) addEventHandler("onMarkerLeave", chairTable[i], leavingMk) end end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), resStart) function resStopCircle() if chairTable[i] then destroyElement(chairTable[i]) chairTable[i] = nil destroyElement(chairDatas.ID) destroyElement(chairDatas.inUse) chairDatas.ID = nil chairDatas.inUse = nil outputChatBox(tostring(chairTable[i])) end end addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), resStopCircle) function hittingMk (element) if getElementType(element) == "player" and getElementType(source) == "marker" then if chairDatas.inUse[source] == false then outputChatBox("Hitting Chair ID: "..chairDatas.ID[source]..".") -- Retorna o ID da cadeira. exports.inMarkerMsg:create(element, "pressione E para sentar") else outputChatBox("Chair in use.") -- Se a cadeira está em uso. end end end function leavingMk (element) if getElementType(element) == "player" and getElementType(source) == "marker" then outputChatBox("Leaving Chair ID: "..chairDatas.ID[source]..".") -- Retorna o ID da cadeira. exports.inMarkerMsg:delete(element) end end EDIT: Não testei.
    1 point
  7. Open world interiors is possible. The way you go about doing it is up to you. There are ways that you can retain or destroy performance. GTA 5 uses MILO for interiors. I barely have any knowledge on them, but I've done some reading and found that it might be done by projecting an image, from a camera placed at the window. When the player opens the door, they'll be teleported to another dimension while a chunk of the GTA 5 environment remains loaded. Most of these are speculations. I cannot tell how exactly it works. If your interior has props (so not just 1 whole model) I would suggest you only have them load within a small radius else you'll have a large excess of elements streamed in, which can cause issues with performance. There are some GTA SA interiors - mostly for cutscenes, which have a chunk of the map to be seen from its windows. You can do this yourself to imitate the GTA 5 interior system. I was working on an open world interior but never finished. https://streamable.com/9bk4v I just found this video and it might be exactly what you're looking for:
    1 point
  8. Have you tried dimensions? setElementDimension You can put all objects into dimensions -1, making them visible in every dimension, but keep players in seperate dimensions. Alternatively, you can manage the visibility of the objects manually through clientside scripts: Keep players in seperate dimensions but put the objects into the dimension of the localPlayer, on the client.
    1 point
×
×
  • Create New...