Jump to content

Spawn de carro por acl


Recommended Posts

Posted (edited)

Eu estava tentando colocar esse spawn de vehiculo por acl, mas não estou conseguindo. Alguém consegue me ajudar?

veh = {}

addEventHandler("onResourceStart", resourceRoot, function()
    for i, v in ipairs(spawn) do
       local veh = createVehicle(v[1], v[2], v[3], v[4], v[5], v[6], v[7])
       setElementCollisionsEnabled(veh, false)
       setElementData(veh, "vehSpawn", true)
       setElementFrozen(veh, true)
       setVehicleDamageProof(veh, true)
    end
end)


addEventHandler("onVehicleEnter", getRootElement(), function(player)
    if source and getElementType(source) == "vehicle" then
        local model = getElementModel(source)
        local x, y, z = getElementPosition(source)
        if getElementData(source, "vehSpawn") then
            if veh[player] and isElement(veh[player]) then
                destroyElement(veh[player])
            end
            veh[player] = createVehicle(model, x+3, y, z)
            warpPedIntoVehicle(player, veh[player])
        end
    end
end)


addEventHandler("onPlayerWasted", root, function()
    if veh[source] and isElement(veh[source]) then
        destroyElement(veh[source])
    end
end)

addEventHandler("onPlayerLogout", root, function()
    if veh[source] and isElement(veh[source]) then
        destroyElement(veh[source])
    end
end)

addEventHandler("onPlayerQuit", root, function()
    if veh[source] and isElement(veh[source]) then
        destroyElement(veh[source])
    end
end)

 

Edited by Lord Henry
Código convertido de texto para Lua.
  • Moderators
Posted

Só colocar isso:

     if isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(player)), aclGetGroup ("Admin")) then -- Se o jogador está na ACL Group admin, então:

 

Eu te ajudei ou achou meu comentário útil? Não esqueça de deixar um Thanksspacer.png

Minhas contribuições para a comunidade: LordHenry - MTA Wiki Profile
Inscreva-se no meu canal do YouTube: Lord Henry - Entertainment
Discord Oficial do MTA: https://mtasa.com/discord
Blacklist e Whitelist de Scripters: Planilha

Por favor, não me envie mensagens privadas solicitando suporte. Crie um tópico no fórum em vez disso.

  • Moderators
Posted (edited)

Troque aquela sua função por esta:

addEventHandler("onVehicleEnter", root, function(player)
    if isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(player)), aclGetGroup ("Admin")) then
        local model = getElementModel(source)
        local x, y, z = getElementPosition(source)
        if getElementData(source, "vehSpawn") then
            if veh[player] and isElement(veh[player]) then
                destroyElement(veh[player])
            end
            veh[player] = createVehicle(model, x+3, y, z)
            warpPedIntoVehicle(player, veh[player])
        end
    else
        outputChatBox("Acesso negado.", player, 255, 50, 50)
        removePedFromVehicle(player)
    end
end)

 

Edited by Lord Henry
  • Thanks 1

Eu te ajudei ou achou meu comentário útil? Não esqueça de deixar um Thanksspacer.png

Minhas contribuições para a comunidade: LordHenry - MTA Wiki Profile
Inscreva-se no meu canal do YouTube: Lord Henry - Entertainment
Discord Oficial do MTA: https://mtasa.com/discord
Blacklist e Whitelist de Scripters: Planilha

Por favor, não me envie mensagens privadas solicitando suporte. Crie um tópico no fórum em vez disso.

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...