-
Posts
696 -
Joined
-
Last visited
-
Days Won
3
Everything posted by Dzsozi (h03)
-
I can't figure out how to do the rectangle height, somehow I should get the number of lines, but I don't know how to do it. Could you/somebody fix this/write an example for me? Right now I have these lines inside the script: local boxX, boxY = 50 * sx / sx, 50 * sy / sy local boxPadding = 5 local hosszusag = dxGetTextWidth (tipBox.string, 1, "default-bold") local magassag = dxGetFontHeight(1,"default-bold") local wordbreak = false if hosszusag > 363 then hosszusag = 363 wordbreak = true end local textWidth, textHeight = 363, 106 local boxWidth, boxHeight = textWidth + ( boxPadding * 2 ), magassag + (boxPadding * 2) --10 + ( boxPadding * 2 ) local textX, textY = boxX + boxPadding, boxY + boxPadding dxDrawRectangle( boxX, boxY, boxWidth, boxHeight, tocolor( 0, 0, 0, 185 ), true ) dxDrawText( tipBox.string, textX, textY, textX + textWidth + boxPadding, textY + textHeight + boxPadding, tocolor( 222, 222, 222, 255 ), 1, "default-bold", "left", "top", false, wordbreak, true ) For the width it's perfect, only part that I'm missing is the height of the rectangle depending on the lines of the text.
-
Okay, thank you, I'll try something, if there's a problem I'll reply to this post again. Thank you again!
-
Okay, well, is there any way to count the lines of a word breaked dxDrawText? Because I have an idea to fix this problem.
-
Now it looks like this with your code: The rectangle always have the same size. I want to change it's size depending on the length and height of the text. I made an example in paint: I hope you understand. How could I make the rectangle change it's size depending on the text length and height? I bet I'll need these functions: dxGetTextWidth dxGetFontHeight Thank you myonlake and thanks in advance for everybody who helps/tries to help!
-
Could you send me the north blip part of the script, in PM? I can't figure out how to do it, maybe your method would be helpful for me. I would appreciate it! Thanks in advance!
-
Hello! Today I started editing this script: https://community.multitheftauto.com/in ... ls&id=5812 I want to make it look like GTA V top left corner notifications. My only problem is that when wordBreak is being applied to the dxDrawText the dxDrawRectangle keeps going to the right side, but it's not going downside. So the rectangle's size is perfect for one line, but if there's more lines it's messed up. One line (perfect): Two or more lines (messed up): Part of the code: local x,y = 50 * sx / 1920, 50 * sy / 1080 local textX,textY = x, y local textWidth,textHeight = 363,106 local hosszusag = dxGetTextWidth (tipBox.string, 1, "default-bold") local magassag = dxGetFontHeight(1,"default-bold") --dxDrawImage (x,y,width,256,tipBox.path,0,0,0,tocolor(255,255,255),true) dxDrawRectangle(x, y, hosszusag+10 * sx / 1920, magassag+10 * sy / 1080, tocolor(0, 0, 0, 185), true) dxDrawText (tipBox.string,x+5,y+5,textX+textWidth,textY+textHeight,tocolor(222,222,222),1,"default-bold","left","top",false,true,true) I hope that somebody could help me! Thank you! P.S.: Sorry for the bad English if there was something written wrong, I'm from Hungary!
-
Thank you, I'll try something!
-
Is there any method to set a timer, for example 2500 miliseconds and check if a player hit a colshape within this time? So I mean if player keeps hitting colshapes in every 2500 miliseconds then nothing happens, but if the player isn't hit the colshape within this time then write a function? I hope that you understand my question and somebody could help me! Thank you!
-
Thank you, helped me very much, also fixed the problem!
-
Hello everyone! Today I started to work with Vandam98 and StiviK's resource, the GTA V radar that they've uploaded to the community. I want to make it better and more look like the GTA V radar. Anyway, I never could make dxDrawTexts, it's always a problem for me, I can't make it to the same size on every resolutions. So my current problem is can be seen on the pictures. I've played with the game and edited this script on 1920x1080 resolution (usually I use this res.), after I "finished" it I tried on 800x600 and boom, problem is appeared. 1920x1080 | Perfect, it should be look like this on every resolution (I mean the dxText). 800x600 | As you can see the text is too big, not the same as on the previous picture, but why? Here's the line of the dxDrawText and the guiGetScreenSize things: sWidth, sHeight = guiGetScreenSize() Auflosung_x = 1920 Auflosung_y = 1080 px = sWidth/Auflosung_x py = sHeight/Auflosung_y .. dxDrawText ( string.format("%.0f",distance) .. " m", 35*px, 227.5*py, 355*px, 227.5*py, tocolor ( 255, 255, 255, 255 ), 1.15, "default-bold", "right", "bottom" ) I would appreciate if someone could explain it for me, how does dxDrawText scalings work for all resolution, and things like that. I hope that someone could help. P.S.: Sorry for my English if there was something written wrong or if you don't understand it, I'm from Hungary. P.S. 2: I'm really excited about working with Vandam98 and/or StiviK, or fixing things about this resource and make it better, add missing things and more! Thank you!
-
Thank you, it works! Now it doesn't spam the debugscript, thank you again!
-
Hello guys! I have a little problem. The script works, but the only problem is that it spams the debugscript with this message: Bad argument @ 'getVehicleType' local vehicle = getPedOccupiedVehicle(localPlayer) if getVehicleType(vehicle) == "Automobile" or getVehicleType(vehicle) == "Monster Truck" then dxDrawImage( zero_x-10, zero_y-10, 18, 18, "blips/jarmu.png", 360 ) elseif getVehicleType(vehicle) == "Plane" then dxDrawImage( zero_x-10, zero_y-10, 18, 18, "blips/repulo.png", 360 ) elseif getVehicleType(vehicle) == "Bike" or getVehicleType(vehicle) == "Quad" then dxDrawImage( zero_x-10, zero_y-10, 18, 18, "blips/motor.png", 360 ) elseif getVehicleType(vehicle) == "Helicopter" then dxDrawImage( zero_x-10, zero_y-10, 18, 18, "blips/helikopter.png", 360 ) elseif getVehicleType(vehicle) == "Boat" then dxDrawImage( zero_x-10, zero_y-10, 18, 18, "blips/hajo.png", 360 ) elseif getVehicleType(vehicle) == "BMX" then dxDrawImage( zero_x-10, zero_y-10, 18, 18, "blips/bicikli.png", 360 ) elseif getVehicleType(vehicle) == "Helicopter" then dxDrawImage( zero_x-10, zero_y-10, 18, 18, "blips/helikopter.png", 360 ) else local player_rx, player_ry, player_rz = getElementRotation( localPlayer ) dxDrawImage( zero_x-10, zero_y-10, 18, 18, "blips/2.png", 360-player_rz ) end What's the problem? As I said the script works perfectly, but why does it spams debugscript?
-
Any help please?
-
Hello guys! I need a little help in scripting. So, I don't really understand the tables and I want to make a script, which is about moving cameras between two points, fadeCameras and time value for how long does the camera move and change the position. Could someone help me in this please? I would appreciate it!
-
Help me in getDistanceBetweenPoints3D please
Dzsozi (h03) replied to Dzsozi (h03)'s topic in Scripting
Thank you very much for your help! You helped me alot! Thank you! -
I don't know how to make it, I've started it, but I realised that it's not going to work. Here's what I started to make, but I don't know how to finish it, or how to make it working. blue = 5, 120, 250 red = 255, 0, 0 function checkColor() if blue then createBlip ( x, y, z 0, 2, red, 255, 0, 150) elseif red then createBlip ( x, y, z 0, 2, blue, 255, 0, 150) end end setTimer ( checkColor, 1500, 0 )
-
Hello everyone! I was thinking if is it possible to make the square blip flashing? So it changes it's color from red to blue and from blue to red in every 1.5 second. How is this possible? Could somebody help me please?
-
Help me in getDistanceBetweenPoints3D please
Dzsozi (h03) replied to Dzsozi (h03)'s topic in Scripting
Help please? -
Help me in getDistanceBetweenPoints3D please
Dzsozi (h03) replied to Dzsozi (h03)'s topic in Scripting
I have already tried it, but I still get CJ skin and I get respawned two times. EDIT: Fixed it, my mistake. Thank you for your help! EDIT 2: Could you help me in one more thing please? I want to add the rotations and camera positions (to set the camera position at the hospital before spawn) to the table as well, not just the positions. How can I do this? -
Oh nevermind, it was my mistake! Thank you again Citizen!
-
Help me in getDistanceBetweenPoints3D please
Dzsozi (h03) replied to Dzsozi (h03)'s topic in Scripting
The half of it works, but for some reason it sets everybody's skin to CJ. local theSkin = getPedSkin(thePlayer) local theTeam = getPlayerTeam(thePlayer) local PlayerPosition,Distances = {getElementPosition(thePlayer)},{}; for _,v in pairs(HospitalPositions) do table.insert(Distances,{ Position = v, Distance = getDistanceBetweenPoints3D(PlayerPosition[1],PlayerPosition[2],PlayerPosition[3],v[1],v[2],v[3]); }); end; table.sort(Distances,function(a,b) return a.Distance end); local NearestHospital = {unpack(Distances[1].Position)}; spawnPlayer(thePlayer,NearestHospital[1],NearestHospital[2],NearestHospital[3], theSkin, 0, 0, theTeam); -
But for some reason sometimes the blip is still in the radar. Why is that? For example, I enter in a taxi, the blip is being created, other player enters a taxi, it's created too, but if I exit or delete my taxi the blip is still there. But if an other player is not entering a taxi, and if I exit from mine, the blip is being destroyed. Why is that? EDIT: When someone in the vehicle at the first time and he exits the blip is being destroyed. But if another player (or me) enters in the taxi as a second driver and if he exits the blip is not being destroyed. Why?
-
Thank you very much! Now I understand a little bit better! Thank you again! You helped me alot!
-
Hello everyone! I have a problem. I used the wiki's example of enter and exit vehicle. I edited it a little bit, but it's not working. What could be the problem? I don't really understand the tables. Someone could fix this code for me and explain it? I want to create a blip for all the taxis which are being driven. taxiVehicles = { [420]=true, [438]=true } function enterVehicle ( thePlayer, seat, jacked ) if ( taxiVehicles[getElementModel ( source )] ) then taxiBlip = createBlipAttachedTo( taxiVehicles, 0, 3, 255, 255, 0, 255, 0, 999999) end end addEventHandler ( "onVehicleEnter", getRootElement(), enterVehicle ) function exitVehicle ( thePlayer, seat, jacked ) if ( taxiVehicles[getElementModel ( source )] ) then destroyElement(taxiBlip) end end addEventHandler ( "onVehicleExit", getRootElement(), exitVehicle ) P.S.: Sorry for bad English!
-
Hello guys! I have a question. How can I continue this script? I have no idea. I want to make the script work like if you are closer to Los Santos hospital then you will spawn there, but if you are closer to Blueberry hospital (in my server there is a custom hospital in blueberry) then you will spawn there. How can I make this? Please help me, I have no idea how to continue. local x,y,z = getElementPosition (thePlayer) local ls1 = getDistanceBetweenPoints3D (x,y,z,1183.291015625, -1323.033203125, 13.577140808105) local ls2 = getDistanceBetweenPoints3D (x,y,z,2034.080078125, -1404.7314453125, 17.251882553101) local montgomery = getDistanceBetweenPoints3D (x,y,z,1371.830078125, 405.94140625, 19.7578125) local blueberry = getDistanceBetweenPoints3D (x,y,z,207.50390625, -62.701171875, 1.5977957248688)