5150 Posted September 14, 2015 Share Posted September 14, 2015 how can i dissallow /ss for normal players, but keep it for admin, smod, and mod? i only want the chat command /ss disabled i dont want admin panel ss, or f1 GUI set skin disabled... Link to comment
1LoL1 Posted September 14, 2015 Share Posted September 14, 2015 how can i dissallow /ss for normal players, but keep it for admin, smod, and mod? i only want the chat command /ss disabled i dont want admin panel ss, or f1 GUI set skin disabled... Try this: addEventHandler("onPlayerCommand", getRootElement(), function (string) if string == "ss" then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)),aclGetGroup("Admin")) then elseif isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)),aclGetGroup("SuperModerator")) then elseif isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)),aclGetGroup("Moderator")) then else cancelEvent() end end end) Link to comment
5150 Posted September 14, 2015 Author Share Posted September 14, 2015 my brain is dead right now i put that in a resource with meta or what? Link to comment
1LoL1 Posted September 14, 2015 Share Posted September 14, 2015 my brain is dead right now i put that in a resource with meta or what? "name" name="name" version="version" type="script"/> Link to comment
KariiiM Posted September 14, 2015 Share Posted September 14, 2015 (edited) What you gave him have no sense, also ss is not defined in your code and if you want to check if the user of an cmd is in the ACL or not with more than group, simply do like that, be sure the group name is in the ACL or you'll get a Warning on the debugscript. addCommandHandler("commandName", function (player) if ( getElementType ( player ) == "player" ) then --Checking for the player who used the cmd is a player or not. local accountName = getAccountName(account) --Using the logical "or" exept of elseif IN this situation no need for elseif if ( isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) or isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "SuperModerator" ) ) or isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Moderator" ) ) ) then --Your code end end end) Edited September 14, 2015 by Guest Link to comment
5150 Posted September 14, 2015 Author Share Posted September 14, 2015 What you gave him have no sense, also ss is not defined in your codeand if you want to check if the user of an cmd is in the ACL or not with more than group, simply do like that, be sure the group name is in the ACL or you'll get a Warning on the debugscript. addCommandHandler("commandName", function (player) if ( getElementType ( player ) == "player" ) then --Checking for the player who used the cmd is a player or not. local accountName = getAccountName(account) --Using the logical "or" exept of elseif if ( isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) or isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "SuperModerator" ) ) or isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Moderator" ) ) ) then --Your code end end end) this + meta will make it so /ss is disabled for regular players? Link to comment
obuhhh Posted September 14, 2015 Share Posted September 14, 2015 (edited) tableAdministration = { "Admin", "SuperModerator", "Moderator", "Helper", } tableAdministration_two = { "Admin", "SuperModerator", } function isAdministration(player, tab) local accountName if player and getElementType(player) == "player" and not isGuestAccount(getPlayerAccount(player)) then accountName = getAccountName(getPlayerAccount(player)) else return false end for _, v in ipairs(tab) do if isObjectInACLGroup ("user." .. accountName, aclGetGroup(v)) then return true end end return false end return false end function(...) if not isAdministration(source, tableAdministration) then return false end -- body end addCommandHandler(...) Edited September 15, 2015 by Guest Link to comment
5150 Posted September 15, 2015 Author Share Posted September 15, 2015 when i put that in a zip file with the meta, it doesnt load into my server. i named everything correctly, i saved it correctly, etc etc etc but doesnt work Link to comment
TAPL Posted September 15, 2015 Share Posted September 15, 2015 local AllowedGroups = { "Admin", "SuperModerator", "Moderator" } addEventHandler("onPlayerCommand", root, function(cmd) if cmd == "ss" then local account = getPlayerAccount(source) local hasPermission if account and not isGuestAccount(account) then local accName = getAccountName(account) for _, groupName in ipairs(AllowedGroups) do local group = aclGetGroup(groupName) if group then if isObjectInACLGroup("user."..accName, group) then hasPermission = true break end end end end if not hasPermission then cancelEvent() end end end) Link to comment
5150 Posted September 16, 2015 Author Share Posted September 16, 2015 guys im still confused where do i put this script? i know a lot about scripting, but i still dont know where to put the scripts i find on the forum Link to comment
TAPL Posted September 16, 2015 Share Posted September 16, 2015 You should read this then https://wiki.multitheftauto.com/wiki/Sc ... troduction Link to comment
5150 Posted September 16, 2015 Author Share Posted September 16, 2015 so basically just create a meta? i have a meta creator Link to comment
Tete omar Posted September 16, 2015 Share Posted September 16, 2015 I'd recommend reading and learning more about Lua first and then reading MTA scripting tutorials. This is the best way to start scripting in MTA. Because MTA uses Lua as it's scripting engine. This site is very useful for learning basics about Lua: http://www.tutorialspoint.com/lua/index.htm . If you want to try out your codes, either use MTA or use this URL: http://www.lua.org/demo.html . Link to comment
5150 Posted September 16, 2015 Author Share Posted September 16, 2015 man, i know about making scripts and editing, but i think during me learning sh*t, i skipped over learning how to save scripts from the forum, etc. idk it seems like an easy explanation, but its just going right past me Link to comment
JR10 Posted September 16, 2015 Share Posted September 16, 2015 So you know how to write scripts yourself but you don't know how to copy ones from the forums? Just place them in an Lua file and add the file to the meta.xml. Link to comment
5150 Posted September 16, 2015 Author Share Posted September 16, 2015 im doing that, but im saying i think im doing something wrong because i make sure everything is named correctly, everything is listed in meta, all the scripts are correct, and everything is in the right place, but it doesnt load into my server when i try to refresh my server Link to comment
Tete omar Posted September 16, 2015 Share Posted September 16, 2015 This probably means either the resource files aren't in a folder nor in a .zip file OR something is wrong with the meta. Post your meta.xml file here please. Link to comment
JR10 Posted September 16, 2015 Share Posted September 16, 2015 Does it output any errors when you do /refresh or when you start the resource? Post your meta.xml. Link to comment
5150 Posted September 16, 2015 Author Share Posted September 16, 2015 (edited) <meta> <info author="name" name="name" version="version" type="script"/> <script src="server.lua" type="server" /> </meta> Edited September 16, 2015 by Guest Link to comment
Tete omar Posted September 16, 2015 Share Posted September 16, 2015 It looks okay to me. Did you make sure the files are in a folder or a .zip file? Also make sure server.lua is included. Link to comment
5150 Posted September 16, 2015 Author Share Posted September 16, 2015 heres the script if it helps. just a basic move gate script. and yes tete i made sure of all that local gate = createObject(10841, 82,2059.69999,24.6, 0,0,271.506) function open() moveObject(gate, 8000, 92.4,2061.1,24.6, 0,0,199.506) end addCommandHandler("barriero", open) function close() moveObject(gate, 8000, 82,2059.69999,24.6, 0,0,271.506) end addCommandHandler("barrierc", close) Link to comment
5150 Posted September 16, 2015 Author Share Posted September 16, 2015 i tested with this gate script before the ss script, in case you were wondering how this changed subject lol Link to comment
Tete omar Posted September 16, 2015 Share Posted September 16, 2015 Well since the files are in a folder/.zip file, and nothing is wrong with your meta file, and the "server.lua" script is there, are you sure your resource is placed in the right directory? Link to comment
5150 Posted September 16, 2015 Author Share Posted September 16, 2015 put in server/mods/deathmatch/resources. when i tested the ss script you guys sent to here, i used the server.lua meta from another self-made resource, also serverside. so i figured it would be fine Link to comment
JR10 Posted September 16, 2015 Share Posted September 16, 2015 Can you start the resource? What is output when you execute 'refresh' in the console? 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