Overkillz Posted April 27, 2016 Author Share Posted April 27, 2016 I think its me, Im not getting you, I will explain my situation slowly. Im getting that error when the player is dead -- Server Side killerTable = {} function updateKiller() local killer = getElementData(source,"lastHit") local Hits = getElementData(source,"hitsNumber") or 0 if killer then if ( not killerTable[killer] ) then killerTable[killer] = {playerName = getPlayerNametagText(killer), playerKills = 0, playerHits = 0} end killerTable[killer].playerKills = killerTable[killer].playerKills + 1 killerTable[killer].playerHits = Hits table.sort (killerTable, function (a, b) return a.playerKills > b.playerKills end) triggerClientEvent(getRootElement(), "sendClientToTable", resourceRoot, killerTable) end end addEventHandler( "onPlayerWasted", getRootElement(),updateKiller) --Client Receive Trigger function blabla(tableFromServerside) killerTable = tableFromServerside if killerTable then table.sort (killerTable, function (a, b) return a.playerKills < b.playerKills end) end outputChatBox("Table Triggered Correctly") end addEvent("sendClientToTable", true) addEventHandler("sendClientToTable", root, blabla) -- Draw Part for id, value in pairs(killerTable) do if tonumber(id) == tonumber(1) then dxLibTopwinners(ddKill.posT,(sY*0.038+34*scale),sizeXT,sizeYT,killerTable[id].playerName,1*font_size,fontTopKillers,255,255,255,ddKill.alphaT[1],0,0,0,ddKill.alphaT[2],sizeYT*0.8,sizeYT*0.8,255,136,0,ddKill.alphaT[1],"Kills: "..killerTable[id].playerKills or "?","Hits: ".."",false,false) end if tonumber(id) == tonumber(2) then dxLibTopwinners(ddKill.posT,(sY*0.038+34*scale)+sizeYT*1.05,sizeXT,sizeYT,killerTable[id].playerName,1*font_size,fontTopKillers,255,255,255,ddKill.alphaT[1],0,0,0,ddKill.alphaT[2],sizeYT*0.8,sizeYT*0.8,105,105,105,ddKill.alphaT[1],"Kills: "..killerTable[id].playerKills or "?","Hits: ".."",false,false) end if tonumber(id) == tonumber(3) then dxLibTopwinners(ddKill.posT,(sY*0.038+34*scale)+sizeYT*1.05*2,sizeXT,sizeYT,killerTable[id].playerName,1*font_size,fontTopKillers,255,255,255,ddKill.alphaT[1],0,0,0,ddKill.alphaT[2],sizeYT*0.8,sizeYT*0.8,139,54,38,ddKill.alphaT[1],"Kills: "..killerTable[id].playerKills or "?","Hits: ".."",false,false) end if tonumber(id) >= tonumber(4) and tonumber(id) <= tonumber(8) then dxLibToptime(ddKill.posT,(sY*0.038+34*scale)+sizeYT*1.05*(id-1),sizeXT,sizeYT,killerTable[id].playerName,1*font_size,fontTopKillers,255,255,255,ddKill.alphaT[1],0,0,0,ddKill.alphaT[2],sizeYT*0.8,sizeYT*0.8,45,60,81,ddKill.alphaT[1],id,"Kills: "..killerTable[id].playerKills or "?","Hits: ".."",1.2*font_size,false,false) end end I want to draw the Top Killers following the order of kills. Well, when I triggeer a manual table, it drops normally, but when the real player die, it doesnt to anything, it just drop me some errors having as errors id is nil ...etc Also, I tried to use ur both methods and it doesnt work. Thanks for Helping and regards.. Link to comment
Overkillz Posted April 28, 2016 Author Share Posted April 28, 2016 If i use the code that u exactly u gave me, I cant organize them setting for the first, 2nd and 3rd place a different dxLib and from 4 to 8 a different Lib. This is burning my mind, I still trying to fix this simple problem 3 days ago and I still with the same problem. Link to comment
Anubhav Posted April 28, 2016 Share Posted April 28, 2016 --Client Draw with my Lib for id, value in pairs(killerTable) do local number = id:gsub( "Name", "" ) if tonumber(number) == tonumber(1) then dxLibTopwinners(ddKill.posT,(sY*0.038+34*scale),sizeXT,sizeYT,killerTable[id].playerName,1*font_size,fontTopKillers,255,255,255,ddKill.alphaT[1],0,0,0,ddKill.alphaT[2],sizeYT*0.8,sizeYT*0.8,255,136,0,ddKill.alphaT[1],"Kills: "..killerTable[id].playerKills or "?","Hits: ".."",false,false) return end if tonumber(number) == tonumber(2) then dxLibTopwinners(ddKill.posT,(sY*0.038+34*scale)+sizeYT*1.05,sizeXT,sizeYT,killerTable[id].playerName,1*font_size,fontTopKillers,255,255,255,ddKill.alphaT[1],0,0,0,ddKill.alphaT[2],sizeYT*0.8,sizeYT*0.8,105,105,105,ddKill.alphaT[1],"Kills: "..killerTable[id].playerKills or "?","Hits: ".."",false,false) return end if tonumber(number) == tonumber(3) then dxLibTopwinners(ddKill.posT,(sY*0.038+34*scale)+sizeYT*1.05*2,sizeXT,sizeYT,killerTable[id].playerName,1*font_size,fontTopKillers,255,255,255,ddKill.alphaT[1],0,0,0,ddKill.alphaT[2],sizeYT*0.8,sizeYT*0.8,139,54,38,ddKill.alphaT[1],"Kills: "..killerTable[id].playerKills or "?","Hits: ".."",false,false) return end --The next line is the 146 if tonumber(number) >= tonumber(4) and tonumber(number) <= tonumber(8) then dxLibToptime(ddKill.posT,(sY*0.038+34*scale)+sizeYT*1.05*(id-1),sizeXT,sizeYT,killerTable[id].playerName,1*font_size,fontTopKillers,255,255,255,ddKill.alphaT[1],0,0,0,ddKill.alphaT[2],sizeYT*0.8,sizeYT*0.8,45,60,81,ddKill.alphaT[1],id,"Kills: "..killerTable[id].playerKills or "?","Hits: ".."",1.2*font_size,false,false) return end end You did not use "return", now give it a try. 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