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.
  • Other Languages Moderators
Posted

Só colocar isso:

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

 

  • Other Languages 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
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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