Dzsozi (h03) Posted November 17, 2016 Share Posted November 17, 2016 With this script you are able to create your custom districts in MTA:SA, this is useful for almost "anything" (custom maps with your own districts, gang zones (which might require a little editing), protect zones, etc.)! You can create your own districts in the districtC.lua file, an example is given. Export functions: - getDistrictName(element) Get the custom district name of an element (works client and server side) - onElementDistrictChange This is a custom event, the source of this event is the element that changed district (currently working only client-side) PARAMETERS: districtName - An integer representing the name of the current custom district Note that the event works on client-side, but it is possible to do it on server-side if it's needed. !! The source of the onElementDistrictChange event is the element that changed the district, could be a vehicle, a ped, a player, anything that is an element. !! An example script for using the event and getting the district name is given in the exampleC.lua file, check that for usage and the example command. Future versions MIGHT contain: - Server-sided onElementDistrictChange event - A command to add a district manually Special thanks to for helping with the script to: Tails, pa3ck If you have any question just write a comment! Feel free to edit, but please, keep the credits. DOWNLOAD: https://community.multitheftauto.com/index.php?p=resources&s=details&id=13834 Images: /getpos - If currently NOT in a custom district /getpos - If currently in a custom district Entering a custom district 1 Link to comment
HeySlickThatsMe Posted November 17, 2016 Share Posted November 17, 2016 Nice work! i might use it in my Vice project Link to comment
Dzsozi (h03) Posted November 17, 2016 Author Share Posted November 17, 2016 Thanks! That's what I did as well, I originally created it for VC, if you are interested I have the Vice City district names, positions and sizes already made in the table. You might have to change positions tho. 1 Link to comment
Popular Post AfterAll14 Posted November 18, 2016 Popular Post Share Posted November 18, 2016 On 17.11.2016 at 11:21 PM, ThatsMe said: Nice work! Absolutely agree. Masterpiece of scripting we have here. 56 lines of code in 3!!!!! lua files, and a separate export funtion is very reasonable for this case. But the most important about this script - the guy was so genius, he didn't even bother making something new by himself. He simply renamed radar areas into "districs" - and BOOOM!!! It's a brand new entity for GTA SA! 4 Link to comment
AfterAll14 Posted November 18, 2016 Share Posted November 18, 2016 local radarArea = createRadarArea (0, 0, 100, 200, 255, 225, 255, 150 ) setElementData(radarArea, "name", "Example District Name", false) function GetAreaName() local x, y = getElementPosition(localPlayer) for key, area in pairs(getElementsByType("radararea")) do local sizeX,sizeY = getRadarAreaSize(area) local rX,rY = getElementPosition(area) if x > rX and x < rX+sizeX and y>rY and y<rY+sizeY then return getElementData(area, "name") end end end same "resource" in 12 lines 2 Link to comment
Dzsozi (h03) Posted November 18, 2016 Author Share Posted November 18, 2016 1 hour ago, AfterAll14 said: Absolutely agree. Masterpiece of scripting we have here. 56 lines of code in 3!!!!! lua files, and a separate export funtion is very reasonable for this case. But the most important about this script - the guy was so genius, he didn't even bother making something new by himself. He simply renamed radar areas into "districs" - and BOOOM!!! It's a brand new entity for GTA SA! Haha, thank you!! 1 Link to comment
Gravestone Posted November 19, 2016 Share Posted November 19, 2016 13 hours ago, AfterAll14 said: Absolutely agree. Masterpiece of scripting we have here. 56 lines of code in 3!!!!! lua files, and a separate export funtion is very reasonable for this case. But the most important about this script - the guy was so genius, he didn't even bother making something new by himself. He simply renamed radar areas into "districs" - and BOOOM!!! It's a brand new entity for GTA SA! 1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now