Jump to content

A simple question?


iPrestege

Recommended Posts

Posted

Can I cancel the chat on my server?

yes :D

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 :mrgreen:

Posted

Can I cancel the chat on my server?

yes :D

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 :mrgreen:

  
  
local root = getRootElement() 
  
addEventHandler("onPlayerChat", root, 
function() 
 cancelEvent()  
end) 
  
  

Posted

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

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

Posted

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! ;)

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