skybad Posted September 4, 2014 Posted September 4, 2014 Hello, i need to know is it's possible put the addCommandHandler function in meta.xml file to change the command in game using admin panel and then settings, because if i want to change the command i need to edit the script and then restart the script for players use the new command, and i don't want to restart the script i want change it on Admin panel, btw the script is server side script Something like this: There i can change for true or false colored names in socreboard...
lcd1232 Posted September 4, 2014 Posted September 4, 2014 https://wiki.multitheftauto.com/wiki/Settings_system
skybad Posted September 4, 2014 Author Posted September 4, 2014 Yeah i know that but how i made it for addCommandHandler? hi know i can make smething like this: Server Side colorCodesDefault = { } colorCodesDefault.colorcode1 = "#FF7300" colorCodesDefault.colorcode3 = "#FF7300" colorCodesDefault.colorcode2 = "#DBD7D7" colorCodes = { } colorCodes.colorcode1 = get ( "colorcode1" ) or colorCodesDefault.colorcode1 colorCodes.colorcode2 = get ( "colorcode2" ) or colorCodesDefault.colorcode2 colorCodes.colorcode3 = get ( "colorcode3" ) or colorCodesDefault.colorcode3 Meta.xml <setting name="*colorcode1" value="#AD505C" friendlyname="Prefix color" group="Colors" examples="#AD505C" desc="Color of the prefix" /> <setting name="*colorcode2" value="#AD505C" friendlyname="Nick color" group="Colors" examples="#AD505C" desc="Color of the nickname" /> <setting name="*colorcode3" value="#DBD7D7" friendlyname="Message color" group="Colors" examples="#DBD7D7" desc="Color of the message" /> Can someone make an example like the this one colorCodesDefault = { } colorCodesDefault.colorcode1 = "#FF7300" colorCodes = { } colorCodes.colorcode1 = get ( "colorcode1" ) or colorCodesDefault.colorcode1 but for commandHandler
lcd1232 Posted September 4, 2014 Posted September 4, 2014 I think like this commands = {} commands.engine = 'setengine' commands.lock = 'lock' newcommands = {} newcommands.engine = get ( "engine" ) or commands.engine newcommands.lock = get( "lock" ) or commands.lock addCommandHandler(newcommands.engine, testFunction) addCommandHandler(newcommands.lock, test1Function)
skybad Posted September 4, 2014 Author Posted September 4, 2014 okay i will try somwthing simillar to that and i will port here if works or if give errors
skybad Posted September 4, 2014 Author Posted September 4, 2014 Is giving this error: script/sv.lua:7: Bad argument @ 'addCommandHandler' [Expected function at argument 2, got nil] I will post the code: commands = {} commands.engine = "setengine" newcommands = {} newcommands.engine = get ( "engine" ) or commands.engine addCommandHandler(newcommands.engine, pack) function pack(thePlayer) local account = getPlayerAccount(thePlayer) if (not account or isGuestAccount(account)) then return end local accountName = getAccountName(account) if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Everyone" ) ) ) then --Player Data setElementData(thePlayer,"blood",12000) end end And the meta.xml file <meta> <script src="sv.lua" type="server" /> <settings> <setting name="*engine" value="setengine" friendlyname="test1" group="test" examples="setengine" desc="TestT" /> </settings> </meta>
Anubhav Posted September 4, 2014 Posted September 4, 2014 commands = {} commands.engine = "setengine" newcommands = {} newcommands.engine = get ( "engine" ) or commands.engine function pack(thePlayer) local account = getPlayerAccount(thePlayer) if (not account or isGuestAccount(account)) then return end local accountName = getAccountName(account) if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Everyone" ) ) ) then --Player Data setElementData(thePlayer,"blood",12000) end end addCommandHandler(newcommands.engine, pack) See my some resources: Skin shop: https://community.multitheftauto.com/in ... ls&id=8008 Note script: https://community.multitheftauto.com/in ... ls&id=8009 Rules Panel: https://community.multitheftauto.com/in ... ls&id=8246 Random Money: https://community.multitheftauto.com/in ... ls&id=8718
'LinKin Posted September 5, 2014 Posted September 5, 2014 You must use onSettingChange event so that you don't have to restart the script each time you change a setting (in this case a string representing a command) Need a clanwar script? Click here! Do you want some free scripts for your DD server? Visit my website.
skybad Posted September 8, 2014 Author Posted September 8, 2014 Bahh i can't but thanks for the help guys
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