XJMLN

Members
  • Content Count

    29
  • Joined

  • Last visited

Community Reputation

0 Neutral

About XJMLN

  • Rank
    Advanced Member

Details

  • Gang
    prmta.pl

Recent Profile Visitors

685 profile views
  1. Hi, is there any way to get (minimap) positons (gui)? I wanna create a images around the radar but on all resoultions radar is in another positions. Any solutions/functions?
  2. you can use ipairs/pairs loop: for i,v in pairs(table) do if place == v then -- some code end end or just use table[index]
  3. I can't do anything with that it's caused by that: https://bugs.mtasa.com/view.php?id=3168 Close please.
  4. Yup, i use that version to get size of file on server , but now i need size from client file to show something like 60MB/120MB (50%). It's something weird because i use (probably) the same method from this resource and in that resource it works perfectly..
  5. I can't rename file while downloading it in the same time
  6. Really? Just look in the code, lol but ok, I must open file to get the actual size of it.
  7. Hi, I tried to use fileOpen (c-side) when downloadFile is started, but it doesn't work in db3: Bad usage @ 'fileOpen' [unable to load file 'dff/vehicles/542.dff'] etc. but file is in this dir. Someone maybe know where problem is? function replac_getAllSize(d) local size = 0 for i,v in ipairs(d) do local t local t2 if v[2] == 1 then t = "txd/vehicles/"..v[1]..".txd" t2 = "dff/vehicles/"..v[1]..".dff" elseif v[2] == 2 then t = "txd/skins/"..v[1]..".txd" t2 = "dff/skins/"..v[1]..".dff" end if fileExists(t2) then local openFile = fileOpen(t2,true) if openFile then size = size + fileGetSize(openFile) fileClose(openFile) else end else end if fileExists(t) then local openFile2 = fileOpen(t,true) if openFile2 then size = size + fileGetSize(openFile2) fileClose(openFile2) else end else end end return size/1048576 end function calcProg(w, p) if w and p then local w = w -2 local width = ((w*p)/100) return width end return 0 end function replac_render() if (not r.rendered) then return end local size = replac_getAllSize(r.installed) dxDrawRectangle(224, 512, 362, 36, tocolor(0, 0, 0, 209), false) dxDrawRectangle(230, 517, 350, 25, tocolor(255, 255, 255, 255), false) local progress = ((size*100)/r.sizeAll) local x,y,w,h = (230/800)*sw, (517/600)*sh, (350/800)*sw, (25/600)*sh local width = calcProg(w,progress) dxDrawRectangle(x,y,width,h, tocolor(104, 215, 89, 255), false) dxDrawText("Trwa pobieranie "..string.format("%.02f",size).."MB/"..string.format("%.02f",r.sizeAll).."MB.. ("..math.floor(progress).."%)", 230, 517, 580, 542, tocolor(0, 0, 0, 254), 1.00, "clear", "center", "center", false, false, false, false, false) end function replac_applyChanges(installed,uninstalled) r.rendered = true r.sizeAll = 0 for i,v in ipairs(installed) do if v[2] == 1 then t = "vehicles" elseif v[2] == 2 then t = "skins" end r.sizeAll = r.sizeAll + v[3] local txd = downloadFile("txd/"..t.."/"..v[1]..".txd") local dff = downloadFile("dff/"..t.."/"..v[1]..".dff") end r.installed = installed addEventHandler("onClientRender",root,replac_render) end
  8. XJMLN

    copyResource

    Code work, check is your backup resource where you have this code have a ACL to copyResource.
  9. Your code work good, but blip is showing on top left corner. How i can move that there: http://i.imgur.com/ipXmU1h.jpg?1 I tried this, but no reaction of change these values: local mapX,mapY = (sw - sw*1200/1920)/2,(sh - sh*600/1080)/2
  10. How i can calculate this units, just like this? local sw,sh = guiGetScreenSize() x2,y2,z2 -- coords x2 =x2/sw y2 = y2/sh
  11. But in this post you show how, from screen pos get world pos. I have the world pos and wanna get it to screen pos.
  12. Hi, I wanna create a gui with minimap (like this), but i don't know how to calculate world position to screen position and show it on that map. I tried this: x2 =((x2 + 3000)/ 6000 *sw) y2 =((3000 - y2)/ 6000 *sh) But this show the wrong position for waypoint. Code: local sw,sh = guiGetScreenSize() local mw, mh = sw/1920, sh/1080 local t = {point=nil,pos=nil,map=false} t.gridlist = guiCreateGridList(mw*382, mh*281, mw*329, mh*530, false) t.gridlist_places = guiGridListAddColumn(t.gridlist, "Places", 0.9) guiSetVisible(t.gridlist,false) function travel_render() if not t.rendered then return end dxDrawImage((sw - sw*1200/1920)/2,(sh - sh*600/1080)/2,1200,600, "img/background.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) if t.map then dxDrawImage(t.pos[1],t.pos[2],32,32,"img/waypoint.png", 0,0,0, tocolor(255,255,255,255), false) end end function travel_fill(d) for i,v in ipairs(d) do local row = guiGridListAddRow(t.gridlist) guiGridListSetItemText(t.gridlist, row, t.gridlist_places, v.name, false, false) guiGridListSetItemData(t.gridlist, row, t.gridlist_places,v.tpPos) end end function travel_init() if (t.rendered) then removeEventHandler("onClientRender", root, travel_render) t.point = nil t.rendered = false guiSetVisible(t.gridlist,false) showCursor(false) guiGridListClear(t.gridlist) else guiGridListClear(t.gridlist) triggerServerEvent("travel_requestPlaces", localPlayer) t.rendered = true addEventHandler("onClientRender", root, travel_render) guiSetVisible(t.gridlist, true) showCursor(true) end end function interaction_fastTravel(args) if (not args.ped) then return end args.player = localPlayer local x,y,z = getElementPosition(args.player) local x2,y2,z2 = getElementPosition(args.ped) if (getDistanceBetweenPoints3D(x,y,z,x2,y2,z2)>2) then outputChatBox("You need to go closer.",255,0,0) return end t.point = args.ped travel_init() end function travel_updateBlip() local selRow = guiGridListGetSelectedItem(t.gridlist) if (selRow<0) then return end local pos = guiGridListGetItemData(t.gridlist, selRow, t.gridlist_places) local x2, y2, z2 = unpack(pos) x2 =((x2 + 3000)/ 6000 *sw) y2 =((3000 - y2)/ 6000 *sh) t.pos = {x2,y2} t.map = true end function travel_doTeleport() local selRow = guiGridListGetSelectedItem(t.gridlist) if (selRow<0) then return end local pos = guiGridListGetItemData(t.gridlist, selRow, t.gridlist_places) local x2, y2, z2 = unpack(pos) fadeCamera(false) travel_init() setElementFrozen(localPlayer,true) setTimer(function() setElementPosition(localPlayer,x2,y2,z2+1) setElementFrozen(localPlayer,false) fadeCamera(true) end,1500,1) end addEvent("travels_fillList", true) addEventHandler("travels_fillList", root,travel_fill) addEventHandler("onClientGUIClick", t.gridlist, travel_updateBlip) addEventHandler("onClientGUIDoubleClick", t.gridlist, travel_doTeleport) Anyone can help with this?
  13. Okey, its work end code: addEventHandler("onClientGUIClick",g_e_login,test, true) function test () setTimer(setIndexInput,2000,1) end function setIndexInput(akcja) local tlogin = guiGetText(g_e_login) local plogin = guiGetText(g_e_password) local textLength = string.len(tlogin) if (textLength) > 0 then guiEditSetCaretIndex(g_e_login,textLength+1) else guiEditSetCaretIndex(g_e_login,1) end end Close.
  14. function isMouseIn(psx,psy,pssx,pssy,abx,aby) if not isCursorShowing() then return end cx,cy=getCursorPosition() cx,cy=cx*sx,cy*sy if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then return true,cx,cy else return false end end if isMouseIn(here code from guiCreateEdit,"",true) then guiEditSetCaretIndex(g_e_login,1) end That be good? Or better idea is eventHandler onClientClick and then code from up? EDIT: I create that code, but when i click on editbox nothing happen ;/. addEventHandler("onClientGUIClicked",g_e_login,setIndexInput, false) addEventHandler("onClientGUIClicked",g_e_password,setIndexInput, false) function setIndexInput() local tlogin = guiGetText(g_e_login) local plogin = guiGetText(g_e_password) if source == g_e_login then local textLength = string.len(tlogin) if (textLength) > 0 then guiEditSetCaretIndex(source,textLength+1) outputChatBox("1") else setTimer(function() guiEditSetCaretIndex(source,1) end,500,1) end end if source == g_e_password then local textLength = string.len(plogin) if (textLength) > 0 then guiEditSetCaretIndex(source,textLength+1) outputChatBox("1") else guiEditSetCaretIndex(source,1) outputChatBox("1") end end end