eqFoxim Posted September 5, 2020 Share Posted September 5, 2020 Ola pessoal, estou procurando um script de que qundo eu der /stats tanto faz o cmd ele mostrar quantas pessoas matei e quantas morri e o "kd" que eu estou, pfv se alguem me ajudar Link to comment
Jonas^ Posted September 6, 2020 Share Posted September 6, 2020 (edited) Achei um código do @Lord Henry perdido pelo fórum, acho que seja útil pra você é tudo que você precisa 100% pronto basta só adaptar do jeito que você gostaria. server-side function recebeKills () local data = getAccounts () local accTable = {} local killsTable = {} local deathsTable = {} local killDeath = {} local kill = 0 local death = 0 if not data[1] then triggerClientEvent (client, "showRank", client) return end for i, acc in ipairs (data) do table.insert (accTable, getAccountName (data[i])) if not getAccountData (data[i], "kills") then table.insert (killsTable, "0") kill = 0 else table.insert (killsTable, tostring (getAccountData (data[i], "kills"))) kill = tonumber (getAccountData (data[i], "kills")) end if not getAccountData (data[i], "deaths") then table.insert (deathsTable, "0") death = 0 else table.insert (deathsTable, tostring (getAccountData (data[i], "deaths"))) death = tonumber (getAccountData (data[i], "deaths")) end if death == 0 and kill == 0 then table.insert (killDeath, 0) else table.insert (killDeath, kill / death) end end triggerClientEvent (client, "showRank", client, accTable, killsTable, deathsTable, killDeath) end addEvent ("getRank", true) addEventHandler ("getRank", getRootElement(), recebeKills) function salvaKills (ammo, killer, weapon, bodypart, stealth) if not isGuestAccount (getPlayerAccount(source)) then local deaths = getAccountData (getPlayerAccount(source), "deaths") if deaths then setAccountData (getPlayerAccount(source), "deaths", deaths + 1) else setAccountData (getPlayerAccount(source), "deaths", 1) end end if killer and killer ~= source then if getElementType (killer) == "player" then if not isGuestAccount (getPlayerAccount(killer)) then local kills = getAccountData (getPlayerAccount(killer), "kills") if kills then setAccountData (getPlayerAccount(killer), "kills", kills + 1) else setAccountData (getPlayerAccount(killer), "kills", 1) end end elseif getElementType (killer) == "vehicle" then killer = getVehicleController (killer) if killer then if not isGuestAccount (getPlayerAccount(killer)) then local kills = getAccountData (getPlayerAccount(killer), "kills") if kills then setAccountData (getPlayerAccount(killer), "kills", kills + 1) else setAccountData (getPlayerAccount(killer), "kills", 1) end end end end end end addEventHandler ("onPlayerWasted", getRootElement(), salvaKills) client-side scoreWindow = guiCreateWindow (0.3, 0.2, 0.4, 0.6, "Ranking Kills/Death (by: LordHenry)", true) scoreGrid = guiCreateGridList (0, 0.05, 1, 0.85, true, scoreWindow) guiWindowSetSizable (scoreWindow, false) guiGridListAddColumn (scoreGrid, "Account", 0.45) guiGridListAddColumn (scoreGrid, "Kills", 0.13) guiGridListAddColumn (scoreGrid, "Deaths", 0.13) guiGridListAddColumn (scoreGrid, "Ratio", 0.18) closeGrid = guiCreateButton (0.2, 0.91, 0.6, 0.09, "Fechar Painel", true, scoreWindow) guiSetVisible (scoreWindow, false) function scoreInfo (accounts, kills, deaths, ratio) guiSetVisible (scoreWindow, true) guiSetVisible (closeGrid, true) showCursor (true) if accounts then for i, v in ipairs (accounts) do guiGridListAddRow (scoreGrid, accounts[i], kills[i], deaths[i], ratio[i]) end end end addEvent ("showRank", true) addEventHandler ("showRank", getRootElement(), scoreInfo) function clickOptions (button, state, absoluteX, absoluteY) if button == "left" then if source == closeGrid then guiSetVisible (scoreWindow, false) showCursor (false) guiGridListClear (scoreGrid) end end end addEventHandler ("onClientGUIClick", getRootElement(), clickOptions) function sendScores () if not guiGetVisible (scoreWindow) then triggerServerEvent ("getRank", localPlayer) end end addCommandHandler ("rank", sendScores) Comando: /rank Edited July 19, 2022 by Lord Henry 2 1 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