Jump to content

Dealman

Members
  • Posts

    1,421
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Dealman

  1. Divide the width/height with the source resolution, and then multiply it by their resolution. For example; local screenX, screenY = guiGetScreenSize(); -- This will get the player's resolution, 800x600 in their case - 1920x1080 in your case. Now, lets say you made something that is 600 pixel wide and 300 pixels high. And you created this while on a 1920x1080 resolution, you would do; exampleWidth = (600/1920)*screenX; exampleHeight = (300/1080)*screenY; This would make the size relative, instead of absolute. Do note however, that this solution does not always work. You will particularly notice this with text. Edit: To further demonstrate, this is what it should look like; local screenX, screenY = guiGetScreenSize(); function dxAbsoluteExampleWindow_Handler() dxDrawRectangle(480, 240, 969, 570, tocolor(35, 35, 35, 255), false); dxDrawRectangle(480, 240, 969, 47, tocolor(55, 55, 55, 255), false); dxDrawText("Example DX Window", 485, 244, 1442, 281, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false); end function dxRelativeExampleWindow_Handler() dxDrawRectangle(0.25*screenX, 0.22222222222222*screenY, 0.5046875*screenX, 0.52777777777778*screenY, tocolor(35, 35, 35, 255), false); dxDrawRectangle(0.25*screenX, 0.22222222222222*screenY, 0.5046875*screenX, 0.043518518518519*screenY, tocolor(55, 55, 55, 255), false); dxDrawText("Example DX Window", 0.25260416666667*screenX, 0.22592592592593*screenY, 0.75104166666667*screenX, 0.26018518518519*screenY, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false); end I use a website where you can run Lua code to make the process very fast and straight forward, since doing it all manually is a very tedious process. Especially with DX functions. Simply paste this code(into the website linked above) and enter the appropriate values. Then copy the output and you're golden. local sX, sY, wX, hY = 480, 240, 969, 570; -- Paste the absolute values here local sourceWidth = 1920; -- Change those to the source values. local sourceHeight = 1080; -- Change those to the source values. local nSX, nSY, nWX, nHY = (sX/sourceWidth), (sY/sourceHeight), (wX/sourceWidth), (hY/sourceHeight); for i=0, 47 do print(""); -- This is just to clear the print window, so you don't confused what to copy. end print(tostring(nSX).."*screenX, "..tostring(nSY).."*screenY, "..tostring(nWX).."*screenX, "..tostring(nHY).."*screenY");
  2. Try to delay it a bit with a timer. addEventHandler ( "onClientPlayerVehicleEnter", localPlayer, function ( ) setTimer(function() setRadioChannel(0) end, 2000, 1); end)
  3. I would believe it's because the camera focal point is somewhere around the very middle of vehicles, so when your vehicle is inside another player's vehicle - it gets rather... confused on what to do. Try to freeze the car and then attach yourself too it, see if the problem persists with collisions off?
  4. I actually thought about this, and I guess it would work to some degree. It might still interfere with the music player, though.
  5. Earlier today I thought I'd make a simple script that automatically mutes music played from maps, now this all good and easy using either destroyElement or onClientSoundStarted. However, since the event is so poorly made - there is no way(as far as I know) to get from where the sound was started. And the issue comes down to that it stops all sounds, even the countdown and sounds started via a music player. I know there are some poor workarounds you could do using timers and other events - but I would rather not, as it wouldn't be guaranteed to work. So I started to play around a bit, at first, I did this; outputChatBox("Parent Type: ["..tostring(getElementType(getElementParent(source)))).."]"); And this returned "map". And since that was of no use to me, I tried to get the parent of that parent, like this; outputChatBox("Parent Type: ["..tostring(getElementType(getElementParent(getElementParent(source))))).."]"); And low and behold, this returned resource. However, I'm not sure whether I'm blind or not - because I can not seem to get the resource name of this resource. Since all it gives me is "expected resource-data at argument 1, got resource". Could anyone else think of a nifty solution to this as 98% of all songs on DM maps are as bad as they possibly could be?
  6. Basically, you're trying to make a profit by using a free forum solution(obvious by the hostnames), something which is of most likeliness not allowed. Great job posting your own site so they know who's doing it...
  7. It should already be written there if it's created client-side.
  8. So what's the point of it all? You spawn, you get weapons and a car. What are the objectives? Survival? Some more info on that would be welcome
  9. Try; local theMusic = guiGridListGetItemText ( GUIEditor.gridlist[1], guiGridListGetSelectedItem ( GUIEditor.gridlist[1] ), 1 )..".mp3" As the wiki mentioned, the filepath must be a string. But you're checking if the file "Ke$ha - We R Who We R" exists - not "Ke$ha - We R Who We R.mp3". It has to be a filepath. It might be something else causing it, I may have overlooked it - didn't read through all of your code. Writing this from my phone Edit: I should have a link to a radio resource in my signature, which I made a while back, to stream URLs. You're free to download it and see if you find anything useful - it's open source as with all my releases.
  10. No need for that, Feche. @Rzavan2299; Code on the forums can be clicked. It will take you to the Wiki page of that function. You'll have an example there of how it can be used.
  11. Great job, Neck. I do like the fact you also put down comments to help others understand how things are working, and even more so that you're spending so much time refactoring. This looks like a very useful resource to me, especially if you have a few resources running and they all spit out various shit. I've never been a fan of the default debugscript, especially if something goes wrong with a render event I'd agree with what Woovie said, also another suggestion I'd have is; For example when something goes wrong with a function attached to a render event, it'll spam several of those warnings/errors per second - could you make it so they show up as one line? But the ability to collapse it? Other than that, great work!
  12. You can look at the resource linked in my signature for a few examples(they were all found via googling a bit). It's pretty old now though, and I've learnt a whole lot since I last worked on it - so I might write something new in the future.
  13. Dealman

    fetchremote

    Short answer; yes, you can. Long answer; Yes, you can but it will take some effort to find a website that works with what you're trying to achieve. A great friend of mine has written an utterly amazing sound streaming resource which uses a Russian website as far as I know - to search for songs by artist and/or album. Once you've found such a website, you'll need to read up on some PHP scripting - but it ain't too hard. Some websites that I can think of right now are MP3Skull and MP3Chief. However, my friend's also aware of those so I assume there's a reason why he didn't pick one of them. I won't mention any names, since I don't want him to get bombed with messages about it - but he knows who he is in case he wants to help further.
  14. You do indeed need to change your attitude in case you'd like further assistance. I gave you some working code above, use it and try to understand it. Copy and pasting won't get you anywhere - neither will being disrespectful.
  15. They're HLSL Shaders, you could use Google to try to find some tutorials. Other than that, Ren_712 is great with those shaders and seems very helpful!
  16. Wrote this code as an example whilst on my laptop, so don't expect miracles. This was thrown together in ~15 minutes, so no, it doesn't look good. But the purpose of it is for it to work as an example to you. I decided to use timers for this example, but it's possible to do it with less timers(Timers really aren't as bad as some people on these forums claim them to be). There's probably a few resources like these up on the community, I'd suggest you check those out.
  17. I've heard a lot about Trouble in Terrorist Town, might be a fun little thing to add for my current project. Could you briefly explain how it works? I might look into it.
  18. You could look at the properties, might be something there. Not all of them work though as far as I know; guiSetProperty.
  19. isElementWithinMarker needs 2 arguments, the element which to look for and the marker.
  20. You can also do it like this; local selectedIndex = mytable[3]; -- Will return 996 It works similarily if your table has another table inside of it. IE; local myTable = {{1, 2, 3}, {"A", "B", "C"}, {1, 2, 3}}; local selectedIndex = myTable[2][3]; -- Will return C Edit: Nevermind, just saw that you wanted to find the position of it
  21. Of course it could be improved, it was just pieced together in a few minutes in hopes it would assist him in what he was looking for. Trigonometry has always been my one true enemy, so any feedback on how to improve it is of course welcome.
  22. Since I'll be doing something similar in the future, I tried to throw something together a bit fast - I'm not sure if this is what you're asking for, but if it is, feel free to edit it to your hearts desire! Client: Usage: /Build - Enters Building Mode /Select [iD] - Creates the specified object. As I said, I threw this together in less than half an hour. So it's not perfect
  23. Could you show us the line where the error is occuring? findRotation doesn't use for loops as far as I can tell.
  24. Can't really help unless you show me your current code.
×
×
  • Create New...