Lua
function Keybinder ()
bindKey("tab","down",build_scoreboard)
end
addEventHandler( "onClientResourceStart", getRootElement( ),Keybinder)
function build_scoreboard ()
showCursor(true,true)
guiSetInputEnabled(true)
local screenWidth, screenHeight = guiGetScreenSize()
local windowWidth, windowHeight = 650, 500
local left = screenWidth/2 - windowWidth/2
local top = screenHeight/2 - windowHeight/2
scoreboard = guiCreateWindow(left, top, windowWidth, windowHeight, "Spieler-Liste", false)
guiWindowSetSizable(scoreboard, false)
local button = guiCreateButton(5,425,650,75,"Close",false,scoreboard)
addEventHandler("onClientGUIClick", button, delete_scoreboard, false)
playerList = guiCreateGridList ( 5, 25, 650, 400,false,scoreboard)
columnname = guiGridListAddColumn( playerList, "Spieler", 0.3 )
columnfrak = guiGridListAddColumn( playerList, "Fraktion", 0.3 )
columnstat = guiGridListAddColumn( playerList, "Sozialer Status", 0.3 )
if ( columnname and columnfrak and columnstat) then
for id, playeritem in ipairs(getElementsByType("player")) do
local fraktion = getElementData(playeritem,"playerdata.fraktion") -->Bei login/reg in´das element speichern
local sozstat = getElementData(playeritem,"playerdata.sozstat") -->Bei login/reg in das element speichern
row = guiGridListAddRow ( playerList )
guiGridListSetItemText ( playerList, row, columnfrak, fraktion, false, false )
guiGridListSetItemText ( playerList, row, columnstat, sozstat, false, false )
guiGridListSetItemText ( playerList, row, columnname, getPlayerName ( playeritem ), false, false )
end
end
end
function delete_scoreboard(button,state)
guiSetVisible(scoreboard, false)
showCursor(false,false)
guiSetInputEnabled(false)
end
Alles anzeigen
Wenn ihr mir irgendwelche Tipps geben könnt um das noch zu verbessern, bitte gebt sie mir