Adde Posted September 25, 2013 Posted September 25, 2013 Hello, I have this function to set (Staff) infront of the name everytime a HeadAdmin ( atm ) write in chat. The message disappears in teamchat and shows (Staff)NameTag: message, but in mainchat the original and this chat message appears. Why doesn´t cancelEvent() work in mainchat? function staffchat(message, messageType) if messageType == 0 or messageType == 2 then if isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(source)), aclGetGroup("HeadAdmin")) then cancelEvent() local red, green, blue = getPlayerNametagColor(source) outputChatBox("(Staff)"..getPlayerName(source)..": "..message, root, red, green, blue, true ) end end end addEventHandler("onPlayerChat", getRootElement(), staffchat)
Adde Posted September 25, 2013 Author Posted September 25, 2013 (edited) Nope I changed it so (TEAM) is visible in team chat, and it is still same problem. I can´t find out what´s the problem. The script is perfect and no resource that manage chatBox anyway is running.. function staffchat(message, messageType) if messageType == 0 then if isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(source)), aclGetGroup("HeadAdmin")) then cancelEvent() local red, green, blue = getPlayerNametagColor(source) outputChatBox("*Staff*"..getPlayerName(source)..": #FFFFFF"..message, root, red, green, blue, true ) end end end addEventHandler("onPlayerChat", getRootElement(), staffchat) function staffchat2(message, messageType) if messageType == 2 then if isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(source)), aclGetGroup("HeadAdmin")) then cancelEvent() local red, green, blue = getPlayerNametagColor(source) outputChatBox("(TEAM)*Staff*"..getPlayerName(source)..": #FFFFFF"..message, root, red, green, blue, true ) end end end addEventHandler("onPlayerChat", getRootElement(), staffchat2) Edited September 25, 2013 by Guest
Adde Posted September 25, 2013 Author Posted September 25, 2013 I am using zombie resource, but I changed gametype myself to "Zombiehunt 2.3". But can´t be that. Tested stop zombie resource and write in chat, didn´t help.
Castillo Posted September 25, 2013 Posted September 25, 2013 There must be a resource which has it's own chat system.
Adde Posted September 25, 2013 Author Posted September 25, 2013 Do you think localchat have something to do with the mainchat problem? localchat resource wasn´t the problem either..
iMr.Dawix~# Posted September 26, 2013 Posted September 26, 2013 try this .. function staffchat(message, messageType) if messageType == 0 then if isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(source)), aclGetGroup("HeadAdmin")) then cancelEvent() local red, green, blue = getPlayerNametagColor(source) outputChatBox("*Staff*"..getPlayerName(source)..": "..message, root, red, green, blue, true ) end elseif messageType == 2 then if isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(source)), aclGetGroup("HeadAdmin")) then cancelEvent() local red, green, blue = getPlayerNametagColor(source) outputChatBox("(TEAM)*Staff*"..getPlayerName(source)..": "..message, root, red, green, blue, true ) end end end addEventHandler("onPlayerChat",root, staffchat)
Adde Posted October 8, 2013 Author Posted October 8, 2013 Solved the problem. There was a cancelEvent() in the mta resource "playercolors".
Moderators Citizen Posted October 8, 2013 Moderators Posted October 8, 2013 Just to let you know because no one mentioned this: You could set an high priority on your addEventHandler so that your function would be call before all others.
tosfera Posted October 8, 2013 Posted October 8, 2013 Just to let you know because no one mentioned this:You could set an high priority on your addEventHandler so that your function would be call before all others. offtopic; That's realy good to know, I think alot of people doesn't know this! Neither do I.
Adde Posted October 9, 2013 Author Posted October 9, 2013 That´s true Citizen, but didn´t know I could do that tosfera, yes and that was just a random resource I looked in.
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