iPrestege Posted December 26, 2012 Share Posted December 26, 2012 hi , i want to add player name tag if player in team for example if player in Grove team Player Tag Will Be Like That : [Grove] Prestege : Welcome To My World if player doen,t join into any team setplayertag none for example Prestege : welcome To My World . Link to comment
MatXpl Posted December 26, 2012 Share Posted December 26, 2012 in chat only ? or in game ? Link to comment
iPrestege Posted December 26, 2012 Author Share Posted December 26, 2012 in chat only ? or in game ? on player chat . Link to comment
MatXpl Posted December 26, 2012 Share Posted December 26, 2012 https://wiki.multitheftauto.com/wiki/OnPlayerChat https://wiki.multitheftauto.com/wiki/CancelEvent https://wiki.multitheftauto.com/wiki/GetPlayerTeam https://wiki.multitheftauto.com/wiki/Get ... ametagText and to compile this https://wiki.multitheftauto.com/wiki/OutputChatBox outputChatBox ("["..team.."]"..nick..": "..msg,getRootElement() ) Link to comment
iPrestege Posted December 26, 2012 Author Share Posted December 26, 2012 (edited) addEventHandler("onPlayerChat", root, function (msg) cancelEvent (true) local Tag = getPlayerNametagText ( thePlayer ) local Team = getPlayerTeam ( source ) if (Team) then outputChatBox ( "["..Team.."]"..Tag..": "..msg, getRootElement(), 255, 0, 0, true ) else outputChatBox ( "[Name]"..Tag..": "..msg, getRootElement(), 255, 0, 0, true ) end end end ) #Edited Edited December 26, 2012 by Guest Link to comment
MatXpl Posted December 26, 2012 Share Posted December 26, 2012 lol team tag msg is not strings! outputChatBox ( "["..Team.."]"..Tag..": "..msg, getRootElement(), 255, 0, 0, true ) try this ;d Link to comment
MatXpl Posted December 26, 2012 Share Posted December 26, 2012 but if (Team) then outputChatBox ( "["..Team.."]"..Tag..": "..msg, getRootElement(), 255, 0, 0, true ) else outputChatBox ( "[Prestege]"..Tag..": "..msg, getRootElement(), 255, 0, 0, true ) end Link to comment
Castillo Posted December 26, 2012 Share Posted December 26, 2012 addEventHandler ( "onPlayerChat", root, function ( msg, msgType ) if ( msgType == 0 ) then local Tag = getPlayerNametagText ( source ) local Team = getPlayerTeam ( source ) local teamName = ( Team and getTeamName ( Team ) or "Prestege" ) outputChatBox ( "[".. teamName .."] ".. Tag ..": ".. msg, root, 255, 0, 0, true ) cancelEvent ( true ) end end ) Errors: 1: 'thePlayer' is not defined. 2: 'getPlayerTeam' returns a team element, not it's name. 3: The string at 'outputChatBox' was wrong. Link to comment
iPrestege Posted December 26, 2012 Author Share Posted December 26, 2012 addEventHandler ( "onPlayerChat", root, function ( msg, msgType ) if ( msgType == ) then local Tag = getPlayerNametagText ( source ) local Team = getPlayerTeam ( source ) local teamName = ( Team and getTeamName ( Team ) or "Prestege" ) outputChatBox ( "[".. teamName .."] ".. tag ..": ".. msg, root, 255, 0, 0, true ) cancelEvent ( true ) end end ) Errors: 1: 'thePlayer' is not defined. 2: 'getPlayerTeam' returns a team element, not it's name. 3: The string at 'outputChatBox' was wrong. Warring: Loading script failed: Gangs/Server.lua:156: unexpected symbol near ')' Warring: Loading script failed: Gangs/Client.lua:18: Bad argument @ 'guiWindowSetSizable' [Expected gui-window at argument 1,got gui-staticimage ^ debugsctript + doesn,t work . @Server Side Link to comment
MatXpl Posted December 26, 2012 Share Posted December 26, 2012 Its bugs of other code in this resource.. find 156 line in server script in new topic and in client.lua you need to delete guiWindowSetSizable() Link to comment
iPrestege Posted December 26, 2012 Author Share Posted December 26, 2012 (edited) @ Solid Snake it works but you didn,t understand me ! i want to set player name tag not prestege i want to set player name with team name for example my name in the game prestege and i join into grove team so if i chat on the chat box my name will be like that with the name tag [Grove] Prestege : Hi SolidSnake , Grove = that what i want to but it place prestege if is player in team grove or ballas or police ..bla..bla .. i hope you understand me .. Edited December 26, 2012 by Guest Link to comment
MatXpl Posted December 26, 2012 Share Posted December 26, 2012 its from Solidsnake14 code if think that if ( msgType == ) then is wrong you need to use if ( msgType == 0 ) then Link to comment
Castillo Posted December 26, 2012 Share Posted December 26, 2012 Yeah, I noticed about some typos and fixed them, copy my code again, Pres. Link to comment
iPrestege Posted December 26, 2012 Author Share Posted December 26, 2012 Yeah, I noticed about some typos and fixed them, copy my code again, Pres. i change it see my post up up ^^ Link to comment
Castillo Posted December 26, 2012 Share Posted December 26, 2012 addEventHandler ( "onPlayerChat", root, function ( msg, msgType ) if ( msgType == 0 ) then local Tag = getPlayerNametagText ( source ) local Team = getPlayerTeam ( source ) local teamName = ( Team and getTeamName ( Team ) or "" ) outputChatBox ( "[".. teamName .."] ".. Tag ..": ".. msg, root, 255, 0, 0, true ) cancelEvent ( true ) end end ) Link to comment
iPrestege Posted December 26, 2012 Author Share Posted December 26, 2012 addEventHandler ( "onPlayerChat", root, function ( msg, msgType ) if ( msgType == 0 ) then local Tag = getPlayerNametagText ( source ) local Team = getPlayerTeam ( source ) local teamName = ( Team and getTeamName ( Team ) or "" ) outputChatBox ( "[".. teamName .."] ".. Tag ..": ".. msg, root, 255, 0, 0, true ) cancelEvent ( true ) end end ) thanks it works great ! 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