Jump to content

Wumbaloo

Members
  • Posts

    292
  • Joined

  • Last visited

Everything posted by Wumbaloo

  1. WARNING: xy.lua:17: Bad argument @ 'guiCreateLabel' [Expected string at argument 5, got nil] Just add a string at argument 5, check out guiCreateLabel on Wiki guiCreateLabel WARNING: xy.lua:18: Bad argument @ 'guiLabelSetHorizontalAlign' [Expected gui-element at argument 1, got boolean] WARNING: xy.lua:19: Bad argument @ 'guiSetFont' [Expected gui-element at argument 1, got boolean] will be resolved by adding string for your GUIEditor_Label[1] triggerClientEvent(source, "szvzas", getRootElement()) need 2 arguments, v1 and v2
  2. In client side, outputChatBox don't need a visibleTo argument, so just remove 'root', check out the wiki of outputChatBox
  3. Use getPositionFromElementOffset in this example https://wiki.multitheftauto.com/wiki/GetElementMatrix function getPositionFromElementOffset(element,offX,offY,offZ) local m = getElementMatrix ( element ) -- Get the matrix local x = offX * m[1][1] + offY * m[2][1] + offZ * m[3][1] + m[4][1] -- Apply transform local y = offX * m[1][2] + offY * m[2][2] + offZ * m[3][2] + m[4][2] local z = offX * m[1][3] + offY * m[2][3] + offZ * m[3][3] + m[4][3] return x, y, z -- Return the transformed point end
  4. Like that ? I don't know if I understand you. local plants = {} function plant() if canPlant == true then local x, y, z = getElementPosition ( localPlayer ) local rx, ry, rz = getElementRotation ( localPlayer ) tempCol = createColCuboid ( x, y, z - 5, 10.0, 10.0, 10.0 ) planetObject = createObject ( 804 , x, y, z, rx, 0, 0 ) setElementData(planetObject, "colcuboid", tempCol, false) else if canPlant == true then outputChatBox ("you dont have plants") else outputChatBox ("you dont have tractor") end end end function takeWeed(theElement) for key, value in pairs(plants) do if value == theElement then outputChatBox ("work") -- if isElement(theElement) then -- destroyElement(theElement) -- end table.remove(plants, key, value) break end end end addEventHandler("onClientColShapeHit",getRootElement(),takeWeed)
  5. Oh sorry, I didn't understand you ^^
  6. If it's a stream like a radio (h24 online) I don't think you can getSoundLength.
  7. make colshape on your plants? And then use onColShapeHit ?
  8. So just add a SetTimer like this: function drawCarName() local player = getLocalPlayer() local vehicleName = getVehicleName(getPedOccupiedVehicle(player)) addEventHandler("onClientRender", getRootElement(), dxDrawCarName) setTimer(function () removeEventHandler("onClientRender", getRootElement(), dxDrawCarName) end, 3000, 1) end addEventHandler( "onClientVehicleEnter", getRootElement(), drawCarName) function dxDrawCarName() local vehicle = getPedOccupiedVehicle(getLocalPlayer()) if vehicle then dxDrawText ( getVehicleName(vehicle), 320, 380+115, 2500, 150, tocolor ( 255, 255, 255, 255 ), 1.5, "bankgothic" ) end end
  9. Wumbaloo

    Help.

    Use https://wiki.multitheftauto.com/wiki/On ... oubleClick
  10. Not tested but should work function drawCarName() local player = getLocalPlayer() local vehicleName = getVehicleName(getPedOccupiedVehicle(player)) addEventHandler("onClientRender", getRootElement(), dxDrawCarName) end addEventHandler( "onClientVehicleEnter", getRootElement(), drawCarName) function removeCarName() removeEventHandler("onClientRender", getRootElement(), dxDrawCarName) end addEventHandler( "onClientVehicleExit", getRootElement(), removeCarName) function dxDrawCarName() local vehicle = getPedOccupiedVehicle(getLocalPlayer()) if vehicle then dxDrawText ( getVehicleName(vehicle), 320, 380+115, 2500, 150, tocolor ( 255, 255, 255, 255 ), 1.5, "bankgothic" ) end end
  11. Wumbaloo

    Help.

    Use setPedAimTarget and setPedControlState
  12. Wumbaloo

    DX help

    I think I got you -- Server Side: function resourceStart() local col3 = createColSphere ( 0, 0, 5, 3 ) for _, player in ipairs(getElementsByType("player")) do if isElementWithinColShape(player, col3) then setTimer(function (thePlayer) triggerClientEvent("colshape:toggleDXRender", thePlayer) end, 50, 1, player) end end addEventHandler("onColShapeHit", col3, colShapeHit) addEventHandler("onColShapeLeave", col3, colShapeLeave) end addEventHandler("onResourceStart", getRootElement(), resourceStart) function colShapeHit(element, dimension) if getElementType(element) == "player" and dimension then triggerClientEvent("colshape:toggleDXRender", element) end end function colShapeLeave(element, dimension) if getElementType(element) == "player" and dimension then triggerClientEvent("colshape:toggleDXRender", element) end end -- Client Side local screenW, screenH = guiGetScreenSize() function toggleDXRender() dxRenderState = not dxRenderState if dxRenderState then addEventHandler("onClientRender", getRootElement(), dxDraw) dxRemoveDrawTimer = setTimer(function () removeEventHandler("onClientRender", getRootElement(), dxDraw) end, 1000*60, 1) else removeEventHandler("onClientRender", getRootElement(), dxDraw) end end addEvent("colshape:toggleDXRender", true) addEventHandler("colshape:toggleDXRender", getRootElement(), toggleDXRender) function dxDraw() dxDrawText("Updates", screenW*0.7891, screenH*0.7598, screenW*0.9187, screenH*0.8076, tocolor(255, 27, 27, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false) end
  13. Wumbaloo

    DX help

    I don't understand your english Someone else ?
  14. Wumbaloo

    DX help

    You want when the player join the game or every time ?
  15. Wumbaloo

    DX help

    This is client sided, it work, i tested it. You want a server side too ? I can do this.
  16. Wumbaloo

    DX help

    Here's when a player join the server All is client, do you want this on server side ? local screenW, screenH = guiGetScreenSize() function onPlayerJoin() local col3 = createColSphere ( 1787.3724365234, 1608.2197265625, 6.734375, 1000 ) setTimer(function () if isElementWithinColShape ( getLocalPlayer(), col3 ) then addEventHandler("onClientRender", getRootElement(), dxDraw) end end, 50, 1) end addEvent("onClientResourceStart") addEventHandler ( "onClientResourceStart", getRootElement(), onPlayerJoin ) function dxDraw() dxDrawText("Updates", screenW*0.7891, screenH*0.7598, screenW*0.9187, screenH*0.8076, tocolor(255, 27, 27, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false) end
  17. Wumbaloo

    DX help

    Like this ? local col3 = createColSphere ( 1787.3724365234, 1608.2197265625, 6.734375, 1000 ) function onPlayerJoin(thePlayer) if isElementWithinColShape ( thePlayer, col3 ) then addEventHandler("onClientRender", getRootElement(), dxDraw) end end addEvent("onColShapeHit") addEventHandler ( "onColShapeHit", col3, onPlayerJoin ) function dxDraw() dxDrawText("Updates", screenW*0.7891, screenH*0.7598, screenW*0.9187, screenH*0.8076, tocolor(255, 27, 27, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false) end
  18. No problem! Don't be sorry, I like help peoples
  19. Sorry, forgot arguments of onClientClick function getPositionFromElementOffset(element,offX,offY,offZ) local m = getElementMatrix ( element ) local x = offX * m[1][1] + offY * m[2][1] + offZ * m[3][1] + m[4][1] local y = offX * m[1][2] + offY * m[2][2] + offZ * m[3][2] + m[4][2] local z = offX * m[1][3] + offY * m[2][3] + offZ * m[3][3] + m[4][3] return x, y, z end function resourceStart() addEventHandler("onClientClick", getRootElement(), clickOnPed) thePed = createPed(120, 1053.97461, 2096.96313, 10.82031) end addEventHandler("onClientResourceStart", getRootElement(), resourceStart) function clickOnPed(button, state, x, y, worldX, worldY, worldZ, clickedWorld) if (button == "left" and state == "up") then if clickedWorld and getElementType(clickedWorld) == "ped" then local pedX, pedY, pedZ = getElementPosition(clickedWorld) local x, y, z = getPositionFromElementOffset(clickedWorld, 0, 3, 0) setCameraMatrix(x, y, z, pedX, pedY, pedZ) end end end
  20. Should work with every ped function getPositionFromElementOffset(element,offX,offY,offZ) local m = getElementMatrix ( element ) local x = offX * m[1][1] + offY * m[2][1] + offZ * m[3][1] + m[4][1] local y = offX * m[1][2] + offY * m[2][2] + offZ * m[3][2] + m[4][2] local z = offX * m[1][3] + offY * m[2][3] + offZ * m[3][3] + m[4][3] return x, y, z end function resourceStart() addEventHandler("onClientClick", getRootElement(), clickOnPed) thePed = createPed(120, 1053.97461, 2096.96313, 10.82031) end addEventHandler("onClientResourceStart", getRootElement(), resourceStart) function clickOnPed(button, state, x, y, z, worldX, worldY, worldZ, clickedWorld) if (button == "left" and state == "up") then if getElementType(clickedWorld) == "ped" then local pedX, pedY, pedZ = getElementPosition(clickedWorld) local x, y, z = getPositionFromElementOffset(clickedWorld, 0, 3, 0) setCameraMatrix(x, y, z, pedX, pedY, pedZ) end end end
  21. Use addEventHandler ( "onClientClick", getRootElement(), clickOnPed) https://wiki.multitheftauto.com/wiki/OnClientClick to get the element and check if it's a ped using getElementType and then use setCameraTarget to set the camera target on the ped like function resourceStart() addEventHandler("onClientClick", getRootElement(), clickOnPed) end addEventHandler("onClientResourceStart", getRootElement(), resourceStart) function clickOnPed(button, state, x, y, z, worldX, worldY, worldZ, clickedWorld) if (button == "left" and state == "up") then if getElementType(clickedWorld) == "ped" then setCameraTarget(ped) end end end
  22. onClientResourceStart is an event, use it like this: addEventHandler( "onClientResourceStart", getRootElement( ), function ( startedRes ) outputChatBox( "Resource started: " .. getResourceName( startedRes ) ) end ) Use a table, for loop and setTimer to make this local cameraPos = { [1] = {0, 0, 0, 2, 2, 2} [2] = {2, 2, 2, 0, 0, 0} } cameraTimerPosition = 0 for _, position in ipairs(cameraPos) do cameraTimerPosition = cameraTimerPosition + 10000 setTimer(moveCamera, cameraTimerPosition, 1, position) end function moveCamera(position) local x, y, z, lx, ly, lz = getCameraMatrix() smoothMoveCamera(x, y, z, lx, ly, lz, position[1], position[2], position[3], position[4], position[5], position[6], 1000) end
  23. At time you need to set at least 50 ms, because setTimer needs a minimum of 50 ms. Use your code in a function like onClientResourceStart
×
×
  • Create New...