dewu Posted February 15, 2015 Posted February 15, 2015 Hi guys. I want to delete some vehicles from different positions. So i make that script: skasuj = { ["usun"] = { {-1185.9775390625,26.4111328125,14.1484375}, {-1724.5830078125,2559.3544921875,104.09127807617}, {615.744140625,850.1572265625,-43.009014129639}, }, } function zaznacz () for i,veh in ipairs(skasuj) do local x,y,z = veh[1],veh[2],veh[3] destroyElement(veh) end end addCommandHandler("zaznacz",zaznacz) but it's not working. What's wrong with it?
Castillo Posted February 15, 2015 Posted February 15, 2015 Well, because that makes no sense, you are trying to destroy numbers... If what you want is to remove the values from the table, then use table.remove. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Gallardo9944 Posted February 15, 2015 Posted February 15, 2015 If you want to remove vehicles standing on the exact point (they never do, though), you should find all vehicles and check their positions. getElementsByType("vehicle") and getElementPosition should help. Code Debugger - Minimalistic MTA debug line replacement
Ryancit2 Posted February 16, 2015 Posted February 16, 2015 You'll barely find vehicles at those exact pos, if you want, i can provide a small tweak to remove vehicles from specific locations (real small ones though). I made one: function destroyVehicles() local x, y, z = getElementPosition(localPlayer) local tempCol = createColRectangle(x, y, 100, 100) local vehs = getElementsWithinColShape(tempCol, "vehicle") local count = 0 for k, v in pairs(vehs) do destroyElement(v) count = count+1 end outputChatBox("Destroyed "..count.." vehicles near you.") count = 0 destroyElement(tempCol) end addCommandHandler("dvehs", destroyVehicles) [Resource] Advance Voice Messaging system with 120+ languages support! [Resource] Information markers with ingame management + editable permissions! [Resource] Live weather telling app! [Resource] Send Emails from game! [HELP?] Ask Pakistani's, have fun %3C3
Dimmitry007 Posted February 17, 2015 Posted February 17, 2015 function dAllC(thePlayer) accountname = getAccountName(getPlayerAccount(thePlayer)) if isObjectInACLGroup("user." .. accountname, aclGetGroup("Admin")) then vehicles = getElementsByType("vehicle") for i,v in ipairs(vehicles) do destroyElement(getElementData(v, "parent")) destroyElement(v) outputChatBox("Cars have been deleted !",thePlayer, 255, 0, 0, false) end end end addCommandHandler("dallvehs", dAllC) Try this sup?
JR10 Posted February 17, 2015 Posted February 17, 2015 Try this Why would this help? He wants to destroy vehicles that are near a certain world position, you're just destroying all the vehicles. Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
Ab-47 Posted February 17, 2015 Posted February 17, 2015 Create a col-shape, get objects under the vehicles class and remove the vehicles if they're within the col-shape. Simple, I guess. And now Aurora is back again, pm for more info. Ex. Lead dev & L6 Staff at AUR, NGC, MTA RP & SAA. Ex. Developer at Community of Social Gamers - CSG Ex Founder of International Gaming Community - IGC and Union of Individual Players- UIP Ab-47
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