TheBite Posted April 25, 2013 Share Posted April 25, 2013 Hey to all, how to disable a command like /superman for general users? I tryed to type in ace - everyone "" but normal users can type superman and fly, now? Link to comment
0 PaiN^ Posted April 27, 2013 Share Posted April 27, 2013 Not tested, Try : addEventHandler ( 'onPlayerCommand', root, function ( player, cmd ) if cmd == 'superman' then local account = getPlayerAccount ( player ); if isGuestAccount ( account ) then cancelEvent ( ); end end end ); Link to comment
0 TheBite Posted April 28, 2013 Author Share Posted April 28, 2013 Not tested, Try : addEventHandler ( 'onPlayerCommand', root, function ( player, cmd ) if cmd == 'superman' then local account = getPlayerAccount ( player ); if isGuestAccount ( account ) then cancelEvent ( ); end end end ); In a new script? Link to comment
0 Drakath Posted April 28, 2013 Share Posted April 28, 2013 Doesn't matter, just make sure its serverside. Link to comment
0 PaiN^ Posted May 3, 2013 Share Posted May 3, 2013 Hmm ... It should work, Make sure of the command ( upper and lower case letters and stuff ). Link to comment
0 TheBite Posted May 3, 2013 Author Share Posted May 3, 2013 (edited) This script I tryed to make: disable.lua addEventHandler ( 'onPlayerCommand', root, function ( player, cmd ) if cmd == 'superman' then local account = getPlayerAccount ( player ); if isGuestAccount ( account ) then cancelEvent ( ); end end end ); meta.xml <meta> <info author="name" name="Disable" version="1.0" type="script"/> <script src="disable.lua" type="serverside" /> </meta> also I tryed to type: <script src="disable.lua" type="server" /> Edited October 25, 2015 by Guest Link to comment
0 PaiN^ Posted May 3, 2013 Share Posted May 3, 2013 So the script is not showing in the resources grid list in the admin panel ? or it's not working ? Link to comment
0 TheBite Posted May 3, 2013 Author Share Posted May 3, 2013 So the script is not showing in the resources grid list in the admin panel ? or it's not working ? I can start it, but is not working... Link to comment
0 PaiN^ Posted May 3, 2013 Share Posted May 3, 2013 Any errors ? if not, Then i can't help, Sorry Link to comment
0 TheBite Posted May 3, 2013 Author Share Posted May 3, 2013 Yeah, when i changed the server to serverslide consle said (when restart scipt): [2013-05-03 19:12:36] Unknown script type specified in Disable. Assuming 'server' Link to comment
0 Jaysds1 Posted May 3, 2013 Share Posted May 3, 2013 try this: script.lua: addEventHandler ('onPlayerCommand', root, function ( player, cmd ) if cmd:lower() ~= 'superman' then return end if not isGuestAccount ( getPlayerAccount ( player ) ) then return end cancelEvent() end) meta.xml: > author="Nathanasiou" name="Disable" version="1.0.0" type="script" /> ="script.lua" />> Make sure that these are all in the same folder and the script is called "script.lua" and the xml/meta is called "meta.xml". If this doesn't work, please post a screenshot of your folder with these scripts and the debug error shown after command "/debugscript 3". Link to comment
0 TheBite Posted May 3, 2013 Author Share Posted May 3, 2013 (edited) try this:script.lua: addEventHandler ('onPlayerCommand', root, function ( player, cmd ) if cmd:lower() ~= 'superman' then return end if not isGuestAccount ( getPlayerAccount ( player ) ) then return end cancelEvent() end) meta.xml: > author="name" name="Disable" version="1.0.0" type="script" /> ="script.lua" />> Make sure that these are all in the same folder and the script is called "script.lua" and the xml/meta is called "meta.xml". If this doesn't work, please post a screenshot of your folder with these scripts and the debug error shown after command "/debugscript 3". Not working.. http://i.imgur.com/RMTas90.png [2013-05-03 22:58:07] debugscript: Incorrect client type for this command and when I play as guest and I type superman on the same time console says: [2013-05-03 22:56:23] ERROR: Disable\script.lua:2: attempt to index local 'cmd' (a nil value) Edited October 25, 2015 by Guest Link to comment
0 Vision Posted May 3, 2013 Share Posted May 3, 2013 Try this addEventHandler ( 'onPlayerCommand', root, function ( cmd ) if ( cmd == "superman" and isGuestAccount ( getPlayerAccount ( source ) ) ) then cancelEvent ( ) end end ) Link to comment
0 TheBite Posted May 3, 2013 Author Share Posted May 3, 2013 Try this addEventHandler ( 'onPlayerCommand', root, function ( cmd ) if ( cmd == "superman" and isGuestAccount ( getPlayerAccount ( source ) ) ) then cancelEvent ( ) end end ) Nothing :@@@@@ Link to comment
0 Baseplate Posted May 3, 2013 Share Posted May 3, 2013 addEventHandler ('onPlayerCommand', root, function ( cmd ) if (cmd == "superman") then local accName = getAccountName(getPlayerAccount(source)) if (isObjectInACLGroup("user." .. accName, aclGetGroup("Admin"))) then cancelEvent ( ) end end end ) Link to comment
0 TheBite Posted May 4, 2013 Author Share Posted May 4, 2013 DEFAK not woking :OOOOOOOOOO Link to comment
0 Baseplate Posted May 4, 2013 Share Posted May 4, 2013 addEventHandler ("onPlayerCommand", root, function (command) if (command == "superman") then local accName = getAccountName(getPlayerAccount(source)) if (isObjectInACLGroup("user." .. accName, aclGetGroup("Admin"))) then cancelEvent () end end end ) Link to comment
0 TheBite Posted May 4, 2013 Author Share Posted May 4, 2013 (edited) addEventHandler ("onPlayerCommand", root, function (command) if (command == "superman") then local accName = getAccountName(getPlayerAccount(source)) if (isObjectInACLGroup("user." .. accName, aclGetGroup("Admin"))) then cancelEvent () end end end ) Edited October 25, 2015 by Guest Link to comment
0 Jaysds1 Posted May 4, 2013 Share Posted May 4, 2013 wait, Are you restarting the resource after you updated the script and meta.xml? If not, type in "restart Disable" in the console/dark-window. Link to comment
0 TheBite Posted May 4, 2013 Author Share Posted May 4, 2013 wait, Are you restarting the resource after you updated the script and meta.xml?If not, type in "restart Disable" in the console/dark-window. I already do it, but nothing, pls, can you give me a tested resource why is very strange? I Want exclude the possibility it may be a problem in my server. Link to comment
0 Jaysds1 Posted May 4, 2013 Share Posted May 4, 2013 ok, download this resource then: https://community.multitheftauto.com/in ... ls&id=2254 Link to comment
0 TheBite Posted May 4, 2013 Author Share Posted May 4, 2013 ok, download this resource then:https://community.multitheftauto.com/in ... ls&id=2254 yeah, when i'm going out of a vehicle lights is auto-turning off / working.. PS: Good scipt Link to comment
0 Jaysds1 Posted May 4, 2013 Share Posted May 4, 2013 Thanks. Try this: addEventHandler ('onPlayerCommand', root, function (cmd) outputChatBox(cmd,source) if cmd:lower() ~= 'superman' then return end outputChatBox("superman",source) if not isGuestAccount ( getPlayerAccount ( source ) ) then return end cancelEvent() end) Link to comment
0 TheBite Posted May 4, 2013 Author Share Posted May 4, 2013 Thanks.Try this: addEventHandler ('onPlayerCommand', root, function (cmd) outputChatBox(cmd,source) if cmd:lower() ~= 'superman' then return end outputChatBox("superman",source) if not isGuestAccount ( getPlayerAccount ( source ) ) then return end cancelEvent() end) Well, it's not working but when I type /superman (as guest of course) the game chat (not console) says: 2 times per 1 /sperman says: superman and some times says (for two times): Toggle and all with grey color PS: When I type anything in chat, chat says: Say My message The "Say" with grey color Link to comment
0 Jaysds1 Posted May 4, 2013 Share Posted May 4, 2013 oh, it's because all those are bind to a command, like talking in the chat via '/say'. ok, everything works, but if you're trying to not let the player use the superman command then you would need to go to the actual script with the superman command. Link to comment
Question
TheBite
Hey to all, how to disable a command like /superman for general users?
I tryed to type in ace - everyone "" but normal users can type superman and fly, now?
Link to comment
26 answers to this question
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