Jump to content

[Help] Freeroam


Recommended Posts

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

 

Link to comment
  • 2 weeks later...
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)

 

Link to comment
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 by ÆBKV
Link to comment
  • Moderators

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 by DNL291
  • Like 1
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...