Jump to content

Saml1er

Retired Staff
  • Posts

    1,058
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Saml1er

  1. .map is not downloaded itself. Only other files like .txd, .dff, music, images etc are downloaded. Objects are created clientside in MGM scripts because it will put stress on server if there are too many arenas.
  2. Objects created by server cannot be destroyed in client side. After .map is loaded then run this in client side: for _,v pairs (getElementsByType("object")) do destroyElement (v) end You will see that objects cannot be destroyed because they are not created client side. Also .map is downloaded btw Objects are created client side but in different sense that they are created server side and server side controls them not client side. Basically if object is created client side then it cannot be controlled from server side because it does not exist there. If you work with RakNet library in c++, you will learn how this works. MTA doesn't explain this so majority new programmers don't get this part.
  3. Nope, objects created in client side are only seen by the client. bindKey ("k","down", function () createObject ( ... ) end ) Test this in client side. If you press "k" then you will see the object only. Other people won't. btw YES, objects are created server side from map. Check wiki documentation for .map format.
  4. Not a complete script but at least you will get an idea from it: https://forum.multitheftauto.com/viewtopic.php?f ... it=+Follow
  5. Awesome job. Why I didn't knew about this before? I stopped scripting in lua and now I am working with wordpress but still this is useful for me if I ever work with lua again. Will install it ^^ Thank you.
  6. The person also needs to test your script in your server before buying it.
  7. This can be achieved using engineApplyShaderToWorldTexture You can check the "UV scripted" resource to see how its done.
  8. He did not ask anyone to teach him. He just wants to know how it works. @LinKin: Yes, you can download resources from admin panel. Bonsai stole ddc maps from pink server as he was given admin rights so yeah it does work. You can easily add an event handler in client side by executing code in client side and then get the resource data you want by file functions and send them to a specific client so yeah it does work.
  9. Hello! If you have more than 20 ( actually 10 but other ten are for shades) dx functions called at the same time and with some other images rendered on radar like 12 images then you will lagg like hell no matter how powerful your computer is, you will still get lag spikes. My scripts were working fine in MTA 1.4. Has anybody else experienced it?
  10. There is a possibilty that somebody hacks your forum account and misuses it. That is only possible to misuse your account if he knows the password, right? So if the client does not know the URL then he can't do anything.
  11. When I tried to do it like this: local scale = (sx/1024)*1 Then dx text scale was different. It was okay on lower resolutions but on higher resolutions than 1024x768 It didn't work well. I had to do it using height ( sy/768 )*1. But the most epic part was that it worked without any problem if I used max resolution (sx/1920)*1. This worked perfectly. I have tested this and spent days on it. This was the solution I came up with.
  12. You don't need to take 'your' resolution. You need to take the resolution you created the GUI for in the first place. So if you're working on some GUI, take your resolution and use it in your code. I'll show you what I mean. Here's a piece of code from one of my resources. The text displayed by dxDrawBorderedText (combined with the function below it) will show the same for every resolution even beyond 1080p. function dxDrawBorderedText(text, x, y, w, h, color, scale, font, alignX, alignY, clip, wordBreak, postGUI) local sWidth,sHeight = guiGetScreenSize() local sw,sh = 1280,960 dxSetAspectRatioAdjustmentEnabled(true) dxDrawText(text, x/sw*sWidth +4, y/sh*sHeight +4, w/sw*sWidth, h/sh*sHeight, tocolor(0, 0, 0, 255), scale/sw*sWidth, font, alignX, alignY, clip, wordBreak, false) dxDrawText(text, x/sw*sWidth -4, y/sh*sHeight +4, w/sw*sWidth, h/sh*sHeight, tocolor(0, 0, 0, 255), scale/sw*sWidth, font, alignX, alignY, clip, wordBreak, false) dxDrawText(text, x/sw*sWidth +4, y/sh*sHeight -4, w/sw*sWidth, h/sh*sHeight, tocolor(0, 0, 0, 255), scale/sw*sWidth, font, alignX, alignY, clip, wordBreak, false) dxDrawText(text, x/sw*sWidth -4, y/sh*sHeight -4, w/sw*sWidth, h/sh*sHeight, tocolor(0, 0, 0, 255), scale/sw*sWidth, font, alignX, alignY, clip, wordBreak, false) dxDrawText(text, x/sw*sWidth +1, y/sh*sHeight +4, w/sw*sWidth, h/sh*sHeight, tocolor(0, 0, 0, 255), scale/sw*sWidth, font, alignX, alignY, clip, wordBreak, false) dxDrawText(text, x/sw*sWidth -1, y/sh*sHeight +4, w/sw*sWidth, h/sh*sHeight, tocolor(0, 0, 0, 255), scale/sw*sWidth, font, alignX, alignY, clip, wordBreak, false) dxDrawText(text, x/sw*sWidth +1, y/sh*sHeight -4, w/sw*sWidth, h/sh*sHeight, tocolor(0, 0, 0, 255), scale/sw*sWidth, font, alignX, alignY, clip, wordBreak, false) dxDrawText(text, x/sw*sWidth -1, y/sh*sHeight -4, w/sw*sWidth, h/sh*sHeight, tocolor(0, 0, 0, 255), scale/sw*sWidth, font, alignX, alignY, clip, wordBreak, false) dxDrawText(text, x/sw*sWidth, y/sh*sHeight, w/sw*sWidth, h/sh*sHeight, color, scale/sw*sWidth, font, alignX, alignY, clip, wordBreak, postGUI) end function drawMyText() dxDrawBorderedText("My cool text", 967, 828, 1089, 905, tocolor(195, 195, 195, 255), 2.00, "pricedown", "left", "top", false, false, true, false, false) end As you can see the x,y's are 967, 828, 1089, 905. That's based off of my resolution (1280x960). So, when using the code above, adjust the resolution to the one you're working on then adjust the xy's for the drawText in the second function. It should scale on all resolutions. @Lock7130 You can easily adjust the code to work with dxDrawRectangle as well but be sure every parameter corresponds to that function https://wiki.multitheftauto.com/wiki/DxDrawRectangle I know but dx text scale was a problem. I had to do it like this instead: local sx, sy = guiGetScreenSize () local scale = (sy/768)*1 -- I still have no idea why this worked but it actually did.
  13. [9] = {-1923.2001953125,454.2998046875,0.30000001192093}, -- REMOVE THIS COMMA }
  14. I use this method for a long time, but how about the text and its scale? Yes. Same method for text but you have to change scale to relative as well. local scale = 1 * scx dxDrawText ( "text", scx*0.3, scy*0.4, scx*0.2, scy*0.6, tocolor ( 0, 0, 0, 255 ), scale )
  15. Some people say that you have to take your resolution but that is actually wrong. It took me more than 10 days to figure it out. You have to take the max resolution if you want relative sizes. So in your case: local mX, mY = 1920, 1080 -- max resolution local sx, sy = guiGetScreenSize() local scx, scy = sx/mX, sy/mY mX, mY = nil, nil -- free the memory since you won't need them anymore -- multiply scx and scy with number between 0-1 and they will fit on all resolutions perfectly. dxDrawRectangle ( 0.2*scx, 0.4*scy, 0.3*scx, 0.3*scy) -- Remember for dx scale you must multiply it with scx only and it will fit
  16. Dealman is right. I wrote an entire lobby script ( around 6000 lines ) in lua without using OOP. It worked well. Its a matter of choice. I use OOP in C++ only because its necessary there .
  17. It doesn't matter if it is frozen. Player will still receive updates of that car if it is created server side and is streamed in.
  18. Aik simple example write ki hai. local start = getTickCount() local time = start + 7000 addEventHandler("onClientRender", root, function () local now = getTickCount() local elapsedTime = now - start local duration = time - start local progress = elapsedTime / duration local _, y = interpolateBetween ( 0, 600, 0, 0, 300, 0, progress, "OutBounce") dxDrawRectangle(147, y, 237, 48, tocolor(255, 255, 255, 255), false) end ) EDIT: thodi se modify kerli hai.
  19. -- I am not sure gui-element is a type used for all elements because I could not find it on wiki but check if it works local table1 = getElementsByType("gui-element") or local table1 = getElementChildren ( guiRoot ) If you want to get all the window elements then local table1 = getElementsByType("gui-window") You can also get window elements created by the resource running this script local table1 = getElementsByType("gui-window", resourceRoot )
  20. Saml1er

    Bonsai skype

    His skype is: beene111
  21. Two methods. 1. local team = createTeam (...) outputChatBox ( "(source) needs a taxi", team ) 2. for _, v in pairs ( getPlayersInTeam ( team ) ) do outputChatBox ( "(source) needs a taxi", v ) end
  22. Here's a simple example: local data = { } -- define a table function EndTheMission (hitElement) if hitElement == TrailerAb then data [ hitElement ] = "Hey "..getPlayerName(hitElement) -- insert it in table. end end addEventHandler ("onMarkerHit", FinishPoint , EndTheMission) addCommandHandler ("a", function (p ) local v =data[p] if v then outputChatBox ( v ) end end ) When you hit the marker than a string is inserted and index is a player. If you want to see the output then execute command /a Please kindly google "lua tables" and learn how they work for better explanation.
  23. I don't remember exactly how I did it but my current code looks like this: local f, err = loadstring (callbackString) if err then --failed? Lets try with return that works most of the time f, err = loadstring ( "return "..callbackString) end if not err then pcall ( f ) end -- lua.org recommends to use pcall EDIT: I doubt if you can pass variables like into command function. Why don't you concat it? "exports.something ("..arg..")"
  24. Can you tell us which line it is in lua code? Take a screen or something. I really won't bother trying to understand your code if I find it time consuming.
×
×
  • Create New...