myonlake
Members-
Posts
2,312 -
Joined
-
Days Won
40
Everything posted by myonlake
-
A little bit off-topic, but Skrill is classified as an unreliable company (not officially claimed as unreliable, but many official sources say it is not supported due to either massive amounts of complaints or lack of information - there's even more of these elsewhere in the web; oh and BBB had a F mark on Moneybookers some time ago), I suggest to use PayPal only. I ordered closure of my account on Skrill a year ago and I am glad I did, could've ended up worse. There are both good and bad reviews of Skrill, but more bad than good. Skrill is ex-Moneybookers, by the way, and keep in mind that this company is working in London, UK. Personal experience with London related companies is very bad. They either vanish with your money and never answer their phone, and this is not just one company I have dealt with, it is many companies. I am not from the UK, so foreigners are easy to cheat. Skrill has got better reliability however, but they are tricky and really slow... And earlier when I had issues with those companies, I contacted a lawyer to write them a warning. And because they did not respond and when they did it got even deeper into worse things I decided to cut it before it could have blown up into a big mess. It is just not worth it with these things, just go with PayPal, as it is the most reliable digital payments company and they also respond very fast to any issues you have. I had issues with a purchase I made from Germany and I got it fixed in one day.
-
Please read my first reply to this topic. That will get you started.
-
Semi-colon does not mark the end of anything actually. It is there for people who like it because of personal preference. A line ends when it ends.
-
Hey, Welcome to Multi Theft Auto, I hope you enjoy your stay here. In order to learn to script in Lua scripting language, I suggest you take some time to find the following topic useful for yourself. It contains links to tutorials and information regarding the use of the language in practice. This is essential in order to learn the basics of Lua and then work on your Multi Theft Auto related scripts. » Lua tutorials, manuals After you have familiarized yourself with Lua and know how to deploy basic code with it, you may move on to Multi Theft Auto specific scripting. Up-to-date Multi Theft Auto scripting information, details and help can be found on the Multi Theft Auto Wiki site. Get yourself familiarized with the scripting features Multi Theft Auto offers you by reading articles of which links you can find on the right side of the Wiki front page under the Scripting heading: » Server Manual » Introduction to scripting » Introduction to scripting the GUI » Debugging Tutorial » Introduction to resources » meta.xml » ACL You might also find the Tutorials board useful. These are tutorials, manuals and help topics written by community members. If Wiki seems a little bit too hardcore for you at the moment, checking this board should get you started easily. Feel free to also use our available chatting channels to ask questions and get help in general. These can be found at the IRC Channel Wiki article. Make sure to search for an answer on your preferred search engine first, and through the forum search feature. This way you can find solutions faster and will keep our channels clean of already answered questions! If you have code which you can post on your topic, that would make it easier for helpers to get a solution for you faster. Keep in mind that we are a public forum and we can only fix your code if you are willing to post it on your topic. This way we give you help and eventually a solution, and if someone else is facing the same issue later they can find a solution to the problem from your topic. I hope this got you started up!
-
I highly recommend people not purchasing the roleplay gamemode. It is a waste of your money and only 5 minutes worth of scripting which he has applied on top of the original open-source gamemode.
-
No, because the code is ran server-side and only things in the PHP output can reach the client (e.g. echoing something). http://puu.sh/dbhF2/8a5c880c8f.jpg http://php.net/manual/en/intro-whatis.php
-
You are most welcome.
-
Well, I decided to script it for you. Here you have it. It is not super accurate, so if the width is like 100 pixels, it will look a little bit odd, but unfortunately I do not want to spend time on this. Source code local tipBox = { string = "Text goes in here." } local boxX, boxY = 50 * screenWidth / screenWidth, 50 * screenHeight / screenHeight local boxPadding = 15 local lineHeight = dxGetFontHeight( 1, "default-bold" ) local minimumWidth = 350 local offsetWidth = 25 addEventHandler( "onClientRender", root, function( ) local lines = 0 local wordbreak = false local lineWidth = dxGetTextWidth( tipBox.string, 1, "default-bold" ) while ( lineWidth + offsetWidth > minimumWidth ) do lineWidth = lineWidth - minimumWidth lines = lines + 1 wordbreak = true end local boxWidth, boxHeight = minimumWidth + ( boxPadding * 3 ), ( lineHeight * ( lines + 1 ) ) + ( boxPadding * 2 ) dxDrawRectangle( boxX, boxY, boxWidth, boxHeight, tocolor( 0, 0, 0, 185 ), true ) local textX, textY = boxX + boxPadding, boxY + boxPadding local textWidth, textHeight = textX + minimumWidth + boxPadding, textY + lineHeight + boxPadding dxDrawText( tipBox.string, textX, textY, textWidth, textHeight, tocolor( 222, 222, 222, 255 ), 1, "default-bold", "left", "top", false, wordbreak, true ) end ) Example script local loremIpsumWords = { 'lorem', 'ipsum', 'dolor', 'sit', 'amet', 'consectetur', 'adipiscing', 'elit', 'curabitur', 'vel', 'hendrerit', 'libero', 'eleifend', 'blandit', 'nunc', 'ornare', 'odio', 'ut', 'orci', 'gravida', 'imperdiet', 'nullam', 'purus', 'lacinia', 'a', 'pretium', 'quis', 'congue', 'praesent', 'sagittis', 'laoreet', 'auctor', 'mauris', 'non', 'velit', 'eros', 'dictum', 'proin', 'accumsan', 'sapien', 'nec', 'massa', 'volutpat', 'venenatis', 'sed', 'eu', 'molestie', 'lacus', 'quisque', 'porttitor', 'ligula', 'dui', 'mollis', 'tempus', 'at', 'magna', 'vestibulum', 'turpis', 'ac', 'diam', 'tincidunt', 'id', 'condimentum', 'enim', 'sodales', 'in', 'hac', 'habitasse', 'platea', 'dictumst', 'aenean', 'neque', 'fusce', 'augue', 'leo', 'eget', 'semper', 'mattis', 'tortor', 'scelerisque', 'nulla', 'interdum', 'tellus', 'malesuada', 'rhoncus', 'porta', 'sem', 'aliquet', 'et', 'nam', 'suspendisse', 'potenti', 'vivamus', 'luctus', 'fringilla', 'erat', 'donec', 'justo', 'vehicula', 'ultricies', 'varius', 'ante', 'primis', 'faucibus', 'ultrices', 'posuere', 'cubilia', 'curae', 'etiam', 'cursus', 'aliquam', 'quam', 'dapibus', 'nisl', 'feugiat', 'egestas', 'class', 'aptent', 'taciti', 'sociosqu', 'ad', 'litora', 'torquent', 'per', 'conubia', 'nostra', 'inceptos', 'himenaeos', 'phasellus', 'nibh', 'pulvinar', 'vitae', 'urna', 'iaculis', 'lobortis', 'nisi', 'viverra', 'arcu', 'morbi', 'pellentesque', 'metus', 'commodo', 'ut', 'facilisis', 'felis', 'tristique', 'ullamcorper', 'placerat', 'aenean', 'convallis', 'sollicitudin', 'integer', 'rutrum', 'duis', 'est', 'etiam', 'bibendum', 'donec', 'pharetra', 'vulputate', 'maecenas', 'mi', 'fermentum', 'consequat', 'suscipit', 'aliquam', 'habitant', 'senectus', 'netus', 'fames', 'quisque', 'euismod', 'curabitur', 'lectus', 'elementum', 'tempor', 'risus', 'cras' } local tipBox = { string = "" } local boxX, boxY = 50 * screenWidth / screenWidth, 50 * screenHeight / screenHeight local boxPadding = 15 local lineHeight = dxGetFontHeight( 1, "default-bold" ) local minimumWidth = 350 local offsetWidth = 25 addEventHandler( "onClientRender", root, function( ) tipBox.string = tipBox.string .. loremIpsumWords[ math.random( #loremIpsumWords ) ] .. " " if ( tipBox.string:len( ) > 2000 ) then tipBox.string = "" end local lines = 0 local wordbreak = false local lineWidth = dxGetTextWidth( tipBox.string, 1, "default-bold" ) while ( lineWidth + offsetWidth > minimumWidth ) do lineWidth = lineWidth - minimumWidth lines = lines + 1 wordbreak = true end local boxWidth, boxHeight = minimumWidth + ( boxPadding * 3 ), ( lineHeight * ( lines + 1 ) ) + ( boxPadding * 2 ) dxDrawRectangle( boxX, boxY, boxWidth, boxHeight, tocolor( 0, 0, 0, 185 ), true ) local textX, textY = boxX + boxPadding, boxY + boxPadding local textWidth, textHeight = textX + minimumWidth + boxPadding, textY + lineHeight + boxPadding dxDrawText( tipBox.string, textX, textY, textWidth, textHeight, tocolor( 222, 222, 222, 255 ), 1, "default-bold", "left", "top", false, wordbreak, true ) end )
-
You are welcome, and good luck!
-
You calculate the width of your text, you word wrap it to a certain maximum width and then everything after that will be on a new line, and repeating that until there is no more text going over the bounds. The problem is actually in separating the words. You would have to perform some fancy maths to each word if you wanted a precise measure. Then obviously get the font height, add some extra pixels to the amount representing the full line height and multiply it by the amount of lines you have. This should get you close to what you want; but it is certainly a pain if it goes wrong.
-
Well, no. The way those two work is they do not understand wordwrapping, because of this you cannot directly use these functions, because they retrieve the length of one line, and height of just the font and not the text itself. This is where you have to calculate the wordwrapping yourself unless someone has made a function for you already. It has been a while I have been scripting on Multi Theft Auto, so I cannot remember if there was one, but it would surprise me if there was not. I recall I had a script that made all this, but cannot remember what it is. Maybe this may be of help? https://forum.multitheftauto.com/viewtopic.php?f=91&t=24262 Just make sure you always have a minimum and maximum width and height. With these parameters you are already able to do a lot of the math. This is why I would simply go for a fixed width, and possibly even height and keep my message length as small as possible. If it is smaller than the minimum height, I can specify that when I render the text. It is a little bit inefficient to work like that, but it is certainly a way that works.
-
You did the rectangle calculations incorrectly. You were not binding the width and height to the text width and height, which caused it to flow to the right if I understand your calculations correctly. The way it should work is that you bind the width and height correspondingly to the text bounds. I was able to render the box properly, though right now I do not recall a way to calculate the height of text, which is why you have to specify the height separately. local tipBox = { string = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec ut massa eget purus pharetra lobortis. Etiam efficitur pulvinar lorem vel suscipit. Nam vel erat sed arcu tristique tempus. Donec lacinia eleifend lorem, at accumsan nunc hendrerit non. Donec pulvinar lobortis metus, vitae venenatis urna. Nunc id leo velit." } local screenWidth, screenHeight = guiGetScreenSize( ) local boxX, boxY = 5 * screenWidth / screenWidth, 5 * screenHeight / screenHeight local boxPadding = 5 local textWidth, textHeight = 363, 106 local boxWidth, boxHeight = textWidth + ( boxPadding * 2 ), textHeight + ( boxPadding * 2 ) local textX, textY = boxX + boxPadding, boxY + boxPadding --dxDrawImage( boxX, boxY, boxWidth, boxHeight, tipBox.path, 0, 0, 0, tocolor( 255, 255, 255, 255 ), true ) 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, true, true ) I did not run this on Multi Theft Auto however, as I do not have Multi Theft Auto installed on this machine, but on my other rendering software I was able to render it fine as supposed to. You may also try on Lua demo with the code below: function guiGetScreenSize( )return 1920,1080 end local tipBox = { string = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec ut massa eget purus pharetra lobortis. Etiam efficitur pulvinar lorem vel suscipit. Nam vel erat sed arcu tristique tempus. Donec lacinia eleifend lorem, at accumsan nunc hendrerit non. Donec pulvinar lobortis metus, vitae venenatis urna. Nunc id leo velit." } local screenWidth, screenHeight = guiGetScreenSize( ) local boxX, boxY = 5 * screenWidth / screenWidth, 5 * screenHeight / screenHeight local boxPadding = 5 local textWidth, textHeight = 363, 106 local boxWidth, boxHeight = textWidth + ( boxPadding * 2 ), textHeight + ( boxPadding * 2 ) local textX, textY = boxX + boxPadding, boxY + boxPadding print( "box x: " .. boxX ) print( "box y: " .. boxY ) print( "box width: " .. boxWidth ) print( "box height: " .. boxHeight ) print( "text x: " .. textX ) print( "text y: " .. textY ) print( "text width: " .. textWidth + boxPadding ) print( "text height: " .. textHeight + boxPadding ) box x: 5 box y: 5 box width: 373 box height: 116 text x: 10 text y: 10 text width: 368 text height: 111
-
Been on Wiki for a year now: https://wiki.multitheftauto.com/wiki/DxDrawCircle
-
You are creating the font on every render. This is not allowed. Create the font once outside of the render function, on resource start for example. Then use that font in your rendering function, that might be the issue you are facing here. You should also make sure the font exists and works. Do not render unless the font works (or just use a fallback font). Have you passed the font file into meta.xml? Also, are you using onClientRender to render this stuff? If not, it will show up on your screen only for one frame. If these did not help, then tell us your full error message.
-
Yes. Make sure to remove the event handler when they spawn again, otherwise they cannot play.
-
That is not attached to the player's bone position.
-
Element tree is the following: Root - master of everything Player - a direct child of the root element (this is a player) Resource root - a direct child of the root element (this is a resource) Resource root's dynamic element root - a direct child of the resource root (this is all elements created by the resources script [.lua]) Resource root's map root element - a direct child of the resource root (this is all elements created by the resources maps [.map]) Whenever you want to do something for everything (all of its children), which are players and resources, you call for getRootElement( ). This contains everything. Whenever you want to do something for just an exact resource (all of its children), you call for getResourceRootElement( ). This is the root of a resource. Whenever you want to do something for just dynamic elements of a resource (e.g. objects created by createObject), you call for getResourceDynamicElementRoot( ). This is the root of dynamic elements within a resource's scripts. Whenever you want to do something for just map elements of a resource (elements found within a resource's .map file), you call for getResourceMapRootElement( ). This is the root of elements within a resource's map. This is why you see map elements and dynamic elements of a resource be removed when you stop the resource. Because these elements are children of their parent root, which then again is a parent of the resource root. Which then is a parent of the root element, so when you shut down the server, you "unload" the master of everything, which causes the server to shut down eventually because there is nothing anymore. This is why it is also discouraged to use getRootElement( ) in applications, but rather be more specific of which root you actually need. If you just need to do something to dynamic elements created by a resource, you do not need every resource, but just that one resource, and not even that, but the dynamic element root of that resource, which is why you use getResourceDynamicElementRoot( ) instead. This makes everything efficient, faster, better and obviously cleaner. ---- The "source", "client" stuff you mentioned are not directly related to element root at all. Those are related to other things, but those are good to know as well. Did this help you at all? P.S. If there are some wiseasses trying to revise something in my post, do not bother. This is supposed to be a basic representation of the system. You can go hardcore on the Tutorials forum, but not on this thread, sorry.
-
Simply just render the new camera matrix client-side on death and use the getPedBonePosition function to get the coordinates of a bone.
-
Maybe not, but it takes no effort to write one.