Captain Cody Posted October 18, 2014 Share Posted October 18, 2014 How would I make it so in certain zones you can shoot, Ive been working with a car shop resource where you spawn the cars and people can get in them and it will ask if there person wants to buy them but every time I leave I come back and some one either blew up all the cars or shot up all the cars Link to comment
Banex Posted October 18, 2014 Share Posted October 18, 2014 createRadarArea toggleControl Link to comment
kotan_online Posted October 18, 2014 Share Posted October 18, 2014 https://community.multitheftauto.com/ind ... ls&id=9613 https://community.multitheftauto.com/ind ... ls&id=1055 Link to comment
Captain Cody Posted October 18, 2014 Author Share Posted October 18, 2014 I created a script but it does nothing and nothing apears in Debugscript carshop = createColRectangle ( -2001.0808105469, 218.60647583008, 114, 98 ) addEventHandler( "onColShapeHit", carshop, function(hitPlayer,thePlayer) if getElementType(hitPlayer)=="player" then triggerClientEvent(thePlayer, "zoneEnter", thePlayer) toggleControl ( thePlayer, "fire", false ) toggleControl ( thePlayer, "next_weapon", false ) toggleControl ( thePlayer, "previous_weapon", false ) setPedWeaponSlot ( thePlayer, 0 ) toggleControl ( thePlayer, "aim_weapon", false ) toggleControl ( thePlayer, "vehicle_fire", false ) toggleControl ( thePlayer, "vehicle_secondary_fire", false ) end end) addEventHandler( "onColShapeLeave", carshop,function(hitPlayer,thePlayer) if getElementType(hitPlayer)=="player"then triggerClientEvent(thePlayer, "zoneExit", thePlayer) toggleControl ( thePlayer, "fire", true ) toggleControl ( thePlayer, "next_weapon", true ) toggleControl ( thePlayer, "previous_weapon", true ) toggleControl ( thePlayer, "aim_weapon", true ) toggleControl ( thePlayer, "vehicle_fire", true ) toggleControl ( thePlayer, "vehicle_secondary_fire", true ) addCommandHandler( "devmode", function () setDevelopmentMode ( true ) end ) end end) Link to comment
xeon17 Posted October 18, 2014 Share Posted October 18, 2014 Isn't tested. greenzoneEnter = createColRectangle ( -1957.9560546875, 274.91864013672, 15, 15 ) addEventHandler( "onColShapeHit", greenzoneEnter, function(hitPlayer) if getElementType(hitPlayer)=="player" then triggerClientEvent(hitPlayer, "zoneEnter", hitPlayer) toggleControl ( hitPlayer, "fire", false ) toggleControl ( hitPlayer "next_weapon", false ) toggleControl ( hitPlayer, "previous_weapon", false ) setPedWeaponSlot ( hitPlayer, 0 ) toggleControl ( hitPlayer, "aim_weapon", false ) toggleControl ( hitPlayer, "vehicle_fire", false ) toggleControl ( hitPlayer, "vehicle_secondary_fire", false ) end end) addEventHandler( "onColShapeLeave", greenzoneEnter,function(hitPlayer) if getElementType(hitPlayer)=="player" then triggerClientEvent(hitPlayer, "zoneExit", hitPlayer toggleControl ( hitPlayer, "fire", true ) toggleControl ( hitPlayer, "next_weapon", true ) toggleControl ( hitPlayer, "previous_weapon", true ) toggleControl ( hitPlayer, "aim_weapon", true ) toggleControl ( hitPlayer, "vehicle_fire", true ) toggleControl ( hitPlayer, "vehicle_secondary_fire", true ) end end) Link to comment
Anubhav Posted October 18, 2014 Share Posted October 18, 2014 greenzoneEnter = createColRectangle ( -1957.9560546875, 274.91864013672, 15, 15 ) addEventHandler( "onColShapeHit", greenzoneEnter, function(hitPlayer) if getElementType(hitPlayer)=="player" then triggerClientEvent(hitPlayer, "zoneEnter", hitPlayer) toggleControl ( hitPlayer, "fire", false ) toggleControl ( hitPlayer "next_weapon", false ) toggleControl ( hitPlayer, "previous_weapon", false ) setPedWeaponSlot ( hitPlayer, 0 ) toggleControl ( hitPlayer, "aim_weapon", false ) toggleControl ( hitPlayer, "vehicle_fire", false ) toggleControl ( hitPlayer, "vehicle_secondary_fire", false ) end end) addEventHandler( "onColShapeLeave", greenzoneEnter,function(hitPlayer) if getElementType(hitPlayer)=="player" then triggerClientEvent(hitPlayer, "zoneExit", hitPlayer) toggleControl ( hitPlayer, "fire", true ) toggleControl ( hitPlayer, "next_weapon", true ) toggleControl ( hitPlayer, "previous_weapon", true ) toggleControl ( hitPlayer, "aim_weapon", true ) toggleControl ( hitPlayer, "vehicle_fire", true ) toggleControl ( hitPlayer, "vehicle_secondary_fire", true ) end end) Link to comment
UnG//Macaus Posted October 18, 2014 Share Posted October 18, 2014 Anubhav ,what's diffrent betwen your and the code of XeoN? Link to comment
Anubhav Posted October 18, 2014 Share Posted October 18, 2014 Anubhav ,what's diffrent betwen your and the code of XeoN? See it properly. Line 18 Link to comment
UnG//Macaus Posted October 18, 2014 Share Posted October 18, 2014 See it properly. Line 18 I see no difference Link to comment
xeon17 Posted October 18, 2014 Share Posted October 18, 2014 @codylewiz Does the code work? is everything good? Link to comment
Captain Cody Posted October 18, 2014 Author Share Posted October 18, 2014 I havent tested it yet huge fight at car shop.... Link to comment
Anubhav Posted October 18, 2014 Share Posted October 18, 2014 Macaus, you can never find the error. His one ) is missing at line 19. Are you looking the code properly? Link to comment
Tails Posted October 19, 2014 Share Posted October 19, 2014 It may not work if you spawn or teleport inside the zone. If that case you should add IsElementWithinColShape to it. Link to comment
xeon17 Posted October 19, 2014 Share Posted October 19, 2014 Macaus, you can never find the error. His one ) is missing at line 19.Are you looking the code properly? Thanks for fixing the error Anubhav! 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