pacheco_ Posted August 5, 2023 Share Posted August 5, 2023 (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 August 6, 2023 by Lord Henry Código convertido de texto para Lua. Link to comment
Other Languages Moderators Lord Henry Posted August 6, 2023 Other Languages Moderators Share Posted August 6, 2023 Só colocar isso: if isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(player)), aclGetGroup ("Admin")) then -- Se o jogador está na ACL Group admin, então: Link to comment
pacheco_ Posted August 9, 2023 Author Share Posted August 9, 2023 mas eu coloco isso onde? antes de tudo, dentro de algum evendo ou oq? Link to comment
Other Languages Moderators Lord Henry Posted August 10, 2023 Other Languages Moderators Share Posted August 10, 2023 (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 August 10, 2023 by Lord Henry 1 Link to comment
pacheco_ Posted August 10, 2023 Author Share Posted August 10, 2023 vlw man, mt obrigado! Link to comment
Recommended Posts