Jump to content

Help me please !!! getPlayerNametagText


Estevam2d

Recommended Posts

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 ) 

Link to comment
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

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 ) 

Link to comment
  
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
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
  
  
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
  
  
  
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

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 ) 

Link to comment

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