Estevam2d Posted February 8, 2015 Share Posted February 8, 2015 when I use GetPlayerName Text tag my name is appearing [0]. Can anyone help me to withdraw [0] at the end of my tag? -- server function CopKillerer() for k,v in ipairs (getPlayersInTeam (getTeamFromName("Policia Militar"))) do local PAcBagmenos = tonumber ( getElementData ( v, "Prisoes" ) ) if ( PAcBagmenos >= 0 ) and ( PAcBagmenos < 20 ) then local nameTag = getPlayerNametagText ( v ) -- here [0] setTimer(function() setPlayerNametagColor ( v, 10, 118, 240 ) local Job = setPlayerName ( v, "[PMSC]-"..nameTag ) end,2000,1) end end end setTimer ( CopKillerer, 1000, 0 ) Link to comment
Moderators IIYAMA Posted February 8, 2015 Moderators Share Posted February 8, 2015 Use getPlayerName instead. It seems one of your resources is editing the name tag text for it's own purpose. Link to comment
Estevam2d Posted February 8, 2015 Author Share Posted February 8, 2015 I used GetPlayerName but how to check this with the tag [PMSC] and stop adding [PMSC]? Link to comment
Moderators IIYAMA Posted February 8, 2015 Moderators Share Posted February 8, 2015 By adding the tag on the event: https://wiki.multitheftauto.com/wiki/On ... DataChange and add this player on to a table so it will not happen again. Link to comment
Estevam2d Posted February 8, 2015 Author Share Posted February 8, 2015 I am limited with LUA understanding. I tried with what you asked but without results. Link to comment
Moderators IIYAMA Posted February 8, 2015 Moderators Share Posted February 8, 2015 Show me what you tried. Link to comment
Estevam2d Posted February 8, 2015 Author Share Posted February 8, 2015 I already deleted, I thought I had done a lot of crap. I will try again and already send you the script Link to comment
Estevam2d Posted February 8, 2015 Author Share Posted February 8, 2015 function CopKillerer() for k,v in ipairs (getPlayersInTeam (getTeamFromName("Policia Militar"))) do local PAcBagmenos = tonumber ( getElementData ( v, "Prisoes" ) ) if ( PAcBagmenos >= 0 ) and ( PAcBagmenos < 20 ) then local nameTag = getPlayerNametagText ( v ) query = string.gsub(nameTag, "([%d-])","-here") -- here problem setTimer(function() setPlayerNametagColor ( v, 10, 118, 240 ) local Job = setPlayerName ( v, "[PMSC]-"..query.."" ) end,2000,1) end end end setTimer ( CopKillerer, 1000, 0 ) I could not take the number nor the [] also do not know me handle string.gsub Link to comment
Estevam2d Posted February 8, 2015 Author Share Posted February 8, 2015 This was what gave more certain but was [PM] And I want without it. function CopKillerer() for k,v in ipairs (getPlayersInTeam (getTeamFromName("Policia Militar"))) do local PAcBagmenos = tonumber ( getElementData ( v, "Prisoes" ) ) if ( PAcBagmenos >= 0 ) and ( PAcBagmenos < 20 ) then local nameTag = getPlayerNametagText ( v ) setTimer(function() setPlayerNametagColor ( v, 10, 118, 240 ) local Job = setPlayerName ( v, "[PMSC]-"..string.gsub(nameTag, "([%d-])","-PM").."" ) end,2000,1) end end end setTimer ( CopKillerer, 1000, 0 ) Link to comment
Tomas Posted February 8, 2015 Share Posted February 8, 2015 function CopKillerer() for k,v in ipairs (getPlayersInTeam (getTeamFromName("Policia Militar"))) do local PAcBagmenos = tonumber ( getElementData ( v, "Prisoes" ) ) if ( PAcBagmenos >= 0 ) and ( PAcBagmenos < 20 ) then local nameTag = getPlayerNametagText ( v ) setTimer(function() setPlayerNametagColor ( v, 10, 118, 240 ) local Job = setPlayerName ( v, "[PMSC]-"..string.gsub(nameTag, "([%d-])","").."" ) end,2000,1) end end end setTimer ( CopKillerer, 1000, 0 ) Link to comment
Estevam2d Posted February 8, 2015 Author Share Posted February 8, 2015 I did it, but at the end of the tag is [] I want no symbol at the end of tag Link to comment
Tomas Posted February 8, 2015 Share Posted February 8, 2015 I did it, but at the end of the tag is []I want no symbol at the end of tag function CopKillerer() for k,v in ipairs (getPlayersInTeam (getTeamFromName("Policia Militar"))) do local PAcBagmenos = tonumber ( getElementData ( v, "Prisoes" ) ) if ( PAcBagmenos >= 0 ) and ( PAcBagmenos < 20 ) then local nameTag = getPlayerNametagText ( v ) setTimer(function() setPlayerNametagColor ( v, 10, 118, 240 ) local Job = setPlayerName ( v, "[PMSC]-"..string.gsub(nameTag, "(%[)%d-]","").."" ) end,2000,1) end end end setTimer ( CopKillerer, 1000, 0 ) Link to comment
Estevam2d Posted February 8, 2015 Author Share Posted February 8, 2015 It did not work, I'd better leave quiet. Now the [PMSC] tag - is repeating Link to comment
Tomas Posted February 8, 2015 Share Posted February 8, 2015 It did not work, I'd better leave quiet.Now the [PMSC] tag - is repeating Could you post here what do you have and what do you want? (Tags) Link to comment
Estevam2d Posted February 8, 2015 Author Share Posted February 8, 2015 The number that Appear next really sumil, but the PMSC station multiplies I want to appear only in so PMSC tag Is there any method to do that does not multiply the PMSC? Link to comment
Tomas Posted February 8, 2015 Share Posted February 8, 2015 function CopKillerer() for k,v in ipairs (getPlayersInTeam (getTeamFromName("Policia Militar"))) do local PAcBagmenos = tonumber ( getElementData ( v, "Prisoes" ) ) if ( PAcBagmenos >= 0 ) and ( PAcBagmenos < 20 ) then local nameTag = getPlayerNametagText ( v ) setTimer(function() setPlayerNametagColor ( v, 10, 118, 240 ) local Job = setPlayerName ( v, string.gsub(nameTag, "(%[)%d-]","")) end,2000,1) end end end setTimer ( CopKillerer, 1000, 0 ) Link to comment
Estevam2d Posted February 8, 2015 Author Share Posted February 8, 2015 not appearing this more, I want a PMSC in the tag and not remove all Would check whether a player is already with PMSC the tag and not repeat the event? Link to comment
Tomas Posted February 8, 2015 Share Posted February 8, 2015 function CopKillerer() for k,v in ipairs (getPlayersInTeam (getTeamFromName("Policia Militar"))) do local PAcBagmenos = tonumber ( getElementData ( v, "Prisoes" ) ) if ( PAcBagmenos >= 0 ) and ( PAcBagmenos < 20 ) then local nameTag = getPlayerNametagText ( v ) setTimer(function() setPlayerNametagColor ( v, 10, 118, 240 ) if not string.find(nameTag,"[PMSC]-") == 1 then local Job = setPlayerName ( v, "[PMSC]-"..string.gsub(nameTag, "(%[)%d-]","").."" ) else local Job = setPlayerName ( v,string.gsub(nameTag, "(%[)%d-]","")) end end,2000,1) end end end setTimer ( CopKillerer, 1000, 0 ) A question, why are you using 'getPlayerNametagText' instead of 'getPlayerName' ? Link to comment
Estevam2d Posted February 8, 2015 Author Share Posted February 8, 2015 Tomas was very Thank perfect, Thank you helped me a lot. But I took the == 1, when removed worked. if not string.find(nameTag,"[PMSC]") then function CopKillerer() for k,v in ipairs (getPlayersInTeam (getTeamFromName("Policia Militar"))) do local PAcBagmenos = tonumber ( getElementData ( v, "Prisoes" ) ) if ( PAcBagmenos >= 0 ) and ( PAcBagmenos < 20 ) then local nameTag = getPlayerNametagText ( v ) setTimer(function() setPlayerNametagColor ( v, 10, 118, 240 ) if not string.find(nameTag,"[PMSC]") == 1 then local Job = setPlayerName ( v, "[PMSC]-"..string.gsub(nameTag, "(%[)%d-]","").."" ) else local Job = setPlayerName ( v,string.gsub(nameTag, "(%[)%d-]","")) end end,2000,1) end end end setTimer ( CopKillerer, 1000, 0 ) Link to comment
Tomas Posted February 8, 2015 Share Posted February 8, 2015 You're welcome, you should use 'getPlayerName' instead of 'getPlayerNametagText' Link to comment
Estevam2d Posted February 8, 2015 Author Share Posted February 8, 2015 Got it, I'll do it right now Many thanks again 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