Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 28/08/23 in all areas

  1. Vc pode verificar isso quando o jogador faz login. local bases = {} -- Tabela com todas as bases criadas. (vc precisará adaptar sua função createBase para colocá-las nesta tabela) local blips = {} -- Tabela com todos os blips das bases. function baseBlip(_, _, theSource) -- theSource só existe quando essa função é chamada lá no createBase() if not theSource then theSource = source -- Se essa função foi chamada ao fazer login, theSource passa a ser quem logou. end for i, base in pairs(bases) do -- Para cada base da tabela, faça: if getPlayerFromSerial (getElementData(base, "owner")) then -- Se o jogador que tem o serial do dono desta base está online, então: if getPlayerFromSerial (getElementData(base, "owner")) == theSource then -- Se o jogador que logou é dono desta base, então: if isElement(blips[i]) then -- Se já existe o blip desta base, então: setElementVisibleTo (blips[i], theSource, true) -- Torna este blip visível para este jogador que logou. else -- Se ainda não existe o blip desta base, então: local x, y, z = getElementPosition(base) -- Obtém a posição da base para usar no blip. blips[i] = createBlip(x, y, z, 58, 1, 255, 255, 255, 255, 0, 8500, theSource) -- Cria o blip visível somente para o jogador que logou. end end end end end addEventHandler("onPlayerLogin", root, baseBlip) function unBlip() for i, base in pairs(bases) do -- Para cada base da tabela, faça: if getPlayerFromSerial (getElementData(base, "owner")) then -- Se o jogador que tem o serial do dono desta base está online, então: if getPlayerFromSerial (getElementData(base, "owner")) == source then -- Se o jogador que deslogou é dono desta base, então: if isElement(blips[i]) then -- Se essa base tem o blip criado, então: setElementVisibleTo (blips[i], source, false) -- Para de mostrar pra esse jogador que deslogou ou saiu do servidor. end end end end end addEventHandler("onPlayerLogout", root, unBlip) addEventHandler("onPlayerQuit", root, unBlip) function getPlayerFromSerial (serial) -- Função útil que pega o player online com este serial. assert (type(serial) == "string" and #serial == 32, "getPlayerFromSerial - invalid serial") for i, player in pairs (getElementsByType ("player")) do if getPlayerSerial(player) == serial then return player end end return false end E lá no final da sua função createBase() adicione isso lá dentro: table.insert(bases, baseCol) -- Adiciona a base que foi criada na tabela de bases. baseBlip(false, false, getPlayerFromSerial(owner)) -- Tenta criar o blip para o dono da base, se ele estiver online.
    1 point
  2. I believe that is because you have been destroying variable marker, and not the source of onMarketrHit. So every time you hit any cylinder, the code will destroy the last cylinder in variable marker Try this one to destroy do source of hit garbages = { {-1881.14380, -1707.47888, 21.75000}, {-1885.83081, -1723.84656, 21.75641}, {-1896.03723, -1731.46301, 21.75000}, {-1908.80933, -1733.61536, 21.75000} } function pickup(player) for i,garbage in pairs(garbages) do marker = createMarker(garbage[1], garbage[2], garbage[3], "cylinder", 3.0) function picked(player) destroyElement(source) -- here the modification end addEventHandler("onMarkerHit", marker, picked) end end If it helped, pls give rep+.
    1 point
  3. You need to use either onPlayerVehicleEnter or onVehicleEnter event, check if the player is supposed to be able to enter the vehicle and call cancelEvent if they're not.
    1 point
  4. Give the resource admin rights like this in acl.xml: <object name="resource."RESOURCE NAME HERE" /> Then type "reloadacl" command in console.
    1 point
×
×
  • Create New...