Jump to content

Tag special name


Estevam2d

Recommended Posts

I want a tag in the player who has more kill, but especially for him.

someone help me?

I'm using getElementData (attacker, "kills") in order to find the player that killed more players.

  
function CopKiller (attacker) 
if attacker and getElementType(attacker) == "player" then 
theTeam = getPlayerTeam ( attacker ) 
if  getTeamName( theTeam ) == "Criminoso" then 
if ( attacker ) and ( attacker ~= source ) then 
aScore = getElementData(attacker, "kills") 
if getElementData ( attacker, "kills" ) > aScore  then  -- I do not know if this correct 
local namee = getPlayerName ( attacker ) 
  setElementData(attacker,"Namecarreg",namee) 
  setPlayerNametagColor ( attacker, 221, 211, 45 ) 
  setTimer(function() 
  local name = setPlayerName ( attacker, ""..namee.."-CopKiller" ) 
  end,2000,1) 
  
  end 
          end 
       end 
   end 
end 
addEventHandler ("onPlayerDamage", getRootElement(), CopKiller) 

Link to comment

ididn't understand ur problem with getting the highest player or what

but if its with getting the highest player

this is simple function could help you

function getHighestKills(player) 
local var = 0 
local HighPlayer = false 
    for k,v in ipairs(getElementsByType('player')) do 
    local kills = getElementData(v,'kills') 
        if kills then 
            if kills > var then 
            var = kills 
            HighPlayer = v 
            end 
        end 
    end 
return HighPlayer 
end 

Link to comment

The title and the color change of the first list of player, but as others vain up the kill they also change color.

I wish only the first player had the color changed, and when the kill it is low simply color it back to be red.

--nomeacao de titulo rob 
function CopKillerer() 
local var = 0 
local HighPlayer = false 
    for k,v in ipairs (getPlayersInTeam (getTeamFromName("Criminoso"))) do 
    setPlayerNametagColor ( source, 150, 25, 25 ) 
    local kills = getElementData(v,'kills') 
    if kills then 
    if kills > var then      
     
     
     
           setPlayerNametagColor ( v, 221, 211, 45 ) 
           var = kills 
             
         
NameJobee = getPlayerName(v,"NameDeJoin1")       
  
  setTimer(function() 
  local Job = setPlayerName ( v, ""..NameJobee.."-[TopKiller]" ) 
  end,2000,1) 
   
  
   
           end 
        end    
    end 
    return HighPlayer 
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...