-
Posts
1,255 -
Joined
-
Last visited
Everything posted by .:HyPeX:.
-
Its the same as doing a distanceBetweenTwoPoints, i guess i'll have to do some maths about rotations.. Another thing, how can i disable collisions within vehicles?
-
Hey guys, how could i know if a car is ahead of another one? Lets say: car A is facing north, and car B is also facing north. car A is 10 units more to the north than car B. Therefore, car A is ahead. But i i get that previously car A was ahead, and now car B is ahead (eg. car A is 10 units to the south of car B, but still pointing north), how could i get this? its not simple distance between 2 elements, it should also consider Z rotation. is there any function for this? Becouse if car A decided to turn arround and go the other way, car B shouldnt be going to be ahead, he's behind car A, since he has to turn arround to catch him. PD: to make it closer, i'm trying to recreate a NFS:Underground 2 game mode where you had to chase a car, pass it, and leave it behind. (loose it)
-
hey guys, can i actually draw a coloured gui label wich could support HEX? Like: #00ac300Test or i should just go for dxDrawText?
-
Bump, what logs you want? @Woovie
-
dxDrawLine3D cant draw textures @IIYAMA, use https://wiki.multitheftauto.com/wiki/Dx ... rialLine3D instead.
-
Oh its pretty easy, just look a bit at this, establish some values, etc. local progress = 100 function onMouseMove(int) progress = progress + (int) * 1 -- You can edit the number 1 multiplier to adjust speed if progress == 200 or progress == 0 then progress = 100 end end addEventHandler("onClientMouseWheel", getRootElement(), onMouseMove) local Positions = { {--[[circle stuff]]}, {--[[rec1 tables of pos]] {--[[Position 1]] }, {--[[Position 2]] }, {--[[Position 3]] }, {--[[Position 4]] }, {--[[Position 5]] }}, {--[[rec2 tables of pos]] {--[[Position 1]] }, {--[[Position 2]] }, {--[[Position 3]] }, {--[[Position 4]] }, {--[[Position 5]] }} } function Rendering() if progress > 100 and progress < 150 then --[[ From position 1 to position 2 ( 1 not clockwise) ]]-- elseif progress > 150 and progress < 200 then --[[ From position 2 to position 3 ( 2 not clockwise) ]]-- elseif progress < 100 and progress > 50 then --[[ From position 1 to position 4 ( 1 clockwise) ]]-- elseif progress > 0 and progress < 50 then --[[ From position 4 to position 5 (2 clockwise) ]]-- end end addEventHandler("onClientRender", getRootElement(), Rendering) PD: Just remember to make some maths on the progress on each case to use it also with the interpolate: if progress > 150 and progress < 200 then local progress = progress - 150 local progress = progress / 50 local value = interpolateBetween(Positions[DxRec][posStart], 0,0, Positions[DxRec][PosEnd], 0,0, progress, "Linear") end --[[ Also note PosStart, PosEnd and DxRec should be integers to specify wich table are we talking about.
-
If you even check out my signature..
-
Basically the first table will contain all objects in the map, the second one will only have the ones that are close enought. EDIT:
-
Well there are some things im having trouble with: -no rectangle is drawn. -Objects are said perfectly and suddenly they're stop being counted (Just if you go far away from the point you respawn, DrawTable is 0.) I'm testing this on a race resource. local x,y = guiGetScreenSize() local lp = getLocalPlayer() local RcX, RcY = x*0.15, y*0.8 local RW = ( x / y ) * 0.05 local OS = x / 0.05 local ObjectTable = {} local CollsTable = {} local DrawTable = {} local CollsDrawTable = {} function CheckDistanceAndDraw() outputChatBox(#DrawTable) outputChatBox(#ObjectTable) ObjectTable = {} DrawTable = {} CollsDrawTable = {} CollsTable = {} for i, v in ipairs (getElementsByType("object")) do ObjectTable[i] = v end CollsTable = {} for i=1, #ObjectTable do CollsTable[i] = getElementBoundingBox(ObjectTable[i]) end for i=1, #ObjectTable do local x1,y1,z1 = getElementPosition(getLocalPlayer()) local x2,y2,z2 = getElementPosition(ObjectTable[i]) local height = z1 - z2 local distance = getDistanceBetweenPoints2D(x1,y1,x2,y2) if distance < 50 then DrawTable[i] = ObjectTable[i] end end for i=1, #DrawTable do if not isElement(DrawTable[i]) then return end local val1,val2,val3,val4,val5,val6 = getElementBoundingBox(DrawTable[i]) CollsDrawTable[i] = {val1,val2,val3,val4,val5,val6} end end addEventHandler("onClientRender", getRootElement(), CheckDistanceAndDraw) function DrawRadar() for i=1, #DrawTable do local x1,y1,z1 = getElementPosition(lp) local x2,y2,z2 = getElementPosition(DrawTable[i]) local rotation = findRotation(x1,y1,x2,y2) local distance = getDistanceBetweenPoints2D(x1,y1,x2,y2) local minX, minY, minZ, maxX, maxY, maxZ = unpack(CollsDrawTable[i]) local size = getObjectScale(DrawTable[i]) local widthX = maxX - minX local widthY = maxY - minY local height = maxZ - minZ local maxSize = 15 local maximum = 150 local widthX = ( ( widthX / size ) / maximum) * maxSize local widthY = ( ( widthY / size ) / maximum) * maxSize if rotation > 0 and rotation < 90 then dxDrawRectangle( ( RcX + distance / RW ) - widthX, ( RcY + distance / RW ) - widthY, x * OS + widthX * 2, y * OS + widthY * 2, tocolor(255,255,255,255) ) elseif rotation > 90 and rotation < 180 then dxDrawRectangle( ( RcX + distance / RW ) - widthX, ( RcY - distance / RW ) - widthY, x * OS + widthX * 2, y * OS + widthY * 2, tocolor(255,255,255,255) ) elseif rotation > 180 and rotation < 270 then dxDrawRectangle( ( RcX - distance / RW ) - widthX, ( RcY - distance / RW ) - widthY, x * OS + widthX * 2, y * OS + widthY * 2, tocolor(255,255,255,255) ) elseif rotation > 270 and rotation < 360 then dxDrawRectangle( ( RcX - distance / RW ) - widthX, ( RcY + distance / RW ) - widthY, x * OS + widthX * 2, y * OS + widthY * 2, tocolor(255,255,255,255) ) else outputChatBox("ERROR") end end end function findRotation(x1,y1,x2,y2) local t = -math.deg(math.atan2(x2-x1,y2-y1)) if t < 0 then t = t + 360 end; return t; end
-
hey guys, whats the biggest bouding box size out there? (Supposing a 1 size), i'm using a 150 value, but i want to get as closest as possible.
-
I got the ftp at my hand, wich log you want?
-
Thanks!, i'm using this with a custom radar, and i was just looking arround how to draw the elemets itself, i managed to make them, but not their size appropietly.
-
Please explain better (give a lot of details) what you are trying to achieve. Do you want to prevent others to steal your client script code ? Yes, but im unsure if loadstring will let a function go on perfectly, if i load like this, will it work? myString = "function Cheetah() dxDrawText('Test', 400,200, 100,100,tocolor(255,255,255,255),3) end addEventHandler('onClientRender', getRootElement(), Cheetah)" loadstring(myString)
-
Hey guys, how can i get the size of a colshape of an element? (Like the width of a building) greetz HyPeX
-
Oh ok, didnt saw that, thanks!
-
Got a harsh one, you'd need some advanced (or at least good) knowledge of what im doing. (its on dxDrawText, but its the same concept.) This will draw 4 texts (according to the table) sided to the left (they will be drawn 270° clockwise) on positions 0.21,0.41,0.61 and 0.81 of X relative values. --Table Part TextNow = { Text1 = {"Achivements", 0.21, 0.8, 0.1,0.1,270, x * 0.05 + (x*0.2), y*0.85,255}, Text2 = {"Rankings", 0.41 , 0.8, 0.1,0.1,270, x * 0.05 + (x*0.4), y*0.85,255}, Text3 = {"Tuning",0.61 , 0.8, 0.1,0.1,270, x * 0.05 + (x*0.6), y*0.85,255}, Text4 = {"Settings", 0.81 , 0.8, 0.1,0.1,270, x * 0.05 + (x*0.8), y*0.85,255}, } --Drawing i=1 local a = "Text"..i dxDrawText(Dashboard.Positions.TextNow[a][1] , Dashboard.Positions.TextNow[a][2] * x, Dashboard.Positions.TextNow[a][3] * y, Dashboard.Positions.TextNow[a][4] * x, Dashboard.Positions.TextNow[a][5] * y, tocolor(255,255,255,alpha),3,"clear","left", "top", true, false,true, false, true, Dashboard.Positions.TextNow[a][6], Dashboard.Positions.TextNow[a][7], Dashboard.Positions.TextNow[a][8]) i=2 local a = "Text"..i dxDrawText(Dashboard.Positions.TextNow[a][1] , Dashboard.Positions.TextNow[a][2] * x, Dashboard.Positions.TextNow[a][3] * y, Dashboard.Positions.TextNow[a][4] * x, Dashboard.Positions.TextNow[a][5] * y, tocolor(255,255,255,alpha),3,"clear","left", "top", true, false,true, false, true, Dashboard.Positions.TextNow[a][6], Dashboard.Positions.TextNow[a][7], Dashboard.Positions.TextNow[a][8]) i=3 local a = "Text"..i dxDrawText(Dashboard.Positions.TextNow[a][1] , Dashboard.Positions.TextNow[a][2] * x, Dashboard.Positions.TextNow[a][3] * y, Dashboard.Positions.TextNow[a][4] * x, Dashboard.Positions.TextNow[a][5] * y, tocolor(255,255,255,alpha),3,"clear","left", "top", true, false,true,false, true, Dashboard.Positions.TextNow[a][6], Dashboard.Positions.TextNow[a][7], Dashboard.Positions.TextNow[a][8]) i=4 local a = "Text"..i dxDrawText(Dashboard.Positions.TextNow[a][1] , Dashboard.Positions.TextNow[a][2] * x, Dashboard.Positions.TextNow[a][3] * y, Dashboard.Positions.TextNow[a][4] * x, Dashboard.Positions.TextNow[a][5] * y, tocolor(255,255,255,alpha),3,"clear","left", "top", true, false,true, false, true, Dashboard.Positions.TextNow[a][6], Dashboard.Positions.TextNow[a][7], Dashboard.Positions.TextNow[a][8])
-
You want to draw it on the screen? if yes then you should use the rotation arguments dxDrawImage. Basically: Rotation will make the image rotate clockwise. RX: Will set the X point in the screen where the "Moving will be made from" RY: Will set the Y point in the screen where the "Moving will be made from" So, just remember that if you set an image to the left of the RX point, then the rotation will go up. Also remember this will only work on a clock-way, not 3D. About going like that effect, well, you should make the image itself like that with some trasparencies. (Just loading that image you got will do). Else, id say about a shader, nothing else.
-
hey guys, i dont see any item.. DataSelect = guiCreateComboBox(x*0.5, y*0.1, x*0.2, y*0.05, "Data",false) guiSetVisible(DataSelect, false) for i=1, #Dashboard.rankings.labels do local id = guiComboBoxAddItem(DataSelect, tostring(Dashboard.rankings.labels[i])) guiComboBoxSetItemText(DataSelect, id, tostring(id..": "..Dashboard.rankings.labels[i])) guiComboBoxSetSelected(DataSelect, id) outputChatBox("added "..Dashboard.rankings.labels[i]) outputChatBox(id) end output: added Kills 0 added Deaths 1 added Headshots 2 added PlayTime 3 added EXP 4 added Level 5 added Rank 6 More accurately, this is what it happens:
-
Well, i'm just saying about not using any client-side script, just loadstring and everything on a string server-side. Doing this will have any effect on event handlers or it will work perfectly? (I would only have a client-side function wich loads all server-side stuff) PD: About the first stuff, i thought anyone could just say it out, seemed easier than trying it (Since it was just a random question, it involved less effort from both sides to ask it. )
-
Yea, the scripter backed out :l I'm not sure what you mean, but just pointing out reality.
-
No-one will certainly do it for free.
-
Hey Guys should this work? local chatbox = outputChatBox function CallMe() chatbox("Test") end CallMe() Also, can i save them down as a string to send them, and how? function BassHandler() --Stuff end local MyString = ""..BassHandler.."" MyLoad = loadstring(MyString)
-
Bump, apparently the server goes down whenever a player goes in, we have really no idea of whats going on.. (Website is always online, my bad)
-
Not searching, but servers could abouse and actually send viruses to the players. (Remember that if you open a direct file link it will be automatically downloaded, like my song in my bf3 server, eg: www.bf3-mta.tk/songs/war.mp3)
-
Vehicles are going too damn good
