Jump to content

Zango

Discord Moderators
  • Posts

    681
  • Joined

  • Last visited

  • Days Won

    11

Everything posted by Zango

  1. There is no way for peds (bots) to enter a car like players do. You can only send them directly to the car with warpPedIntoVehicle.
  2. local weapon_table = { -- model, id [30] = { [422]=10, --Bobcat [596]=9, --PoliceLS }, } function getElementSpeed(theElement, unit) -- Check arguments for errors assert(isElement(theElement), "Bad argument 1 @ getElementSpeed (element expected, got " .. type(theElement) .. ")") local elementType = getElementType(theElement) assert(elementType == "player" or elementType == "ped" or elementType == "object" or elementType == "vehicle" or elementType == "projectile", "Invalid element type @ getElementSpeed (player/ped/object/vehicle/projectile expected, got " .. elementType .. ")") assert((unit == nil or type(unit) == "string" or type(unit) == "number") and (unit == nil or (tonumber(unit) and (tonumber(unit) == 0 or tonumber(unit) == 1 or tonumber(unit) == 2)) or unit == "m/s" or unit == "km/h" or unit == "mph"), "Bad argument 2 @ getElementSpeed (invalid speed unit)") -- Default to m/s if no unit specified and 'ignore' argument type if the string contains a number unit = unit == nil and 0 or ((not tonumber(unit)) and unit or tonumber(unit)) -- Setup our multiplier to convert the velocity to the specified unit local mult = (unit == 0 or unit == "m/s") and 50 or ((unit == 1 or unit == "km/h") and 180 or 111.84681456) -- Return the speed by calculating the length of the velocity vector, after converting the velocity to the specified unit return (Vector3(getElementVelocity(theElement)) * mult).length end addEventHandler("onClientVehicleDamage", root, function(attacker,weapon,loss,dmgx,dmgy,dmgz,tireid) if tireid then return end if getElementData(source,'god-mode') then return end if isVehicleDamageProof(source) then return end if attacker and getElementType(attacker)=='player' then if dmg_table[getElementModel(source)] then cancelEvent() setElementHealth(source,getElementHealth(source)-(dmg_table[getElementModel(source)]+weapon_table[weapon][getElementModel(source)])) print(getElementHealth(source)) end --elseif attacker~=('vehicle' or 'ped') then --setElementHealth(source,getElementHealth(source)-(getElementSpeed(source,1)/30*10)) end end) Try this. I added line 25. I haven't tested it, but I assume tireid is nil if no tire was hit.
  3. Hello and welcome to MTA. Your code looks fine, looks like you store the rotation correctly. I think the issue is in your database. You might have a row in your "vehicles" table that doesn't contain anything in rotation_x. So your vehicle is not created on line 34 (MTA gives you a warning). But then your code fails because it thinks vehicle_object is created (line 38). So try deleting the "vehicles" table and creating it again.
  4. Without testing it, the matchingDimension parameter should work and tell you if the element hit the colshape in the right dimension. Can you post your code?
  5. Use the partial animation crry_prtial for walking while holding the crate. Set last parameter to true (freezeLastFrame). setPedAnimation(localPlayer, "carry", "crry_prtial", 0, false, true, true, true)
  6. Pass 0 (or something else) in the 'time' parameter and controls should work. setPedAnimation(localPlayer, "ped", "run_fat", 0)
  7. Do you want a player to control it? Take a look at the weapon creation functions here and attachElements.
  8. Try not using -1 in the time parameter. setPedAnimation(localPlayer, "ped", "run_fat", 0)
  9. (math.deg(aSine) + 90) % 360 Add 90 to get 0 at the green line, and use modulus (% 360) so it counts from 0 when it reaches 360 (361 % 360 is 1)
  10. Lua has math.deg to convert radians. You can add 180 degrees to get 0-360. If that was your question? local sX, sY = guiGetScreenSize() local centerX = sX/2 local centerY = sY/2 addEventHandler("onClientRender", root, function() if isCursorShowing() then local px,py = getCursorPosition() local mx,my = sX*px,sY*py local aSine = math.atan2(my-centerY, mx-centerX) local degrees = math.deg(aSine) + 180 dxDrawText(tostring(degrees), 400, 400) end end)
  11. -- ***************** -- Beginning of colorful GUI functions -- ***************** genelGuiTablo = {} --guiCreateWindow wtablo = {} --guiCreateButton btablo = {} --guiCreateGridList Ltablo = {} --guiCreateMemo mtablo = {} --guiCreateEdit etablo = {} function resimOlustur(isim) if fileExists(isim.."png") then return isim.."png" end local texture = dxCreateTexture(1,1) local pixels = dxGetTexturePixels(texture) local r,g,b,a = 155,155,155,155 dxSetPixelColor(pixels,0,0,r,g,b,a) dxSetTexturePixels(texture, pixels) local pxl = dxConvertPixels(dxGetTexturePixels(texture),"png") local nImg = fileCreate(isim..".png") fileWrite(nImg,pxl) fileClose(nImg) return isim..".png" end function renkVer(resim,hex) guiSetProperty(resim,"ImageColours","tl:FF"..hex.." tr:FF"..hex.." bl:FF"..hex.." br:FF"..hex) end _guiCreateWindow = guiCreateWindow function guiCreateWindow(x,y,g,u,yazi,relative,parent,renk1,renk2,renk3,renk4,kapatkutu) wsayi = #wtablo +1 if not renk1 or string.len(renk1) > 6 then renk1 = "ED7717" -- window renk üst taraf // window top color end if not renk2 or string.len(renk2) > 6 then renk2 = "ED7717" -- window renk alt taraf // window bottom color end if not renk3 or string.len(renk3) > 6 then renk3 = "131314" -- baslik renk // window header back color end if not renk4 or string.len(renk4) > 6 then renk4 = "1883D7" -- window kenar çizgi // window outline color end if relative then px,pu = guiGetSize(parent,false) x,y,g,u = x*px,y*pu,g*px,u*pu relative = false end if not wtablo[wsayi] then wtablo[wsayi] = {} end --arkaResim wtablo[wsayi].resim = guiCreateStaticImage(x,y,g,u,resimOlustur("test"),relative,parent) renkVer(wtablo[wsayi].resim,renk1) guiSetProperty(wtablo[wsayi].resim,"ImageColours","tl:FF"..renk1.." tr:FF"..renk1.." bl:FF"..renk2.." br:FF"..renk2.."") --baslıkArka wtablo[wsayi].basarka = guiCreateStaticImage(0,0,g,20, resimOlustur("test"), false, wtablo[wsayi].resim) renkVer(wtablo[wsayi].basarka,renk3) --kenarlar wtablo[wsayi].kenarlar = { ordaUst = guiCreateStaticImage(0,0,g,1,resimOlustur("test"), false, wtablo[wsayi].resim), ortaAlt = guiCreateStaticImage(0,u-1,g,1,resimOlustur("test"), false, wtablo[wsayi].resim), sol = guiCreateStaticImage(0,0,1,u,resimOlustur("test"), false, wtablo[wsayi].resim), sag = guiCreateStaticImage(g-1,0,1,u,resimOlustur("test"), false, wtablo[wsayi].resim) } for i,v in pairs(wtablo[wsayi].kenarlar) do renkVer(v,renk4) guiSetProperty(v, "AlwaysOnTop", "True") guiSetAlpha(v, 0.4) end --baslıkLabel wtablo[wsayi].label = guiCreateLabel((g/2)-((string.len(yazi)*8)/2),0,(string.len(yazi)*8),20, yazi, false, wtablo[wsayi].basarka) guiSetFont(wtablo[wsayi].label, "default-bold-small") guiLabelSetHorizontalAlign(wtablo[wsayi].label, "center") guiLabelSetVerticalAlign(wtablo[wsayi].label, "center") return wtablo[wsayi].resim end _guiCreateButton = guiCreateButton function guiCreateButton(x,y,g,u,yazi,relative,parent,renk1,renk2) bsayi = #btablo +1 if not btablo[bsayi] then btablo[bsayi] = {} end if not renk1 or string.len(renk1) > 6 then --renk = math.random(999999) renk1 = "ff0000" -- genel buton rengi // button back color end if not renk2 or string.len(renk2) > 6 then renk2 = "FFFFFF" -- buton kenar rengi // button outline color end --arkaResim if relative then px,pu = guiGetSize(parent,false) x,y,g,u = x*px,y*pu,g*px,u*pu relative = false end btablo[bsayi].resim = guiCreateStaticImage(x,y,g,u,resimOlustur("test"),relative,parent) renkVer(btablo[bsayi].resim,renk1) --kenarlar btablo[bsayi].kenarlar = { ortaUst = guiCreateStaticImage(0,0,g,1,resimOlustur("test"), relative, btablo[bsayi].resim), ortaAlt = guiCreateStaticImage(0,u-1,g,1,resimOlustur("test"), relative, btablo[bsayi].resim), sol = guiCreateStaticImage(0,0,1,u,resimOlustur("test"), relative, btablo[bsayi].resim), sag = guiCreateStaticImage(g-1,0,1,u,resimOlustur("test"), relative, btablo[bsayi].resim) } for i,v in pairs(btablo[bsayi].kenarlar) do renkVer(v,renk2) guiSetAlpha(v, 0.4) end --label btablo[bsayi].label = guiCreateLabel(0,0,g,u,yazi,relative,btablo[bsayi].resim) guiLabelSetHorizontalAlign(btablo[bsayi].label, "center") guiLabelSetVerticalAlign(btablo[bsayi].label, "center") guiSetFont(btablo[bsayi].label, "default-bold-small") genelGuiTablo[btablo[bsayi].label] = btablo[bsayi].kenarlar return btablo[bsayi].label end _guiCreateGridList = guiCreateGridList function guiCreateGridList(x,y,g,u,relative,parent,kenarrenk) Ssayi = #Ltablo +1 if not kenarrenk or string.len(kenarrenk) > 6 then kenarrenk = "1883D7" -- gridlist kenar renk // gridlist outline color end if not Ltablo[Ssayi] then Ltablo[Ssayi] = {} end if relative then px,pu = guiGetSize(parent,false) x,y,g,u = x*px,y*pu,g*px,u*pu end local relative = false Ltablo[Ssayi].resim = guiCreateLabel(x,y,g,u, "", relative, parent) Ltablo[Ssayi].liste = _guiCreateGridList(-8,-8,g+10, u+10,false, Ltablo[Ssayi].resim) Ltablo[Ssayi].kenarlar = { ortaUst = guiCreateStaticImage(0,0,g,1,resimOlustur("test"), false, Ltablo[Ssayi].resim), ortaAlt = guiCreateStaticImage(0,u-1,g,1,resimOlustur("test"), false, Ltablo[Ssayi].resim), sol = guiCreateStaticImage(0,0,1,u,resimOlustur("test"), false, Ltablo[Ssayi].resim), sag = guiCreateStaticImage(g-1,0,1,u,resimOlustur("test"), false, Ltablo[Ssayi].resim)} genelGuiTablo[Ltablo[Ssayi].liste] = Ltablo[Ssayi].kenarlar for i,v in pairs(Ltablo[Ssayi].kenarlar) do renkVer(v,kenarrenk) guiSetProperty(v, "AlwaysOnTop", "True") guiSetAlpha(v, 0.4) end return Ltablo[Ssayi].liste end _guiCreateEdit = guiCreateEdit function guiCreateEdit(x,y,g,u,yazi,relative,parent,kenarrenk) esayi = #etablo +1 if not kenarrenk or string.len(kenarrenk) > 6 then kenarrenk = "1883D7" -- edit kenar renk // edit outline color end if not etablo[esayi] then etablo[esayi] = {} end if relative then px,pu = guiGetSize(parent,false) x,y,g,u = x*px,y*pu,g*px,u*pu end local relative = false etablo[esayi].resim = guiCreateLabel(x,y,g,u, "", relative, parent) etablo[esayi].edit = _guiCreateEdit(-7,-5,g+15, u+8,yazi,false, etablo[esayi].resim) etablo[esayi].kenarlar = { ortaUst = guiCreateStaticImage(0,0,g,1,resimOlustur("test"), false, etablo[esayi].resim), ortaAlt = guiCreateStaticImage(0,u-1,g,1,resimOlustur("test"), false, etablo[esayi].resim), sol = guiCreateStaticImage(0,0,1,u,resimOlustur("test"), false, etablo[esayi].resim), sag = guiCreateStaticImage(g-1,0,1,u,resimOlustur("test"), false, etablo[esayi].resim) } genelGuiTablo[etablo[esayi].edit] = etablo[esayi].kenarlar for i,v in pairs(etablo[esayi].kenarlar) do renkVer(v,kenarrenk) guiSetProperty(v, "AlwaysOnTop", "True") guiSetAlpha(v, 0.4) end return etablo[esayi].edit end _guiCreateMemo = guiCreateMemo function guiCreateMemo(x,y,g,u,yazi,relative,parent,kenarrenk) msayi = #mtablo +1 if not kenarrenk or string.len(kenarrenk) > 6 then kenarrenk = "1883D7" -- memo kenar renk // memo outline color end if not mtablo[msayi] then mtablo[msayi] = {} end if relative then px,pu = guiGetSize(parent,false) x,y,g,u = x*px,y*pu,g*px,u*pu end local relative = false mtablo[msayi].resim = guiCreateLabel(x,y,g,u, "", relative, parent) mtablo[msayi].memo = _guiCreateMemo(-5,-10,g+15, u+10, yazi,false, mtablo[msayi].resim) mtablo[msayi].kenarlar = { ortaUst = guiCreateStaticImage(0,0,g,1,resimOlustur("test"), false, mtablo[msayi].resim), ortaAlt = guiCreateStaticImage(0,u-1,g,1,resimOlustur("test"), false, mtablo[msayi].resim), sol = guiCreateStaticImage(0,0,1,u,resimOlustur("test"), false, mtablo[msayi].resim), sag = guiCreateStaticImage(g-1,0,1,u,resimOlustur("test"), false, mtablo[msayi].resim)} genelGuiTablo[mtablo[msayi].memo] = mtablo[msayi].kenarlar for i,v in pairs(mtablo[msayi].kenarlar) do renkVer(v,kenarrenk) guiSetProperty(v, "AlwaysOnTop", "True") guiSetAlpha(v, 0.4) end return mtablo[msayi].memo end --edit,gridlst,buton,memo mouse addEventHandler("onClientMouseEnter", resourceRoot, function() for i,v in pairs(genelGuiTablo) do if source == i then for i,v in pairs(v) do guiSetAlpha(v, 1) end end end end) addEventHandler("onClientMouseLeave", resourceRoot, function() for i,v in pairs(genelGuiTablo) do if source == i then for i,v in pairs(v) do guiSetAlpha(v, 0.4) end end end end) function butonmu(label) for i,v in pairs(btablo) do if v.label == label then return i end end return false end function penceremi(resim) for i,v in pairs(wtablo) do if v.resim == resim then return i end end return false end function editmi(edit) for i,v in pairs(etablo) do if v.edit == edit then return i end end return false end function gridlistmi(liste) for i,v in pairs(Ltablo) do if v.liste == liste then return i end end return false end function memomu(memo) for i,v in pairs(mtablo) do if v.memo == memo then return i end end return false end function basliklabelmi(label) for i,v in pairs(wtablo) do if v.label == label then return i end end return false end function baslikmi(element) for i,v in pairs(wtablo) do if v.basarka == element or wtablo[basliklabelmi(element)] and v.label == element then return i end end return false end --basinca olan ufalma // anim when click basili = {} addEventHandler("onClientGUIMouseDown", resourceRoot, function() if butonmu(source) then if basili[source] then return end basili[source] = true local g,u = guiGetSize(source, false) local x,y = guiGetPosition(source, false) guiSetPosition(source, x+2,y+2, false) guiSetSize(source, g-4,u-4, false) end end) addEventHandler("onClientGUIMouseUp", resourceRoot, function() if butonmu(source) then if not basili[source] then for i,v in pairs(basili) do if v == true then source = i break end end end if not basili[source] then return end basili[source] = nil local g,u = guiGetSize(source, false) local x,y = guiGetPosition(source, false) guiSetPosition(source, x-2,y-2, false) guiSetSize(source, g+4,u+4, false) else for i,v in pairs(basili) do if v == true then source = i break end end if butonmu(source) then basili[source] = nil local g,u = guiGetSize(source, false) local x,y = guiGetPosition(source, false) guiSetPosition(source, x-2,y-2, false) guiSetSize(source, g+4,u+4, false) end end end) function basiliBirak() for i,v in pairs(basili) do if v == true then source = i break end end if butonmu(source) then basili[source] = nil local g,u = guiGetSize(source, false) local x,y = guiGetPosition(source, false) guiSetPosition(source, x-2,y-2, false) guiSetSize(source, g+4,u+4, false) end end addEventHandler("onClientClick", root, function(button, durum, _, _, _, _, _, tiklanan) if durum == "up" then if tiklanan then local element = getElementType(tiklanan) if not string.find(element, "gui-") then basiliBirak() end else basiliBirak() end end end) --panel taşıma // window drag and move addEventHandler( "onClientGUIMouseDown", resourceRoot,function ( btn, x, y ) if btn == "left" and baslikmi(source) then local source = wtablo[baslikmi(source)].resim clickedElement = source local elementPos = { guiGetPosition( source, false ) } offsetPos = { x - elementPos[ 1 ], y - elementPos[ 2 ] }; end end) addEventHandler( "onClientGUIMouseUp", resourceRoot,function ( btn, x, y ) if btn == "left" and baslikmi(source) then clickedElement = nil end end) addEventHandler( "onClientCursorMove", getRootElement( ),function ( _, _, x, y ) if clickedElement then guiSetPosition( clickedElement, x - offsetPos[ 1 ], y - offsetPos[ 2 ], false ) end end) --diğer funclar // other funcs _guiGetPosition = guiGetPosition function guiGetPosition(element,relative) if butonmu(element) then local sira = butonmu(element) local x,y = _guiGetPosition(btablo[sira].resim, relative) return x,y else local x,y = _guiGetPosition(element, relative) return x,y end end _guiSetPosition = guiSetPosition function guiSetPosition(element,x,y,relative) if butonmu(element) then local sira = butonmu(element) _guiSetPosition(btablo[sira].resim, x,y, relative) else _guiSetPosition(element,x,y,relative) end end _guiGetSize = guiGetSize function guiGetSize(element,relative) if butonmu(element) then local sira = butonmu(element) local g,u = _guiGetSize(btablo[sira].resim, relative) return g,u else local g,u = _guiGetSize(element, relative) return g,u end end _guiSetSize = guiSetSize function guiSetSize(element,g,u,relative) if butonmu(element) then local sira = butonmu(element) _guiSetSize(btablo[sira].resim, g,u, false) _guiSetSize(btablo[sira].label, g,u, false) --sağ kenar çizgi _guiSetPosition(btablo[sira].kenarlar.sag, g-1, 0, false) _guiSetSize(btablo[sira].kenarlar.sag, 1,u, false) --alt kenar çizgi _guiSetPosition(btablo[sira].kenarlar.ortaAlt, 0, u-1, false) _guiSetSize(btablo[sira].kenarlar.ortaAlt, g,1, false) elseif penceremi(element) then local sira = penceremi(element) _guiSetSize(wtablo[sira].resim, g,u, false) --sağ kenar çizgi _guiSetPosition(wtablo[sira].kenarlar.sag, g-1, 0, false) _guiSetSize(wtablo[sira].kenarlar.sag, 1,u, false) --alt kenar çizgi _guiSetPosition(wtablo[sira].kenarlar.ortaAlt, 0, u-1, false) _guiSetSize(wtablo[sira].kenarlar.ortaAlt, g,1, false) --baslik _guiSetSize(wtablo[sira].basarka, g,20, false) --kapat _guiSetPosition(wtablo[sira].kapatArka, g-25,1, false) --label local yazi = guiGetText(wtablo[sira].label) _guiSetPosition(wtablo[sira].label, (g/2)-((string.len(yazi)*8)/2),0, false) _guiSetSize(wtablo[sira].label,(string.len(yazi)*8),20, false) guiLabelSetHorizontalAlign(wtablo[sira].label, "center") guiLabelSetVerticalAlign(wtablo[sira].label, "center") end end _guiSetText = guiSetText function guiSetText(element, yazi) if penceremi(element) then local sira = penceremi(element) local g,u = guiGetSize(wtablo[sira].resim,false) guiSetPosition(wtablo[sira].label,(g/2)-((string.len(yazi)*8)/2),0, false) guiSetSize(wtablo[sira].label, (string.len(yazi)*8),20, false) guiLabelSetHorizontalAlign(wtablo[sira].label, "center") guiLabelSetVerticalAlign(wtablo[sira].label, "center") _guiSetText(wtablo[sira].label, yazi) else _guiSetText(element, yazi) end end _guiGetText = guiGetText function guiGetText(element) if penceremi(element) then local sira = penceremi(element) local yazi = _guiGetText(wtablo[sira].label) return yazi else local yazi = _guiGetText(element) return yazi end end _guiSetEnabled = guiSetEnabled function guiSetEnabled(element, bool) if butonmu(element) then if bool == false then guiSetAlpha(btablo[butonmu(element)].resim,0.5) _guiSetEnabled(element, bool) else guiSetAlpha(btablo[butonmu(element)].resim,1) _guiSetEnabled(element, bool) end else _guiSetEnabled(element, bool) end end _guiSetVisible = guiSetVisible function guiSetVisible(element, bool) if butonmu(element) then local sira = butonmu(element) _guiSetVisible(btablo[sira].resim, bool) else _guiSetVisible(element, bool) end end _destroyElement = destroyElement function destroyElement(element) if butonmu(element) then local sira = butonmu(element) _destroyElement(btablo[sira].resim) btablo[sira] = nil elseif editmi(element) then local sira = editmi(element) _destroyElement(etablo[sira].resim) etablo[sira] = nil elseif gridlistmi(element) then local sira = gridlistmi(element) _destroyElement(Ltablo[sira].resim) Ltablo[sira] = nil elseif memomu(element) then local sira = memomu(element) _destroyElement(mtablo[sira].resim) mtablo[sira] = nil else _destroyElement(element) end end _guiWindowSetSizable = guiWindowSetSizable function guiWindowSetSizable(element, bool) if getElementType(element) ~= "gui-window" then return false else _guiWindowSetSizable(element, bool) end end -- ***************** -- End of colorful GUI functions -- ***************** -- ***************** -- Beginning of arabic GUI -- ***************** GUIEditor = { button = {}, window = {}, label = {} } local screenW, screenH = guiGetScreenSize() GUIEditor.window[1] = guiCreateWindow((screenW - 468) / 2, (screenH - 348) / 2, 468, 348, "التحكم بالسيارة", false) guiWindowSetSizable(GUIEditor.window[1], false) FarolOff = guiCreateButton(257, 63, 83, 35, "إيقاف", false, GUIEditor.window[1]) MotorOff = guiCreateButton(257, 141, 83, 35, "إيقاف", false, GUIEditor.window[1]) FarolOn = guiCreateButton(360, 63, 83, 35, "تشغيل", false, GUIEditor.window[1]) MotorOn = guiCreateButton(360, 141, 83, 35, "تشغيل", false, GUIEditor.window[1]) Capoo = guiCreateScrollBar(22, 57, 194, 19, true, false, GUIEditor.window[1]) PortaEsquedra1f = guiCreateScrollBar(22, 102, 194, 19, true, false, GUIEditor.window[1]) PortaDireita1 = guiCreateScrollBar(22, 152, 194, 19, true, false, GUIEditor.window[1]) PortaEsquedra2 = guiCreateScrollBar(22, 201, 194, 19, true, false, GUIEditor.window[1]) PortaDireita2 = guiCreateScrollBar(22, 252, 194, 19, true, false, GUIEditor.window[1]) PortaMalas = guiCreateScrollBar(22, 305, 194, 19, true, false, GUIEditor.window[1]) GUIEditor.label[1] = guiCreateLabel(79, 34, 85, 19, "الكبوت", false, GUIEditor.window[1]) guiLabelSetHorizontalAlign(GUIEditor.label[1], "center", false) guiLabelSetVerticalAlign(GUIEditor.label[1], "center") GUIEditor.label[2] = guiCreateLabel(79, 83, 85, 19, "الباب - يسار", false, GUIEditor.window[1]) guiLabelSetHorizontalAlign(GUIEditor.label[2], "center", false) guiLabelSetVerticalAlign(GUIEditor.label[2], "center") GUIEditor.label[3] = guiCreateLabel(79, 131, 85, 19, "الباب - يمين", false, GUIEditor.window[1]) guiLabelSetHorizontalAlign(GUIEditor.label[3], "center", false) guiLabelSetVerticalAlign(GUIEditor.label[3], "center") GUIEditor.label[4] = guiCreateLabel(74, 181, 95, 20, "الباب - خلف يسار", false, GUIEditor.window[1]) guiLabelSetHorizontalAlign(GUIEditor.label[4], "center", false) guiLabelSetVerticalAlign(GUIEditor.label[4], "center") GUIEditor.label[5] = guiCreateLabel(79, 286, 85, 19, "الشنطة", false, GUIEditor.window[1]) guiLabelSetHorizontalAlign(GUIEditor.label[5], "center", false) guiLabelSetVerticalAlign(GUIEditor.label[5], "center") GUIEditor.label[6] = guiCreateLabel(74, 230, 95, 20, "الباب - خلف يمين", false, GUIEditor.window[1]) guiLabelSetHorizontalAlign(GUIEditor.label[6], "center", false) guiLabelSetVerticalAlign(GUIEditor.label[6], "center") GUIEditor.button[1] = guiCreateButton(267, 210, 172, 38, "فك الصدام الامامي", false, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(267, 267, 172, 38, "فك الصدام الخلفي", false, GUIEditor.window[1]) GUIEditor.label[7] = guiCreateLabel(308, 34, 85, 19, "النور", false, GUIEditor.window[1]) guiLabelSetHorizontalAlign(GUIEditor.label[7], "center", false) guiLabelSetVerticalAlign(GUIEditor.label[7], "center") GUIEditor.label[8] = guiCreateLabel(308, 112, 85, 19, "المحرك", false, GUIEditor.window[1]) guiLabelSetHorizontalAlign(GUIEditor.label[8], "center", false) guiLabelSetVerticalAlign(GUIEditor.label[8], "center") -- ***************** -- End of arabic GUI -- ***************** As I mentioned, I just put the first code you posted together with your GUI code
  12. Your colorful GUI is created by the code you posted. It replaces the MTA functions. For example in guiCreateWindow it creates an image as background instead of an actual window. Same for the buttons. And then it stores the original MTA function in _guiCreateWindow. You just need to take that code and put it into the other GUI. Post the code for the arabic GUI and I'll do it for you.
  13. I think you created two topics on the same issue m8
  14. Use the <> symbol to put your code into the right format when posting You can unpack your table values into variables like this local x, y, z = unpack(fix[math.random(#fix)]) JailEscapeMarker1 = createMarker(x, y, z, "arrow", 1.5, 255, 255, 0, 150) You can also do this local randomKey = math.random(#fix) JailEscapeMarker1 = createMarker(fix[randomKey][1], fix[randomKey][2], fix[randomKey][3], "arrow", 1.5, 255, 255, 0, 150)
  15. Yes that will work. In your case you want to find the forwards position function getMatrixForward(m) return m[2][1], m[2][2], m[2][3] end local mat = getElementMatrix(element) -- Get the matrix local x, y, z = getMatrixForward(mat) -- Get the matrix forward direction local offset = 1 -- Our offset length, how far forwards you want the object -- Get our transformed point by multiplying the offset x = x * offset y = y * offset z = z * offset -- Add these values to the element position -- mat[4] contains position coordinates x = x + mat[4][1] y = y + mat[4][2] z = z + mat[4][3]
  16. If your object is not axis-aligned, that is if it points in a different direction than the X/Y/Z axis, then you need to pull up a calculator to find the forwards position, because your object will be moving in multiple axes The easiest way is to use a transform matrix. Take a look here and see the examples. Let me know if you need more explanation.
  17. You need to do the same you did on the freeroam GUI ? You need to put the code you posted into the resource of your other GUI, and it should work automatically.
  18. There is nothing wrong in that, so the error is elsewhere in your script. Post the rest, if it's too big you can use pastebin.com
  19. You can't create a local variables dynamically, those need to be typed. You can however do it with global variables like this, because you can access them in a table _G[name.."dff"] = engineLoadTXD ( "Cars/"..name.."/"..name..".txd") Also you need to use pairs for that loop to work. And on line 26, you need to use the function name. I suggest doing it this way in your own table local vehiclesFileNames = { AE86 = 589, ToyotaSupra = 559, ToyotaAltezza = 402, Datsun240Z = 475, Nissan180SX = 602, SilviaS13 = 401, SilviaS14 = 576, SilviaS15 = 474, Skyline2000 = 535, SkylineR32 = 555, SkylineR34 = 562, SkylineGTR = 558, } local vehiclesData = {} function loadVehicleFiles() for name, id in pairs(vehiclesFileNames) do local txd = engineLoadTXD ( "Cars/"..name.."/"..name..".txd") engineImportTXD ( txd, id ) local dff = engineLoadDFF ( "Cars/"..name.."/"..name..".dff") engineReplaceModel ( dff, id ) outputDebugString("name = "..name.." | id = "..id..".") vehiclesData[name] = {} vehiclesData[name].txd = txd vehiclesData[name].dff = dff end end addEventHandler("onClientResourceStart", resourceRoot, loadVehicleFiles)
  20. Where do you want the line to go? From the player name to the player head position? Try drawing what you want in paint and post it
  21. Change this local vehicles = results[1] local vehicle = results[1]
  22. You need to do SELECT * FROM vehicles To select everything
  23. You can search for better explanations on that than I can give you, read about what a translation matrix is and then a rotation matrix afterwards
  24. You need to give your object a name obj = createObject(id, px, py, pz) and then you can destroy it later destroyElement(obj)
  25. What are you trying to do with this? If you're looking to create a line that is always perpendicular to the vehicle then you can use getElementMatrix local x1, y1, z1 = getElementPosition(theVehicle) local m = getElementMatrix(theVehicle) local x2 = -100 * m[3][1] + m[4][1] local y2 = -100 * m[3][2] + m[4][2] local z2 = -100 * m[3][3] + m[4][3] dxDrawLine3D(x1, y1, z1, x2, y2, z2) -100 is the length of the projected line, you can use processLineOfSight to find whatever it collides with.
×
×
  • Create New...