iPrestege Posted December 26, 2012 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 .
iPrestege Posted December 26, 2012 Author Posted December 26, 2012 in chat only ? or in game ? on player chat .
MatXpl Posted December 26, 2012 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() )
iPrestege Posted December 26, 2012 Author 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
MatXpl Posted December 26, 2012 Posted December 26, 2012 lol team tag msg is not strings! outputChatBox ( "["..Team.."]"..Tag..": "..msg, getRootElement(), 255, 0, 0, true ) try this ;d
MatXpl Posted December 26, 2012 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
Castillo Posted December 26, 2012 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.
iPrestege Posted December 26, 2012 Author 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
MatXpl Posted December 26, 2012 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()
iPrestege Posted December 26, 2012 Author 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
MatXpl Posted December 26, 2012 Posted December 26, 2012 its from Solidsnake14 code if think that if ( msgType == ) then is wrong you need to use if ( msgType == 0 ) then
Castillo Posted December 26, 2012 Posted December 26, 2012 Yeah, I noticed about some typos and fixed them, copy my code again, Pres.
iPrestege Posted December 26, 2012 Author 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 ^^
Castillo Posted December 26, 2012 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 )
iPrestege Posted December 26, 2012 Author 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 !
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