Jump to content

50p

Retired Staff
  • Posts

    2,973
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by 50p

  1. INTRODUCTION Many of you know MTA:Script Editor and that I've stopped working on it. The main reason was the syntax highlighter has many bugs that annoy me and others. Due to the fact I stopped developing it I decided to find a better solution. At first I wanted to make an extension for Eclipse but I thought that's too much to download for everyone just to script for MTA. Then I wanted to write an extension for Visual Studio but again, too much to download. I heard of Sublime Text which is small in download size but powerful at the same time. So I downloaded it and immediately started researching how to make packages for it. Because I made an application for MTA:SE to fetch all the MTA functions and save them in an SQLite database, I decided to reuse it and generate files for Sublime Text instead. So, this is what I came up with over the weekend. INSTALLATION Make sure you have Sublime Text installed. It works with both, Sublime Text 2 and 3 (thanks Goonz for confirming it works with Sublime Text 2). Download the 50pMTAEditor.zip from the link below. Extract the .zip to C:\Users\\AppData\Roaming\Sublime Text 3\Packages\User\50pMTAEditor\ Run Sublime Text 3 and create a new file (File -> New) - this is only necessary so that you can see if it works Select the syntax highlighter (View -> Syntax -> Lua (MTA:SA) ) Select color scheme which has colors of MTA function names. Red for client-side, Orange for server-side and Blue for shared functions (Preferences -> Color Scheme -> User -> 50pMTAEditor -> Monokai-MTA-Edit) And you're ready to edit .lua files and have all MTA functions highlighted and auto-completion too. DOWNLOAD https://dl.dropboxusercontent.com/u/437 ... Editor.zip (only 512 KB) (MD5: CA7EA2AEE682B79BBCA01A34AC39C9FD) KNOWN ISSUES Auto-complete window that shows up when you're typing function names will show both server and client functions because Sublime Text doesn't know which files should be showing which functions. It doesn't matter for many functions because the parameters are the same, but for some functions it does matter, like outputChatBox has "visibleTo" parameter which is not present in client-side variant. In client-side files you will also see server-side functions (eg. getPlayerAccount).
  2. That's for simplicity of collision detection. It's easier to check if x < 10 and x > -10 then calculating the rotation and then collision. The colshapes are simple primitives (box, sphere, rectangle, etc.) It takes very little time to check if point XYZ is inside a box or rectangle, same with sphere; simply checking the distance between 2 points and comparing it with the radius of sphere. You can use createColPolygon and additionally, onColShapeHit check the Z axis.
  3. I've never experienced such problem because I've never done such things but are the objects disappearing in order the were created or maybe distance? You did mention it's all streamed in but these are custom objects. Also, make sure the models you are replacing are not small objects like bins, furniture, etc. since these objects disappear when you move away from them not too far. You'd have to use engineSetModelLODDistance.
  4. I have stopped developing the project but I started a new one. This time I moved to Sublime Text 3. It's simple but powerful text editor. It already has Lua support but I've added MTA functions to auto-complete as well as highlighted them (client-side are red, server-side orange and shared are blue). It has parameters included so that when you auto-complete a function name it will also fill the parameter names as well. getEle -- will show auto-complete list and when you hit TAB on a function (eg. getElementHealth) it will auto-complete: getElementHealth( element theElement ) -- "element theElement" will be selected so you can change it to your element Here is a screenshot: https://dl.dropboxusercontent.com/u/437 ... Editor.png What I'm planning to add in the future: 1. "Build system" that will compile the current resource 2. Start MTA Server (if it's not running), ask the server to start current resource and join the server (with mtasa:// protocol) 3. When new file is created in a resource folder (inside of Sublime Text 3) then add it to meta.xml automatically But first I will have to learn Python before I can add these features.
  5. Don't make the variable local inside the function because the function is called every frame and every time it's called you assign 255 to the same variable. That is logical and alpha will be 255 every frame.
  6. 50p

    [REQ]Drift score

    My drift resource was built to be as flexible as possible, like most of my resources so that other people can create their resources and use custom events and/or exported functions. Have a look in the main drift file (c_drift.lua) and you will see. It's easy to make a resource to save the drift score. There are 4 custom events, onClientVehicleStartDrift (triggered when player starts to drift), onClientVehicleEndDrift (triggered when player ends the drift, 2 sec after stopped drifting), onClientVehicleDrift (triggered every frame when player is drifting), onClientVehicleDriftCombo (triggered every time player stops drift but gets back to drift within 2 sec). As you can see, you could create your own server-side event like onPlayerEndDrift, and trigger that event with player's score when player stops drifting and save their score. If you can't script then it may be difficult because you'll have to learn. Unless someone will make it for you.
  7. If you're drawing your own HUD with DX functions then you can create a render target and render all your HUD on it. Then draw the render target. When you need to shake it then you just wiggle the position of the entire render target. No shaders needed.
  8. I know but the biggest reason I lost interest was the syntax highlighter as it's far from perfect. It has plenty of customizations but almost impossible to make it work the way it would be best for MTA. Especially, multi line comments annoy me the most and the author of the highlighter gave me a snippet, it worked fine but only if I haven't used other styles for function names, Lua keywords, etc. I've had many great ideas to add to MTA:SE (.dff/.txd viewer, editing server files via FTP and more) but due to lack of people's interest and annoying highlighter I lost interest too. Anyway, I hope you managed to get your meta.xml fixed.
  9. I'm surprised nobody has ever reported that. That just means nobody uses MTA:SE. If nobody uses your product then you lose interest in it. MTA:SE saves meta.xml file in UTF-8 format but MTA Server doesn't like it. You can fix the file by opening it in Notepad and Save As, then select the format to ANSI.
  10. Line 9: if money >= amount and amount > 0 then Don't say the code is yours if it's not.
  11. https://wiki.multitheftauto.com/wiki/RemoveWorldModel the last example
  12. Yeah, have 1 table in 1 resource and an exported function. If you need to access that table, just call the exported function.
  13. https://wiki.multitheftauto.com/wiki/Se ... undEnabled
  14. 50p

    OOP Classes

    I just made a quick app to let me get all the functions/classes from the source code and generate a wiki page, here they are: https://wiki.multitheftauto.com/wiki/OOP_client (client functions) and https://wiki.multitheftauto.com/wiki/OOP_server (server functions).
  15. I'm confused. What's the point of this script? Why calculate pi? How are you going to calculate pi by passing a number to the command? print( math.pi ); -- or if accuracy isn't that important to you: print( 22/7 );
  16. 50p

    Problems skin

    Locked. Go to SA-MP forum. We can't help you here.
  17. You're showing the table's address in memory not the values themselves. tostring(Inventory); -- table: 21D2E2A8 This value will be the same everywhere in the code.
  18. You can load files to memory and keep the stored in variables/table. Once the resource gets loaded, load the files to memory and remove them from the file system (fileDelete). That will also make the player download the files again when they join the server. That's fine if the files aren't big (~50kb) and if you don't have too many files. What I mean by load to memory? Simply: engineLoadDFF engineLoadTXD engineLoadCOL When returned to variable they will stay in memory. One more thing you can do to protect your .dff files is to select button "lock DFF" in 3DS Max before exporting the model. This is not the safest way to do it because it's simple to remove the lock in a binary file editors.
  19. 50p

    vehicle velocity

    The problem is inside GTA:SA engine. You can see that driving in town will never let you drive at full speed but when you take your vehicle on the highway (like the one around Las Venturas) then you can go pretty fast. Take an Infernus and drive in town, then take it to the highway, see the large speed difference.
  20. 50p

    Minimap Mod.

    That won't work. It's for every client to install separately. MTA will not run libraries (.dll's).
  21. Sorry, that was "radar_centre".
  22. If you're editing a radar resource then simply replace original .png file with yours. If you want to replace the player icon of the default GTA:SA radar then you have to change "arrow" to "radar_player".
  23. guiProgressBarGetProgress
  24. In this example, you can read the whole file and store it in a variable. Then use my string function below to add whatever you want, where ever you want. After that write the new string back to the file. function string.insert( str, val, pos ) -- eg: string.insert( "Hello and welcome", " Boss", 6 ); will return "Hello Boss and welcome" pos = pos or #str; return str:sub(1, pos-1) .. tostring(val) .. str:sub( pos, #str ); end
×
×
  • Create New...