Jump to content

maffius

Members
  • Posts

    23
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

maffius's Achievements

Civilian

Civilian (7/54)

0

Reputation

  1. Nevermind i fixed it by myself Topic can be closed
  2. Works good, but it sorts wrong because when someone has nick "test" and few other players have nicks with first upper case then "test" will be last in the list
  3. How can I use table.sort to sort table "lista" in my script? I want to sort players in gridlist by their name. function aktualizujKontakty() lista={} for i,v in ipairs(getElementsByType("player")) do if v~=localPlayer then lista[getPlayerName(v)]={v,getElementData(localPlayer,"PW:"..getPlayerName(v)) or ""} end end end function wyswietlKontakty() guiGridListClear(gridlist[1]) for i,v in pairs(lista) do r=guiGridListAddRow(gridlist[1]) guiGridListSetItemText(gridlist[1],r,1,skipColorCode(i),false,false) guiGridListSetItemData(gridlist[1],r,1,i) if nieodczytane[i] then guiGridListSetItemColor(gridlist[1],r,1,0,255,0) end if zablokowany[i] then guiGridListSetItemColor(gridlist[1],r,1,255,0,0) end end end
  4. But I see reason. Its not efficient when I try to trigger 11k times because there are 11k accounts on my server.
  5. Is it able to load server xml file to client? Is there any possibility to get all accounts from server and their data and then send it to client? I want to save all accounts and datas once in xml file and then i want to read data on client from this xml file. Is it possible? If it is, how can I do it?
  6. Works good, thanks. I dont need any explanation, Im not that nooby as you think
  7. addCommandHandler("myAccounts", function (player, cmd) local serial = getPlayerSerial(player) local accounts = getAccountsBySerial(serial) outputChatBox("You have " .. #accounts .. " accounts with these logins: ".. table.concat(accounts, ", "), player) end) And it gives error: invalid value (userdata) at index 1 in table for 'concat' How can I make this table to string?
  8. How can I sort this scoreboard by Alive Time? local sw, sh = guiGetScreenSize() ColumnName = {{ name = "", width = 120, data = function (element) return (string.gsub(getPlayerName(element), '#%x%x%x%x%x%x', '' )) end },} ColumnStats = { { name = "Murders", width = 80, data = function (element) return ( getElementData ( element, "murders" ) or 0 ) end }, { name = "Killed Zombies", width = 80, data = function (element) return ( getElementData ( element, "zombieskilled" ) or 0 ) end }, { name = "Alive Time", width = 80, data = function (element) return formatTimeFromMinutes(getElementData ( element, "alivetime" ) or 1 ) end }, { name = "TKZ", width = 50, data = function (element) return ( getElementData ( element, "totalzombieskilled1" ) or 0 ) end }, { name = "TM", width = 50, data = function (element) return ( getElementData ( element, "totalmurders1" ) or 0 ) end }, { name = "TD", width = 50, data = function (element) return ( getElementData ( element, "totaldeaths3" ) or 0 ) end }, { name = "KD Ratio", width = 50, data = function (element) if not (getElementData ( element, "totaldeaths3" ) and getElementData ( element, "totalmurders1" ) ) then return 0 elseif not (getElementData ( element, "totaldeaths3" ) > 0 ) then return ( ('%.2f'):format( (getElementData ( element, "totalmurders1" ) or 0) / 1) ) else return ( ('%.2f'):format( (getElementData ( element, "totalmurders1" ) or 0) / getElementData ( element, "totaldeaths3" ) ) ) end end }, { name = "TOT", width = 50, data = function (element) return formatTimeFromMinutes(getElementData ( element, "totalonlinetime1" ) or 1 ) end }, { name = "Ping", width = 40, data = function (element) return (getPlayerPing(element)) end }, } local serverName = "FRAGUJEMY" local serverName1 = ". com" local topsize = 60 local playersize = topsize-40 local panelsize = playersize*1.2 function calculateWidth() local width = 0 for key, value in ipairs( ColumnName ) do width = width + value.width end for key, value in ipairs( ColumnStats ) do width = width + value.width end return width + 60 end local max_players = 70 local ploff = 0 local width = calculateWidth() local baseX = sw/2-width/2 local baseY = sh/2-(panelsize+topsize)/0.5 function scoreBoard () if getKeyState( "tab" ) == false then ploff = 0; return end if getElementData(getLocalPlayer(),"logedin") then dxDrawRectangle ( baseX, baseY-40, width, topsize+40, tocolor(25,25,25) ) dxDrawText ( serverName, baseX+170, baseY-38, baseX+width, baseY+topsize, tocolor(255,255,255), 2.15, "bankgothic" ) dxDrawText ( serverName1, baseX+600, baseY, baseX+width, baseY+topsize, tocolor(255,255,255), 0.5, "bankgothic" ) dxDrawRectangle ( baseX, baseY+topsize, width, panelsize, tocolor(112,112,112,0) ) dxDrawLine ( baseX, baseY+30, baseX+width, baseY+30, tocolor(75,75,75),0.8 ) local xoff = 60 for i, v in ipairs ( ColumnName ) do dxDrawText ( v.name, baseX+xoff, baseY+70, baseX+xoff+v.width+10, baseY+topsize-30, tocolor(255,255,255), 1, "default-bold", "center", "center" ) xoff = xoff+v.width end for i, v in ipairs ( ColumnStats ) do dxDrawText ( v.name, baseX+xoff-5, baseY+60, baseX+xoff+v.width, baseY+topsize-30, tocolor(255,255,255), 1, "default-bold", "center", "center" ) xoff = xoff+v.width end local playersTable = getElementsByType ( "player" ) dxDrawText ( "Online: "..tostring(#playersTable).." | "..tostring(max_players), baseX-625, baseY+60, baseX+width, baseY+30, tocolor(255,255,255), 1, "default-bold", "center", "center" ) local maxNum = #playersTable if maxNum > 20 then maxNum = 20 end for i = 1, maxNum do local rank = getElementDataPosition("alivetime",getElementData(getLocalPlayer(),"alivetime")) dxDrawText (i+ploff, baseX, baseY+topsize+playersize*(i-1), baseX+25, baseY+topsize+playersize*i, tocolor(255,255,255), 1, "default-bold", "center", "center" ) if playersTable[i+ploff] == localPlayer then dxDrawRectangle ( baseX, baseY+topsize+playersize*(i-1), width, playersize, tocolor(50,50,50,160) ) else dxDrawRectangle ( baseX, baseY+topsize+playersize*(i-1), width, playersize, tocolor(50,50,50,120) ) end local xoff = 60 for c, d in ipairs ( ColumnName ) do local data = d.data(playersTable[i+ploff]) local r,g,b = 255,255,255 dxDrawText ( data, baseX+xoff-40, baseY+topsize+playersize*(i-1), baseX+xoff+d.width-10, baseY+topsize+playersize*i, tocolor(r,g,b), 0.9, "default-bold", "center", "center" ) xoff = xoff+d.width end for c, d in ipairs ( ColumnStats ) do local data = d.data(playersTable[i+ploff]) local r,g,b = 255,255,255 if d.name == "gang" and data == "None" then r,g,b = 0,255,0 data = "None" end dxDrawText ( data, baseX+xoff, baseY+topsize+playersize*(i-1), baseX+xoff+d.width-5, baseY+topsize+playersize*i, tocolor(r,g,b), 0.9, "default-bold", "center", "center" ) xoff = xoff+d.width end end end end addEventHandler ( "onClientRender", getRootElement(), scoreBoard ) function PlayerScrollMenu (key,keyState,arg) if getElementData(localPlayer,"logedin") and getKeyState( "tab" ) then if ( keyState == "down" ) then if arg == "up" then if ploff > 0 then ploff=ploff-1 end elseif arg == "down" then local playersTable = getElementsByType ( "player" ) if ploff < #playersTable-20 then ploff = ploff+1 end end end end end bindKey ( "mouse_wheel_up", "down", PlayerScrollMenu, "up" ) bindKey ( "mouse_wheel_down", "down", PlayerScrollMenu, "down" ) function formatTimeFromMinutes(value) if value then local hours = math.floor(value/60) local minutes = math.round(((value/60) - math.floor(value/60))*100/(100/60)) if minutes < 10 then minutes = "0"..minutes end value = hours..":"..minutes return value end return false end function math.round(number, decimals, method) decimals = decimals or 0 local factor = 10 ^ decimals if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor else return tonumber(("%."..decimals.."f"):format(number)) end end function sendMaxPlayersOnServer (players) max_players = players end addEvent("sendMaxPlayersOnServer",true) addEventHandler("sendMaxPlayersOnServer",getLocalPlayer(),sendMaxPlayersOnServer)
  9. Why is this happening? How to fix this?
  10. I had tried example from wiki to set lod distance for every object on the map and it didn't fix problem. for i, v in ipairs(getElementsByType("object")) do local model = getElementModel(v) engineSetModelLODDistance(model, 300) -- Set maximum draw distance end
  11. How can I attach LODs to objects?
  12. maffius

    AntiGui

    Works perfectly. Thanks a lot!
  13. maffius

    AntiGui

    Hello, I want to make an AntiGui script that get text from gui button and if it will be for example "WARP" in gui button, client send it to the server log. Is it possible?
×
×
  • Create New...