BulgariaRoam Posted January 4, 2018 Posted January 4, 2018 Anyone has idea how do i enable the freeroam menu only for dimension 0? function openFrGui(client) if (getElementDimension(client) > 0) then outputChatBox("Your dimension doesn't allow you to open Freeroam Menu", client, 255, 0, 0) return end
DNL291 Posted January 4, 2018 Posted January 4, 2018 fr_client.lua > line 1620 (toggleFRWindow), put this line: if getElementDimension(localPlayer) ~= 0 then return end 1
BulgariaRoam Posted January 17, 2018 Author Posted January 17, 2018 and how i do this for cv(createvehicle) i try put this code everywhere and not possible.
KaMi Posted January 17, 2018 Posted January 17, 2018 1 minute ago, BulgariaRoam said: and how i do this for cv(createvehicle) i try put this code everywhere and not possible. For that you need edit the freeroam ( i think ) .
BulgariaRoam Posted January 17, 2018 Author Posted January 17, 2018 2 minutes ago, <~KaMiKaZe~> said: For that you need edit the freeroam ( i think ) . thanks i already know that einstein, i also try this option but same problem local dimension = 0 local thePlayer = getLocalPlayer() function createVehicleCommand(cmd, ...) if (getElementDimension(thePlayer) == dimension) then local vehID local vehiclesToCreate = {} local args = { ... } for i,v in ipairs(args) do vehID = tonumber(v) if not vehID then vehID = getVehicleModelFromName(v) end if vehID then table.insert(vehiclesToCreate, math.floor(vehID)) end end server.giveMeVehicles(vehiclesToCreate) else outputChatBox("You cannot create vehicle as you are not in the Freeroam arena!", 255, 0, 0) end end addCommandHandler('createvehicle', createVehicleCommand) addCommandHandler('cv', createVehicleCommand)
ÆBKV Posted January 17, 2018 Posted January 17, 2018 (edited) addEventHandler("onPlayerCommand",root, function(command) if not getElementDimension(source) == 0 and command == "createvehicle" or command == "cv" then cancelEvent() ouputChatBox("You cannot use this command as you are not in the Freeroam arena!",player,255,0,0) end end ) Edited January 17, 2018 by ÆBKV
DNL291 Posted January 18, 2018 Posted January 18, 2018 (edited) Do you want to disable it for the button "Create vehicle" too? Try this: function createSelectedVehicle(leaf) if (getElementDimension(localPlayer) ~= 0) then return outputChatBox("You cannot create vehicle as you are not in the Freeroam arena!", 255, 0, 0) end if not leaf then leaf = getSelectedGridListLeaf(wndCreateVehicle, 'vehicles') if not leaf then return end end server.giveMeVehicles(leaf.id) end That function is at line 944 (fr_client.lua), you can just put the if statement at the beginning of the function. For the command: function createVehicleCommand(cmd, ...) if (getElementDimension(localPlayer) ~= 0) then return outputChatBox("You cannot create vehicle as you are not in the Freeroam arena!", 255, 0, 0) end local vehID local vehiclesToCreate = {} local args = { ... } for i,v in ipairs(args) do vehID = tonumber(v) if not vehID then vehID = getVehicleModelFromName(v) end if vehID then table.insert(vehiclesToCreate, math.floor(vehID)) end end server.giveMeVehicles(vehiclesToCreate) end addCommandHandler('createvehicle', createVehicleCommand) addCommandHandler('cv', createVehicleCommand) Edited January 18, 2018 by DNL291 1
BulgariaRoam Posted January 18, 2018 Author Posted January 18, 2018 Mr, you are a god to me! Thank you !!!
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