xJ4ckk Posted December 1, 2016 Share Posted December 1, 2016 (edited) I have a Greenzone script on my MTA Server and please can anyone tell me how i can Dissalow Vehicles in the Greenzone?? when i walk into the Greenzone i can't shoot etc.. but i can create Vehicles i want to disallow vehicles in the Greenzone :(( please help I use this: https://community.multitheftauto.com/index.php?p=resources&s=details&id=761 Edited December 1, 2016 by xJ4ckk Link to comment
LoPollo Posted December 1, 2016 Share Posted December 1, 2016 I guess that script uses a colshape to limit the greenzone (i'm lazy to check) If a vehicle enters (or gets created) inside that colshape then you can do whatever you want with that vehicle. Edit the script knowing this. If you need further help (for example the script is compiled, uses other ways to greenzone an area, or you are not able to script) ask here Link to comment
ViRuZGamiing Posted December 2, 2016 Share Posted December 2, 2016 10 hours ago, LoPollo said: I guess that script uses a colshape to limit the greenzone (i'm lazy to check) If a vehicle enters (or gets created) inside that colshape then you can do whatever you want with that vehicle. Edit the script knowing this. If you need further help (for example the script is compiled, uses other ways to greenzone an area, or you are not able to script) ask here You could use this as well getElementsWithinColShape Link to comment
xJ4ckk Posted December 2, 2016 Author Share Posted December 2, 2016 I have removed the MoneyZone line and wanted to replace it with something else, if I had not removed the MoneyZone I would have to insert the cooardinates where the players can not spawn any vehicles. So I need your help to make it without coordinates I want to do it when I enter the Greenzone I can not create a vehicle. I mean without that: setElementPosition (hitElement, 2018.33, 1534.77, 12.37) Link to comment
LoPollo Posted December 2, 2016 Share Posted December 2, 2016 4 hours ago, ViRuZGamiing said: You could use this as well getElementsWithinColShape Lol reading my reply i noticed i did not mentioned the event itself, sorry. But OnColshapeHit is better than getElementsWithinColShape since with the event you get when a vehicle enters or gets created inside it. 2 hours ago, xJ4ckk said: I have removed the MoneyZone line and wanted to replace it with something else, if I had not removed the MoneyZone I would have to insert the cooardinates where the players can not spawn any vehicles. So I need your help to make it without coordinates I want to do it when I enter the Greenzone I can not create a vehicle. I mean without that: setElementPosition (hitElement, 2018.33, 1534.77, 12.37) What do you mean with "without setElementPosition"? I can't get what do you want with the last reply. Yes you deleted the MoneyZone colshape (line 57 right?) but the colshapes are created using the "radararea" elements' positions and sizes. I also don't get what you want to do when a vehicle enters these colshapes. " I would have to insert the cooardinates where the players can not spawn any vehicles." what do you mean? arent's these the radarareas? Link to comment
ViRuZGamiing Posted December 2, 2016 Share Posted December 2, 2016 Didn't knew created elements inside a col did trigger the enter event, in that case indeed Link to comment
LoPollo Posted December 2, 2016 Share Posted December 2, 2016 Yes some elements trigger the event: i used this to make Link to comment
MTA Anti-Cheat Team Dutchman101 Posted December 3, 2016 MTA Anti-Cheat Team Share Posted December 3, 2016 (edited) I made anti-vehicle zones script, it does exactly what you want and you can just replace its coordinates with your greenzones' locations. Here: https://community.multitheftauto.com/index.php?p=resources&s=details&id=12240 You can also study its code so you learn how this can be achieved. Basicly this is all: -- storage for the zones -- Format is: {x = 0, y = 0, z = 0, width = 0, depth = 0, height = 0}, local vZones = { {x = 77.89, y = 1011.84, z = 12, width = 63.97, depth = 101.42, height = 32.88}, -- random example location located in Bone County } -- initialize all zones on resource start local z = {} function initvZones() if vZones and #vZones ~= 0 then for _,v in ipairs (vZones) do if v then if v.x and v.y and v.z and v.width and v.depth and v.height then local c = createColCuboid (v.x, v.y, v.z, v.width, v.depth, v.height) if c then z[c] = true for _,v in ipairs (getElementsByType("vehicle")) do if isElementWithinColShape (v, c) then destroyElement(v) end end addEventHandler ("onElementDestroy", c, function() if z[source] then z[source] = nil end end ) addEventHandler ("onColShapeHit", c, function (h, d) if h and d and isElement(h) and getElementType (h) == "vehicle" then destroyElement (h) end end ) end end end end end end addEventHandler ("onResourceStart", resourceRoot, initvZones) Edited December 3, 2016 by Dutchman101 Link to comment
xJ4ckk Posted December 8, 2016 Author Share Posted December 8, 2016 (edited) Dutchman i tried your Antivehicle script, it is very good but when i create a vehicle and press fast "F" i can drive in the vehicle? Edited December 8, 2016 by xJ4ckk Link to comment
iPrestege Posted December 8, 2016 Share Posted December 8, 2016 @xJ4ckk You can use : onVehicleStartEnter ,And check that the player is in the colshape using this function isElementWithinColShape . And cancel the event using : cancelEvent . And destroy the vehicle using destroyElement Good luck. 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