Jump to content

commandHandler


itHyperoX

Recommended Posts

local allowedSerials = {
	["serialhere"] = true
}

local blockedCommands = {
	["debugscript"] = true,
	["stop"] = true,
	["etc"] = true,
}

addEventHandler("onPlayerCommand", getRootElement(), function(commandName)
	if blockedCommands[commandName:lower()] then
		if not allowedSerials[getPlayerSerial(source)] then
			cancelEvent()
		end
	end
end)

I think this one should work.

Edited by NeXuS™
  • Like 2
Link to comment

still

 

ACL: Access denied for 'aexec'

 

But its show me the output, i dont know what the problem

addEventHandler("onPlayerCommand", getRootElement(), function(commandName)
    if blockedCommands[commandName:lower()] then
        outputChatBox("ok")
        if not enabledSerials [getPlayerSerial(source)] then
            cancelEvent()
        end
    end
end)

 

Edited by TheMOG
Link to comment

Give the resource ACL permission.

<object name="resource.resourcename"/>

Add this to your ACL.xml and replace the resourcename with the actual reosources name, or if you have only your resources installed, you can do resource.*

Edited by NeXuS™
  • Like 1
Link to comment

Give me a minute, gonna test it.

Works totally fine for me, with access in the ACL.xml. Are ya calling aexec somewhere in your script? Can you copy your ACL.xml for me please?

*EDIT* Works totally fine WITHOUT any access in ACL.xml.

Edited by NeXuS™
  • Like 1
Link to comment

i'm not calling, only this in the script file @NeXuS™ here is the acl

