Hello I am currently modifying a script for a multiverse and I want to disable a command for a specific player when he is in a specific world.
is it possible?
Example:
RegisterNetEvent('Multiverse:PlayerInRoleplay')
AddEventHandler('Multiverse:PlayerInRoleplay', function(src, cb)
local ids = ExtractIdentifiers(src);
if (WorldTracker[ids.license] == "rp") then
TriggerEvent("ScriptName:disablecommand") -- Not a real command
end
end)
Hey
!
You could modify the command creation function itslef, by adding to a condition :
RegisterCommand("commandName", function(source --[[ this is the player ID (on the server): a number ]], args --[[ this is a table of the arguments provided ]], rawCommand --[[ this is what the user entered ]])
if source.world == "WORLD1" then
print("Do the command instructions.")
elseif source.world == "WORLD2" then
print("deny access to the command")
else
--Do Nothing
end
end, true)
In this case source.world is just here as an example, but you can remplace it by the Player’s Object created by the framework you use (by adding a attribute world to the player Object yourself) or use State bags (see Cfx doc) to add this attribute to the player without modifying the framwork’s Player Object.
Another idea, but not sure it could work. Is adding a new groupe for each world. And then use aces to deny/allow the pool of commands
add_ace group.world1 command.mycommand deny
the ace permissions can work but is it possible to remove ace permissions to player thru console?
i know its possible to add but i dont know if its possible to remove
Hey, yeah you can remove aces through the console while the server is running.
By doing
remove_ace group.world1 command.mycommand deny
i need to add principal permmisions to a specific player