Estevam2d Posted February 3, 2015 Share Posted February 3, 2015 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
ALw7sH Posted February 3, 2015 Share Posted February 3, 2015 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
Estevam2d Posted February 3, 2015 Author Share Posted February 3, 2015 Thanks, did everything right and really funcinou. Hug. Link to comment
ALw7sH Posted February 3, 2015 Share Posted February 3, 2015 i was doing it with other method change it and forget to remove this argument Link to comment
Estevam2d Posted February 3, 2015 Author Share Posted February 3, 2015 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
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