<acl>
    <group name="Everyone">
        <acl name="Default"></acl>
        <object name="user.*"></object>
        <object name="resource.*"></object>
    </group>
    <group name="Moderator">
        <acl name="Moderator"></acl>
        <object name="resource.mapcycler"></object>
        <object name="resource.mapmanager"></object>
        <object name="resource.resourcemanager"></object>
        <object name="resource.votemanager"></object>
    </group>
    <group name="SuperModerator">
        <acl name="Moderator"></acl>
        <acl name="SuperModerator"></acl>
    </group>
    <group name="Admin">
        <acl name="Moderator"></acl>
        <acl name="SuperModerator"></acl>
        <acl name="Admin"></acl>
        <acl name="RPC"></acl>
		<object name="resource.*"></object>
    </group>
    <group name="Console">
        <acl name="Moderator"></acl>
        <acl name="SuperModerator"></acl>
        <acl name="Admin"></acl>
        <acl name="RPC"></acl>
        <object name="user.Console"></object>
    </group>
    <group name="RPC">
        <acl name="RPC"></acl>
    </group>
    <group name="autoGroup_guieditor">
        <acl name="autoACL_guieditor"></acl>
        <object name="resource.guieditor"></object>
    </group>
    <acl name="Default">
        <right name="general.ModifyOtherObjects" access="false"></right>
        <right name="general.http" access="false"></right>
        <right name="command.start" access="false"></right>
        <right name="command.stop" access="false"></right>
        <right name="command.restart" access="false"></right>
        <right name="command.stopall" access="false"></right>
        <right name="command.gamemode" access="false"></right>
        <right name="command.changemode" access="false"></right>
        <right name="command.changemap" access="false"></right>
        <right name="command.stopmode" access="false"></right>
        <right name="command.stopmap" access="false"></right>
        <right name="command.skipmap" access="false"></right>
        <right name="command.refresh" access="false"></right>
        <right name="command.refreshall" access="false"></right>
        <right name="command.addaccount" access="false"></right>
        <right name="command.delaccount" access="false"></right>
        <right name="command.debugscript" access="false"></right>
        <right name="command.chgpass" access="false"></right>
        <right name="command.loadmodule" access="false"></right>
        <right name="command.unloadmodule" access="false"></right>
        <right name="command.reloadmodule" access="false"></right>
        <right name="command.upgrade" access="false"></right>
        <right name="command.mute" access="false"></right>
        <right name="command.crun" access="false"></right>
        <right name="command.srun" access="false"></right>
        <right name="command.run" access="false"></right>
        <right name="command.unmute" access="false"></right>
        <right name="command.banip" access="false"></right>
        <right name="command.unbanip" access="false"></right>
        <right name="command.reloadbans" access="false"></right>
        <right name="command.shutdown" access="false"></right>
        <right name="command.install" access="false"></right>
        <right name="command.aexec" access="false"></right>
        <right name="command.whois" access="false"></right>
        <right name="command.whowas" access="false"></right>
        <right name="command.aclrequest" access="false"></right>
        <right name="function.executeCommandHandler" access="false"></right>
        <right name="function.setPlayerMuted" access="false"></right>
        <right name="function.addAccount" access="false"></right>
        <right name="function.addBan" access="false"></right>
        <right name="function.setUnbanTime" access="false"></right>
        <right name="function.setBanAdmin" access="false"></right>
        <right name="function.setBanReason" access="false"></right>
        <right name="function.setBanNick" access="false"></right>
        <right name="function.removeBan" access="false"></right>
        <right name="function.removeAccount" access="false"></right>
        <right name="function.setAccountPassword" access="false"></right>
        <right name="function.banIP" access="false"></right>
        <right name="function.banPlayer" access="false"></right>
        <right name="function.banSerial" access="false"></right>
        <right name="function.getBansXML" access="false"></right>
        <right name="function.unbanIP" access="false"></right>
        <right name="function.unbanSerial" access="false"></right>
        <right name="function.reloadBans" access="false"></right>
        <right name="function.setServerPassword" access="false"></right>
        <right name="function.getServerPassword" access="false"></right>
        <right name="function.callRemote" access="false"></right>
        <right name="function.fetchRemote" access="false"></right>
        <right name="function.startResource" access="false"></right>
        <right name="function.stopResource" access="false"></right>
        <right name="function.restartResource" access="false"></right>
        <right name="function.createResource" access="false"></right>
        <right name="function.copyResource" access="false"></right>
        <right name="function.addResourceMap" access="false"></right>
        <right name="function.addResourceConfig" access="false"></right>
        <right name="function.removeResourceFile" access="false"></right>
        <right name="function.setResourceDefaultSetting" access="false"></right>
        <right name="function.removeResourceDefaultSetting" access="false"></right>
        <right name="function.redirectPlayer" access="false"></right>
        <right name="function.aclReload" access="false"></right>
        <right name="function.aclSave" access="false"></right>
        <right name="function.aclCreate" access="false"></right>
        <right name="function.aclDestroy" access="false"></right>
        <right name="function.aclSetRight" access="false"></right>
        <right name="function.aclRemoveRight" access="false"></right>
        <right name="function.aclCreateGroup" access="false"></right>
        <right name="function.aclDestroyGroup" access="false"></right>
        <right name="function.aclGroupAddACL" access="false"></right>
        <right name="function.aclGroupRemoveACL" access="false"></right>
        <right name="function.aclGroupAddObject" access="false"></right>
        <right name="function.aclGroupRemoveObject" access="false"></right>
        <right name="function.refreshResources" access="false"></right>
        <right name="function.setServerConfigSetting" access="false"></right>
        <right name="function.updateResourceACLRequest" access="false"></right>
        <right name="function.shutdown" access="false"></right>
    </acl>
    <acl name="Moderator">
        <right name="general.ModifyOtherObjects" access="false"></right>
        <right name="command.gamemode" access="true"></right>
        <right name="command.changemode" access="true"></right>
        <right name="command.changemap" access="true"></right>
        <right name="command.stopmode" access="true"></right>
        <right name="command.stopmap" access="true"></right>
        <right name="command.skipmap" access="true"></right>
        <right name="command.mute" access="true"></right>
        <right name="command.unmute" access="true"></right>
        <right name="command.whois" access="true"></right>
        <right name="command.whowas" access="true"></right>
        <right name="function.setPlayerMuted" access="true"></right>
        <right name="function.kickPlayer" access="true"></right>
        <right name="function.banIP" access="true"></right>
        <right name="function.banPlayer" access="true"></right>
        <right name="function.banSerial" access="true"></right>
        <right name="function.getBansXML" access="true"></right>
        <right name="function.unbanIP" access="true"></right>
        <right name="function.unbanSerial" access="true"></right>
        <right name="function.startResource" access="true"></right>
        <right name="function.stopResource" access="true"></right>
        <right name="function.restartResource" access="true"></right>
        <right name="function.redirectPlayer" access="true"></right>
    </acl>
    <acl name="SuperModerator">
        <right name="general.ModifyOtherObjects" access="false"></right>
        <right name="command.start" access="true"></right>
        <right name="command.stop" access="true"></right>
        <right name="command.restart" access="true"></right>
        <right name="command.kick" access="true"></right>
        <right name="command.ban" access="true"></right>
        <right name="command.banip" access="true"></right>
        <right name="command.unbanip" access="true"></right>
        <right name="command.reloadbans" access="true"></right>
        <right name="command.refresh" access="true"></right>
        <right name="command.refreshall" access="true"></right>
        <right name="command.loadmodule" access="true"></right>
        <right name="command.unloadmodule" access="true"></right>
        <right name="command.reloadmodule" access="true"></right>
        <right name="command.addaccount" access="true"></right>
        <right name="command.delaccount" access="true"></right>
        <right name="command.chgpass" access="true"></right>
        <right name="function.addAccount" access="true"></right>
        <right name="function.removeAccount" access="true"></right>
        <right name="function.setAccountPassword" access="true"></right>
    </acl>
    <acl name="Admin">
        <right name="general.ModifyOtherObjects" access="true"></right>
        <right name="general.http" access="true"></right>
        <right name="command.shutdown" access="true"></right>
        <right name="command.install" access="true"></right>
        <right name="command.stop" access="true"></right>
        <right name="command.start" access="true"></right>
        <right name="command.restart" access="true"></right>
        <right name="command.aexec" access="true"></right>
        <right name="command.refresh" access="true"></right>
        <right name="function.redirectPlayer" access="true"></right>
        <right name="command.debugscript" access="true"></right>
        <right name="command.upgrade" access="true"></right>
        <right name="function.callRemote" access="true"></right>
        <right name="function.stopResource" access="true"></right>
        <right name="command.crun" access="true"></right>
        <right name="function.startResource" access="true"></right>
        <right name="command.srun" access="true"></right>
        <right name="function.fetchRemote" access="true"></right>
        <right name="command.run" access="true"></right>
        <right name="command.aclrequest" access="true"></right>
        <right name="function.addBan" access="true"></right>
        <right name="function.setUnbanTime" access="true"></right>
        <right name="function.setBanAdmin" access="true"></right>
        <right name="function.setBanReason" access="true"></right>
        <right name="function.setBanNick" access="true"></right>
        <right name="function.removeBan" access="true"></right>
        <right name="function.reloadBans" access="true"></right>
        <right name="function.executeCommandHandler" access="true"></right>
        <right name="function.setServerPassword" access="true"></right>
        <right name="function.getServerPassword" access="true"></right>
        <right name="function.createResource" access="true"></right>
        <right name="function.copyResource" access="true"></right>
        <right name="function.addResourceMap" access="true"></right>
        <right name="function.addResourceConfig" access="true"></right>
        <right name="function.removeResourceFile" access="true"></right>
        <right name="function.setResourceDefaultSetting" access="true"></right>
        <right name="function.removeResourceDefaultSetting" access="true"></right>
        <right name="function.aclReload" access="true"></right>
        <right name="function.aclSave" access="true"></right>
        <right name="function.aclCreate" access="true"></right>
        <right name="function.aclDestroy" access="true"></right>
        <right name="function.aclSetRight" access="true"></right>
        <right name="function.aclRemoveRight" access="true"></right>
        <right name="function.aclCreateGroup" access="true"></right>
        <right name="function.aclDestroyGroup" access="true"></right>
        <right name="function.aclGroupAddACL" access="true"></right>
        <right name="function.aclGroupRemoveACL" access="true"></right>
        <right name="function.aclGroupAddObject" access="true"></right>
        <right name="function.aclGroupRemoveObject" access="true"></right>
        <right name="function.refreshResources" access="true"></right>
        <right name="function.setServerConfigSetting" access="true"></right>
        <right name="function.updateResourceACLRequest" access="true"></right>
        <right name="function.shutdown" access="true"></right>
    </acl>
    <acl name="RPC">
        <right name="function.callRemote" access="true"></right>
        <right name="function.fetchRemote" access="true"></right>
    </acl>
    <acl name="autoACL_guieditor">
        <right name="general.ModifyOtherObjects" access="true" who="" pending="true" date=""></right>
        <right name="function.callRemote" access="true" who="" pending="true" date=""></right>
    </acl>
</acl>

 

Edited by TheMOG
Link to comment

I don't know what's happening with your script. Mine works just totally fine without even ACL permission to it.

Oh my god, I just misunderstood your problem, give me a minute :DD.

So, what you'll have to do, is go to your ACL.xml, and set the acccess to true at the commands you wish to enable. (Change the "Default" ACL permissions.)

<right name="command.aexec" access="true"></right>

And after, use my script, so only the players who are inside that serial table can use those commands. By doing this, everyone would be able to use those commands, so make sure that THIS script is running.

  • 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...