Jump to content

Help me please !!! getPlayerNametagText


Estevam2d

Recommended Posts

Posted

when I use GetPlayerName Text tag my name is appearing [0].

Can anyone help me to withdraw [0] at the end of my tag? :cry:

-- 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 ) 

  • Moderators
Posted

Use getPlayerName instead. It seems one of your resources is editing the name tag text for it's own purpose.

Posted
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

Posted

This was what gave more certain but was [PM]

And I want without it. :cry::cry::cry:

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 ) 

Posted
  
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 ) 
  

Posted
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 ) 
  

Posted
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)

Posted

The number that Appear next really sumil, but the PMSC station multiplies

14ugtg4.png

I want to appear only in so PMSC tag

Is there any method to do that does not multiply the PMSC?

Posted
  
  
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 ) 
  
  

Posted
  
  
  
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' ?

Posted

Tomas was very Thank perfect, Thank you helped me a lot.

:wink::lol::D:D:D

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 ) 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...