local markCoords = {
{x, y, z}, -- Troque o x, y, z pela posição x, y, z do marker
{x, y, z}, -- Faça o mesmo no segundo marker.
{x, y, z}, -- E assim por diante.
}
local markers = {} -- Tabela vazia, onde os markers ficarão ao serem criados.
for i, item in ipairs (markCoords) do -- Para cada item da tabela markCoords, faça:
local x, y, z = unpack(item) -- x, y, z recebem a posição do item da tabela markCoords.
markers[i] = createMarker(x, y, z, "cylinder", 1.1, 255, 255, 255, 50) -- Cria o marker nessa posição e coloca ele na tabela markers.
end
addEventHandler("onMarkerHit", resourceRoot, function(hitElement) -- Faz com que essa função só ative para markers criados neste resource.
if getElementType(hitElement) == "player" then
outputChatBox(" ", hitElement) -- Textos vazios não precisam de parâmetros de cor.
outputChatBox("Para começar a trabalhar, digite #ffff00/trabalhar ", hitElement, 255, 255, 255, true)
outputChatBox(" ", hitElement)
end
end)
function salariopm(thePlayer) -- Policial.
for i, marker in ipairs (markers) do -- Para cada marker da tabela markers, faça:
if isElementWithinMarker(thePlayer, marker) then -- Se o jogador está dentro desse marker, então:
if isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup(Grupo1)) then -- Grupo1 dará erro se você não declarar essa variável antes em algum lugar.
if getElementData(thePlayer, "TrabalhoPolicial") then
setElementData(thePlayer, "TrabalhoPolicial", false)
outputChatBox("Você #ff0000saiu #009affde serviço!", thePlayer, 0, 154, 255, true)
setElementModel(thePlayer, 0)
else
setElementData(thePlayer, "TrabalhoPolicial", true)
outputChatBox("Você #006effentrou #009affem serviço, bom trabalho!", thePlayer, 0, 154, 255, true)
setElementModel(thePlayer, 283)
end
else
outputChatBox("Você não tem permissão para isso.", thePlayer, 255, 0, 0, true)
end
break -- Sai do loop pois já encontrou o marker em que o jogador está.
end
end
end
addCommandHandler("trabalhar", salariopm)