-
Posts
3,875 -
Joined
-
Days Won
67
Everything posted by DNL291
-
If you're not in a vehicle, the rest of the code will not run.
-
Eu coloquei para obter a posição hydra do invés do ped, parece que agora o misel chega ao chão. Client: addEvent("ControlState", true) addEvent("AnalogControlState", true) addEventHandler("onClientResourceStart", resourceRoot, function() setTimer(triggerServerEvent, 50, 1, "onTriggerHydraBot", localPlayer) end ) addEventHandler ( "ControlState", root, function ( thePed, control, bol ) setPedControlState ( thePed, control, bol ) end ) addEventHandler ( "AnalogControlState", root, function ( thePed, control, Time ) setPedAnalogControlState ( thePed, control, Time ) end ) function AtualizarPositionPedPilot() local vehicles = getElementsByType ( "vehicle" ) for _,theVehicle in ipairs(vehicles) do if (getElementData(theVehicle, "hydraMisel") == true) then local hx, hy, hz = getElementPosition(theVehicle) zzz = getGroundPosition ( hx, hy, hz ) end end end addEventHandler ( "onClientRender", getRootElement (), AtualizarPositionPedPilot ) addCommandHandler("shot", function() if (zzz) then triggerServerEvent("miselShot", localPlayer, zzz) end end ) Server: local misselRecarregado = 1 --86 ou 90 id dos misseis function MisselEmpty() misselRecarregado = 0 end function MisselReload() setTimer( function() misselRecarregado = 1 missel = createObject(3786, 0, 0, 0) attachElements ( missel, aviao, 0, 0, -2.12, 0, -90, 0 ) end, 10000, 1) end addEvent("onTriggerHydraBot", true) addEventHandler("onTriggerHydraBot", root, function() aviao = createVehicle ( 520, 2051.0708007813, -2494.2114257813, 14.546875, 0, 0, 90 ) pedPilot = createPed ( 287, 2050.0708007813, -2493.2114257813, 13.546875 ) setElementData(aviao, "hydraMisel", true) warpPedIntoVehicle ( pedPilot, aviao ) triggerClientEvent ( "ControlState", root, pedPilot, "accelerate", true ) setTimer( function() triggerClientEvent( "AnalogControlState", root, pedPilot, "special_control_up", 0.4 ) setVehicleLandingGearDown(aviao, false) missel = createObject(3786, 2050.0708007813, -2493.2114257813, 25.546875) attachElements ( missel, aviao, 0, 0, -2.12, 0, -90, 0 ) end, 10000, 1 ) end ) addEvent("miselShot", true) function ShotNow(miselPos) if (aviao and pedPilot and miselPos) then if (misselRecarregado == 1) then detachElements ( missel, aviao ) --setElementRotation(missel,0,-90,0) local x, y, z = getElementPosition(missel) moveObject(missel, 3500, x, y, z-tonumber(miselPos)) MisselEmpty() MisselReload() end end end addEventHandler("miselShot", root, ShotNow) Você pode aumentar/diminuir o tempo para o misel se mover na função moveObject.
-
Delete my old resource: https://community.multitheftauto.com/in ... ls&id=2146 DONE
-
No final do client: addCommandHandler("shot", function() if (zzz) then triggerServerEvent("miselShot", localPlayer, zzz) end end )
-
Como manawydan disse, o evento "onClientResourceStart" está ligado a função que irá tocar o som. Ou seja, o som irá tocar quando o recurso for iniciado.
-
Tente isso e diga o resultado: Client: addEvent("ControlState", true) addEvent("AnalogControlState", true) addEventHandler("onClientResourceStart", resourceRoot, function() setTimer(triggerServerEvent, 50, 1, "onTriggerHydraBot", localPlayer) end ) addEventHandler ( "ControlState", root, function ( thePed, control, bol ) setPedControlState ( thePed, control, bol ) end ) addEventHandler ( "AnalogControlState", root, function ( thePed, control, Time ) setPedAnalogControlState ( thePed, control, Time ) end ) function AtualizarPositionPedPilot() local peds = getElementsByType ( "ped" ) for theKey,thePed in ipairs(peds) do if getElementData(thePed, "PilotHydra") == true then local xp, yp, zp = getElementPosition(thePed) zzz = getGroundPosition ( xp, yp, zp ) end end end addEventHandler ( "onClientRender", getRootElement (), AtualizarPositionPedPilot ) addCommandHandler("shot", function(player) if (zzz) then triggerServerEvent("miselShot", player, zzz) end end ) Server: local misselRecarregado = 1 --86 ou 90 id dos misseis function MisselEmpty() misselRecarregado = 0 end function MisselReload() setTimer( function() misselRecarregado = 1 missel = createObject(3786, 0, 0, 0) attachElements ( missel, aviao, 0, 0, -2.12, 0, -90, 0 ) end, 10000, 1) end addEvent("onTriggerHydraBot", true) addEventHandler("onTriggerHydraBot", root, function() aviao = createVehicle ( 520, 2051.0708007813, -2494.2114257813, 14.546875, 0, 0, 90 ) pedPilot = createPed ( 287, 2050.0708007813, -2493.2114257813, 13.546875 ) setElementData(pedPilot, "PilotHydra", true) warpPedIntoVehicle ( pedPilot, aviao ) triggerClientEvent ( "ControlState", root, pedPilot, "accelerate", true ) setTimer( function() triggerClientEvent( "AnalogControlState", root, pedPilot, "special_control_up", 0.4 ) setVehicleLandingGearDown(aviao, false) missel = createObject(3786, 2050.0708007813, -2493.2114257813, 25.546875) attachElements ( missel, aviao, 0, 0, -2.12, 0, -90, 0 ) end, 10000, 1 ) end ) addEvent("miselShot", true) function ShotNow(miselPos) if (aviao and pedPilot and miselPos) then if (misselRecarregado == 1) then detachElements ( missel, aviao ) --setElementRotation(missel,0,-90,0) local x, y, z = getElementPosition(missel) moveObject(missel, 3500, x, y, z-tonumber(miselPos)) MisselEmpty() MisselReload() end end end addEventHandler("miselShot", root, ShotNow) Se você não estiver achando o tempo da função moveObject adequado, você pode calcular o tempo correto, obtendo a distância (Z) entre os 2 pontos e fazendo um calculo matemático para ter o tempo (em milisegundos) mais adequado para o objeto ser movido ao seu destino.
-
I also use Notepad++, I recommend using with Lua highlight. More information see this thread: https://forum.multitheftauto.com/viewto ... d3c651f384
-
The code has many errors. getElementData has two required arguments. Use guiSetVisible instead of destroyElement to close the window. The 'getSelectedTab' function doesn't exist, use guiGetSelectedTab instead.
-
Oh. I don't see another error in your code, just that. Maybe the condition at line 3 makes no sense.
-
Se você quer verificar constantemente a distância entre o ped e o chão, então é necessária. Mas recomendo você não usar um loop-for em todos os peds no evento onClientRender. Se puder, envie o elemento ped com triggerClientEvent, armazene o ped em algo ou em uma tabela e você obtém ele sem precisar de loop-for. Leve apenas como uma sugestão, faça isso se você quer um melhor desempenho para o script.
-
You have "riggerClientEvent" instead of triggerClientEvent in serverside.
-
Use um timer para o hydra andar e suba o trem de pouso. Dessa forma, client: addEvent("ControlState", true) addEvent("AnalogControlState", true) addEventHandler("onClientResourceStart", resourceRoot, function() setTimer(triggerServerEvent, 50, 1, "onTriggerHydraBot", localPlayer) end ) addEventHandler ( "ControlState", root, function ( thePed, control, bol ) setPedControlState ( thePed, control, bol ) end ) addEventHandler ( "AnalogControlState", root, function ( thePed, control, Time ) setPedAnalogControlState ( thePed, control, Time ) end ) Server: addEvent("onTriggerHydraBot", true) addEventHandler("onTriggerHydraBot", root, function() local aviao = createVehicle ( 520, 2051.0708007813, -2494.2114257813, 14.546875, 0, 0, 90 ) local pedPilot = createPed ( 287, 2050.0708007813, -2493.2114257813, 13.546875 ) warpPedIntoVehicle ( pedPilot, aviao ) triggerClientEvent ( "ControlState", root, pedPilot, "accelerate", true ) setTimer( function() triggerClientEvent( "AnalogControlState", root, pedPilot, "special_control_up", 0.4 ) setVehicleLandingGearDown(aviao, false) end, 10000, 1 ) end )
-
* Note : It's setSoundPaused ( with a small 's' in the beginning ) .. + addEvent addEventHandler That will not work. Use this in the event you want to: for _,theSound in ipairs(getElementsByType("sound")) do stopSound(theSound) end
-
É usada pra obter a altura entre o chão e as coordenadas passadas. Se você quer saber qual o nível Z (altura), entre um ped e o chão, basta você usar getElementPosition(thePed) para obter as posições X,Y,Z de um ped, e passá-las nos argumentos da função getGroundPosition. A função retornará o nível entre o chão e a posição que foi passada (o nível Z da posição do ped).
-
Use: getGroundPosition(x,y,z) É desanexar não desatachar.
-
localPlayer already is a predefined variable. localPlayer = getLocalPlayer() Is useless.
-
Yes, you can do this by admin panel > resources tab > manage ACL.
-
'table' is defined in Sasuke's code. If he had not set, he would have an error in debug. You can see that he is using 'table' in the first post. 'table' or 'groups' is returning nil. Make sure that the table is defined.
-
My bad. local groups = table["groups"] or "None" guiSetText(aclLabel, "Derechos en ACL: "..groups)
-
Stolen: https://community.multitheftauto.com/ind ... ls&id=6946 DONE and banned for being a bitch.
-
Try this: guiSetText(aclLabel, "Derechos en ACL: "..table["groups"] or "None") Is really difficult to know where the problem is because the code isn't full.
-
function aclGetAccountGroups ( account ) local acc = getAccountName ( account ) if ( not acc ) then return false end local res = {} acc = "user."..acc local all = "user.*" for ig, group in ipairs ( aclGroupList() ) do for io, object in ipairs ( aclGroupListObjects ( group ) ) do if ( ( acc == object ) or ( all == object ) ) then table.insert ( res, aclGroupGetName ( group ) ) break end end end return res end Ok, I could not see where the function was created.
-
aclGetAccountGroups function doesn't exist. https://wiki.multitheftauto.com/wiki/Se ... _functions