hemen Posted November 4, 2010 Posted November 4, 2010 Function cancelevent doesn't works in onplayerchat. this functions sends two messages in chat. what should i do? function vipMessage( message, messageType ) if PlayerVIP[source] == 1 then if messageType == 0 then local r,g,b = getPlayerNametagColor ( source ) outputChatBox ( getPlayerName ( source ) .. ": (VIP) #FFFFFF" .. message, source, r,g,b,true ) cancelEvent() outputServerLog( "CHAT: " .. getPlayerName ( source ).. ": " .. message ) return end end end addEventHandler( "onPlayerChat", getRootElement(), vipMessage )
Static-X Posted November 4, 2010 Posted November 4, 2010 You are canceling the event after the outputChatBox function, it won't cancel anything, so use cancelEvent before. So it will look like function vipMessage( message, messageType ) if PlayerVIP[source] == 1 then if messageType == 0 then cancelEvent() local r,g,b = getPlayerNametagColor ( source ) outputChatBox ( getPlayerName ( source ) .. ": (VIP) #FFFFFF" .. message, source,r,g,b,true ) outputServerLog( "CHAT: " .. getPlayerName ( source ).. ": " .. message ) return end end end addEventHandler( "onPlayerChat", getRootElement(), vipMessage )
dzek (varez) Posted November 4, 2010 Posted November 4, 2010 freeroam resource is coloring the chat (canceling original one and creating outputChatBox) - disable freeroam or remove these parts about chat coloring. some other resource can do it too - check them all if you are not using freeroam.
Static-X Posted November 4, 2010 Posted November 4, 2010 Oh, yes that can be a reason too, if you are using freeroam, then have a look in fr_server.lua file.
hemen Posted November 4, 2010 Author Posted November 4, 2010 <resource src="admin" startup="1" protected="0"/> <resource src="joinquit" startup="1" protected="0"/> <resource src="defaultstats" startup="1" protected="0"/> <resource src="parachute" startup="1" protected="0"/> <resource src="scoreboard" startup="1" protected="0"/> <resource src="interiors" startup="1" protected="0"/> <resource src="playerblips" startup="1" protected="0"/> <resource src="playercolors" startup="1" protected="0"/> <resource src="gang" startup="1" protected="0"/> <!-- play is the default freeroam gamemode. Remove the following line to prevent it from starting. --> <resource src="hemengm" startup="1" protected="0"/> As you look, there is not freeroam in my server. What about resource "gang" - it's my resource and he doesn't have function onPlayerChat.
hemen Posted November 4, 2010 Author Posted November 4, 2010 You are canceling the event after the outputChatBox function, it won't cancel anything, so use cancelEvent before. i tryed to put function in other places, but it doesn't change the situation.
dzek (varez) Posted November 4, 2010 Posted November 4, 2010 hemen, moving function through resource won't help you. stop all resources, then start them one by one, searching for this one that is causing troubles. easy.
hemen Posted November 4, 2010 Author Posted November 4, 2010 hemen, moving function through resource won't help you. stop all resources, then start them one by one, searching for this one that is causing troubles. easy. thank you for help. it was in the resource "playercolors"
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