Black2 Posted July 19, 2015 Share Posted July 19, 2015 Hello,I need help here. I need the command to work only in one location, so not working on other map locations,i don't know how,more can use rectangle or height function. Any Idea ? Link to comment
LaCosTa Posted July 19, 2015 Share Posted July 19, 2015 I don't know you can use --colShape functions as createColCircle createColRectangle -- you can find those in wiki as well as their events -- or simply use function authorizeCmd (thePlayer , cmd ) if getElementType(thePlayer) ~= "player" then return end local x, y, z = getElementPosition(thePlayer) zone = getZoneName(x, y, z, true) -- will output LS , LV, SF if (zone == "Las Venturas" ) and (cmd) then -- you can change Las Venturas to location you want -- do something end end -- Not tested though . Link to comment
GTX Posted July 19, 2015 Share Posted July 19, 2015 Based on zone name: local blacklistCommands = { ["say"] = true } addEventHandler("onPlayerCommand", function(command) local x, y, z = getElementPosition(source) if getZoneName(x, y, z, true) == "Los Santos" and blacklistCommands[command] then cancelEvent() end end ) Or ColShape: local blacklistCommands = { ["say"] = true } local col = createColCircle(...) addEventHandler("onPlayerCommand", function(command) if isElementWithinColShape(source, col) and blacklistCommands[command] then cancelEvent() end end ) Link to comment
Perfect Posted July 21, 2015 Share Posted July 21, 2015 I am assuming you want a command to work on specific location. In that case, the following will do the job. function restrictedCommand(thePlayer) if getElementZoneName (thePlayer) == "YourZoneName" then -- do your stuff end end addCommandHandler("YourCommand", restrictedCommand) 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