-.Paradox.- Posted October 29, 2013 Posted October 29, 2013 Hello, i need help here, can't getPlayerNametagColor WARNING: Class/basic.lua:4: Bad argument @ 'getPlayerNameTagColor' addEventHandler ( "onPlayerChat", root, function ( msg, msgType ) local name = getPlayerName(source) local r,g,b = getPlayerNametagColor (source) if ( msgType == 1 ) then cancelEvent ( ) outputChatBox ( "* " ..name.. "#006400 ".. msg, root, 0, 100, 0, true ) end end ) If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
Castillo Posted October 29, 2013 Posted October 29, 2013 It should work, do you get the same error at getPlayerName? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
-.Paradox.- Posted October 29, 2013 Author Posted October 29, 2013 Yes If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
Castillo Posted October 29, 2013 Posted October 29, 2013 I don't see any reason for that, since 'source' is self defined by the event. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
-.Paradox.- Posted October 29, 2013 Author Posted October 29, 2013 So how i can fix it? If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
.:HyPeX:. Posted October 29, 2013 Posted October 29, 2013 try like this function onchat( playerSource, msg, msgType ) local name = getPlayerName(playerSource) local r,g,b = getPlayerNametagColor (playersource) if ( msgType == 1 ) then cancelEvent ( ) outputChatBox ( "* " ..name.. "#006400 ".. msg, root, 0, 100, 0, true ) end end addEventHandler ( "onPlayerChat", root, onchat) My ingame nick is ~HyPeX~ BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager
xXMADEXx Posted October 29, 2013 Posted October 29, 2013 try like this function onchat( playerSource, msg, msgType ) local name = getPlayerName(playerSource) local r,g,b = getPlayerNametagColor (playersource) if ( msgType == 1 ) then cancelEvent ( ) outputChatBox ( "* " ..name.. "#006400 ".. msg, root, 0, 100, 0, true ) end end addEventHandler ( "onPlayerChat", root, onchat) That wouldn't work because 'playerSource' would return a string. Please read the arguments first. https://wiki.multitheftauto.com/wiki/OnPlayerChat @StevyDK: Is this your entire script? If not, post the rest. The Ultimate Lua Tutorial! | MTA PHP SDK
.:HyPeX:. Posted October 29, 2013 Posted October 29, 2013 Ooops sorry didnt readed. The idea is to get out of handler-based functions and make a standaole one, it may work better. function onchat( msg, msgType ) local name = getPlayerName(source) local r,g,b = getPlayerNametagColor (source) if ( msgType == 1 ) then cancelEvent ( ) outputChatBox ( "* " ..name.. "#006400 ".. msg, root, 0, 100, 0, true ) end end addEventHandler ( "onPlayerChat", getRootElement(), onchat) My ingame nick is ~HyPeX~ BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager
-.Paradox.- Posted October 30, 2013 Author Posted October 30, 2013 Ooops sorry didnt readed.The idea is to get out of handler-based functions and make a standaole one, it may work better. function onchat( msg, msgType ) local name = getPlayerName(source) local r,g,b = getPlayerNametagColor (source) if ( msgType == 1 ) then cancelEvent ( ) outputChatBox ( "* " ..name.. "#006400 ".. msg, root, 0, 100, 0, true ) end end addEventHandler ( "onPlayerChat", getRootElement(), onchat) Don't work @xXMadeXx it's the entire script If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
Castillo Posted October 30, 2013 Posted October 30, 2013 There's no reason for it to don't work. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
.:HyPeX:. Posted October 30, 2013 Posted October 30, 2013 try the exact code from the wiki, if it doesnt works, then its something related to your meta/other stuff configs. local function playerJoin() local red, green, blue = math.random (50, 255), math.random (50, 255), math.random (50, 255) setPlayerNametagColor(source, red, green, blue) end addEventHandler ("onPlayerJoin", root, playerJoin) local function playerChat(message, messageType) if messageType == 0 then --Global (main) chat cancelEvent() local red, green, blue = getPlayerNametagColor(source) outputChatBox(getPlayerName(source)..": #FFFFFF"..message, root, red, green, blue, true ) outputServerLog("CHAT: "..getPlayerName(source)..": "..message)--NOTE: Beacuse we cancelled the onPlayerChat event, we need to log chat manually. end end addEventHandler("onPlayerChat", root, playerChat) My ingame nick is ~HyPeX~ BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager
-.Paradox.- Posted November 1, 2013 Author Posted November 1, 2013 Nothing If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
-.Paradox.- Posted November 3, 2013 Author Posted November 3, 2013 It's server side If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
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