Ricardofire Posted March 29, 2019 Share Posted March 29, 2019 alguem tem um rank de kills ,q salva os player q desloga Link to comment
Jonas^ Posted March 30, 2019 Share Posted March 30, 2019 Você postou no local errado. Local correto: Programação em Lua Você pode usar esta base aqui para fazer o seu, inclusive a base do meu sistema de rank é desse sistema também que foi feito pelo @LordHenry 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) Server-side function recebeKills () local data = getAccounts () local accTable = {} local killsTable = {} local deathsTable = {} 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") else table.insert (killsTable, tostring (getAccountData (data[i], "kills"))) end if not getAccountData (data[i], "deaths") then table.insert (deathsTable, "0") else table.insert (deathsTable, tostring (getAccountData (data[i], "deaths"))) end end triggerClientEvent (client, "showRank", client, accTable, killsTable, deathsTable) 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) 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