iPrestege Posted January 16, 2013 Share Posted January 16, 2013 Can I cancel the chat on my server? Link to comment
MR.S3D Posted January 16, 2013 Share Posted January 16, 2013 Can I cancel the chat on my server? yes you need Cancle event onPlayerChat Link to comment
csiguusz Posted January 16, 2013 Share Posted January 16, 2013 Or just do showChat(false) Link to comment
iPrestege Posted January 16, 2013 Author Share Posted January 16, 2013 Can I cancel the chat on my server? yes you need Cancle event onPlayerChat Like That? local root = getRootElement() function chatbox(text, type) cancelEvent() if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Big.Admin")) then cancelEvent() elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("msol-admin")) then cancelEvent() end end addEventHandler("onPlayerChat", root, chatbox) Also i want to hide the chat : function Hide() showChat (false) end addEventHandler ( "onResourceStart", getRootElement(), Hide ) Or just do showChat(false) i want to cancel the chat for ever =D Link to comment
MR.S3D Posted January 16, 2013 Share Posted January 16, 2013 Can I cancel the chat on my server? yes you need Cancle event onPlayerChat Like That? local root = getRootElement() function chatbox(text, type) cancelEvent() if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Big.Admin")) then cancelEvent() elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("msol-admin")) then cancelEvent() end end addEventHandler("onPlayerChat", root, chatbox) Also i want to hide the chat : function Hide() showChat (false) end addEventHandler ( "onResourceStart", getRootElement(), Hide ) Or just do showChat(false) i want to cancel the chat for ever =D local root = getRootElement() addEventHandler("onPlayerChat", root, function() cancelEvent() end) Link to comment
iPrestege Posted January 16, 2013 Author Share Posted January 16, 2013 Thank You MR.S3D ..! Link to comment
Sora Posted January 16, 2013 Share Posted January 16, 2013 local root = getRootElement() addEventHandler("onPlayerChat", root, function() cancelEvent() end) you don't need to define root , because it's predefined .. https://wiki.multitheftauto.com/wiki/Pre ... ables_list Link to comment
csiguusz Posted January 16, 2013 Share Posted January 16, 2013 you don't need to define root , because it's predefined .. https://wiki.multitheftauto.com/wiki/Pre ... ables_list But you can define it for better performance Link to comment
myonlake Posted January 16, 2013 Share Posted January 16, 2013 you don't need to define root , because it's predefined .. https://wiki.multitheftauto.com/wiki/Pre ... ables_list But you can define it for better performance Your argument is invalid. It does not improve the performance of anything, whether you used "root" instead of "getRootElement" or the other way around. "getRootElement" is already pre-defined as "root" by the Multi Theft Auto code, so you do not need to define it again, because it's no use. The only thing it does, it makes it faster to type, since "root" only takes four letters and "getRootElement" takes fourteen letters (sixteen with the last two brackets). Link to comment
csiguusz Posted January 16, 2013 Share Posted January 16, 2013 Using a local variable instead of a global one can be a bit faster ( http://lua-users.org/wiki/OptimisingUsingLocalVariables ) But i know, it is not necessary and doesn't counts much in this case. Link to comment
myonlake Posted January 16, 2013 Share Posted January 16, 2013 Using a local variable instead of a global one can be a bit faster ( http://lua-users.org/wiki/OptimisingUsingLocalVariables )But i know, it is not necessary and doesn't counts much in this case. Injecting pre-definitions into the C++ code of MTA and then comparing the speed to Lua local variables, I don't see much of a difference. Honestly speaking, if you have a problem with 1µs speed difference, then I don't get it. Link to comment
csiguusz Posted January 16, 2013 Share Posted January 16, 2013 Ahh... aren't you in a good mood today? As I said I know it's not much, I just told sora that it's not so bad to re-define a pre-defined variable. And of course: every µs is important! 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