//_Dragon Posted December 16, 2015 Share Posted December 16, 2015 When i do some command's chatbox like :/disconnect /quit /nick ... this pic http://imgur.com/uPtiTqN will show yous the problem check it first Idk what is the problem function localMessage(thePlayer, cmd, ...) local message = table.concat({ ... }, " ") local name = getPlayerName(thePlayer) local r, g, b = getPlayerNametagColor(thePlayer) local hex = string.format("#%.2X%.2X%.2X", r, g, b) -- converts R, G, B to HEX value outputChatBox("(Local) "..hex..name..": #ffffff"..message, getRootElement(), 255, 255, 0, true) end addCommandHandler("Local", localMessage) Link to comment
1LoL1 Posted December 16, 2015 Share Posted December 16, 2015 When i do some command's chatbox like :/disconnect /quit /nick ...this pic http://imgur.com/uPtiTqN will show yous the problem check it first Idk what is the problem function localMessage(thePlayer, cmd, ...) local message = table.concat({ ... }, " ") local name = getPlayerName(thePlayer) local r, g, b = getPlayerNametagColor(thePlayer) local hex = string.format("#%.2X%.2X%.2X", r, g, b) -- converts R, G, B to HEX value outputChatBox("(Local) "..hex..name..": #ffffff"..message, getRootElement(), 255, 255, 0, true) end addCommandHandler("Local", localMessage) Why you create new topic? This is in your old topic.. Link to comment
//_Dragon Posted December 16, 2015 Author Share Posted December 16, 2015 Why you create new topic? This is in your old topic.. Because no one can see it so i decide to creat new topic Any one can fixe it ? Link to comment
1LoL1 Posted December 16, 2015 Share Posted December 16, 2015 Why you create new topic? This is in your old topic.. Because no one can see it so i decide to creat new topic Any one can fixe it ? However, this topic see everyone so you do not write s.h.i.t anyone help? Whereas it is right first. Link to comment
//_Dragon Posted December 16, 2015 Author Share Posted December 16, 2015 Dude i made this topic for fixe my mod not for insulting or ditrubing Link to comment
killeryoyo Posted December 16, 2015 Share Posted December 16, 2015 You cant do commands in local. You can only do it from the main chat. That's mta rules. Link to comment
//_Dragon Posted December 16, 2015 Author Share Posted December 16, 2015 Nah dude i can i need only to add something i think i must change localmessage to chatbox Help ? Link to comment
1LoL1 Posted December 16, 2015 Share Posted December 16, 2015 Nah dude i can i need only to add something i think i must change localmessage to chatboxHelp ? I think this is not possible. Possible is disable old chat "T" and create new but with [Local]. Link to comment
Addlibs Posted December 16, 2015 Share Posted December 16, 2015 There's one possible solution but it won't work exactly like normal 'T' chat - executeCommandHandler. However, this does not work for hardcoded commands like /quit, /reconnect etc. Link to comment
//_Dragon Posted December 16, 2015 Author Share Posted December 16, 2015 I dont think so How to getplayernametagcolor i mean local hex local root = getRootElement() function localMessage(thePlayer, cmd, ...) local message = table.concat({ ... }, " ") local account = getAccountName(getPlayerAccount(source)) local name = getPlayerName(thePlayer) local r, g, b = getPlayerNametagColor(thePlayer) local hex = string.format("#%.2X%.2X%.2X", r, g, b) cancelEvent() if isObjectInACLGroup("user." .. account, aclGetGroup("Everyone")) then outputChatBox("(Local) "..hex..name..": #ffffff" .. text, root, 255, 255, 255, true) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Admin")) then outputChatBox("(Local) "..hex..name..": #ffffff" .. text, root, 255, 255, 255, true) end function s3d() outputChatBox ( "", source, 0, 0, 0, true ) end addEventHandler("onPlayerJoin", getRootElement(), s3d) end addEventHandler("onPlayerChat", root, chatbox) outputChatBox ( "", 255, 255, 255, true ) outputChatBox ( "", 255, 255, 255, true ) Link to comment
Addlibs Posted December 16, 2015 Share Posted December 16, 2015 Line 8 gets hex. What else do you want to do? Link to comment
//_Dragon Posted December 16, 2015 Author Share Posted December 16, 2015 check the first script u'll see this local hex = string.format("#%.2X%.2X%.2X", r, g, b) -- converts R, G, B to HEX value outputChatBox("(Local) "..hex..name..": i want made it here local root = getRootElement() function localMessage(thePlayer, cmd, ...) local message = table.concat({ ... }, " ") local account = getAccountName(getPlayerAccount(source)) local name = getPlayerName(thePlayer) local r, g, b = getPlayerNametagColor(thePlayer) local hex = string.format("#%.2X%.2X%.2X", r, g, b) cancelEvent() if isObjectInACLGroup("user." .. account, aclGetGroup("Everyone")) then outputChatBox("(Local) "..hex..name..": #ffffff" .. text, root, 255, 255, 255, true) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Admin")) then outputChatBox("(Local) "..hex..name..": #ffffff" .. text, root, 255, 255, 255, true) end function s3d() outputChatBox ( "", source, 0, 0, 0, true ) end addEventHandler("onPlayerJoin", getRootElement(), s3d) end addEventHandler("onPlayerChat", root, chatbox) outputChatBox ( "", 255, 255, 255, true ) outputChatBox ( "", 255, 255, 255, true ) Link to comment
Addlibs Posted December 17, 2015 Share Posted December 17, 2015 Both local hex = string.format("#%.2X%.2X%.2X", r, g, b) -- converts R, G, B to HEX value and "(Local) "..hex..name..": #ffffff"..message are already in your script. Link to comment
//_Dragon Posted December 17, 2015 Author Share Posted December 17, 2015 Script wont work when i add hex i need to fixe it Link to comment
Addlibs Posted December 17, 2015 Share Posted December 17, 2015 What is the exact problem? How doesn't it work? Any debugscript errors? Link to comment
//_Dragon Posted December 18, 2015 Author Share Posted December 18, 2015 What is the exact problem? How doesn't it work? Any debugscript errors? Check the pic for see debugscript errors http://imgur.com/gHkVkT3 Link to comment
1LoL1 Posted December 18, 2015 Share Posted December 18, 2015 What is the exact problem? How doesn't it work? Any debugscript errors? Check the pic for see debugscript errors http://imgur.com/gHkVkT3 local root = getRootElement() function localMessage (thePlayer, cmd, ...) local message = table.concat({ ... }, " ") local account = getAccountName(getPlayerAccount(source)) local name = getPlayerName(thePlayer) local r, g, b = getPlayerNametagColor(thePlayer) local hex = string.format("#%.2X%.2X%.2X", r, g, b) cancelEvent() if isObjectInACLGroup("user." .. account, aclGetGroup("Everyone")) then outputChatBox("(Local) "..hex..name..": #ffffff" .. text, root, 255, 255, 255, true) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Admin")) then outputChatBox("(Local) "..hex..name..": #ffffff" .. text, root, 255, 255, 255, true) end end addEventHandler("onPlayerChat", root, localMessage) Link to comment
//_Dragon Posted December 19, 2015 Author Share Posted December 19, 2015 #1lol1 Debugscript :3 http://imgur.com/0Ai9OrJ Link to comment
Addlibs Posted December 19, 2015 Share Posted December 19, 2015 It it's 'onPlayerChat' now, you need to edit the function intake arguments - there's no thePlayer (it's the source in this case) Delete local message = table.concat({ ... }, " ") -- line 4 Change local name = getPlayerName(thePlayer) -- line 6 local r, g, b = getPlayerNametagColor(thePlayer) --line 7 to local name = getPlayerName(source) local r, g, b = getPlayerNametagColor(source) And change function localMessage (thePlayer, cmd, ...) -- line 3 to function localMessage(message, chatType) Link to comment
//_Dragon Posted December 19, 2015 Author Share Posted December 19, 2015 debguscript : attempt to concatenate global 'text' (a nil value) Link to comment
Addlibs Posted December 20, 2015 Share Posted December 20, 2015 Change 'text' to 'message' in both outputChatBox (line 11 and 14) 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