Jump to content

FlyingSpoon

Members
  • Posts

    749
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by FlyingSpoon

  1. Thanks, worked like charm - I did something like - details = { user = "" pass = "" db = "" } function connect() -- connected it here if connect then outputDebugString("Worked") else outputDebugString("Didn't work") end end addEventHandler("onResourceStart", root, connect) -- then called in my other function
  2. download = false function downloadAvatar(uName,player) download = true if download == true then outputDebugString("[Profile] Fetching profile of - "..uName..".") local connection = dbConnect('mysql', 'dbname='..databaseINFO.db..';host='..databaseINFO.host, databaseINFO.user, databaseINFO.pass) local query = dbQuery(connection, "SELECT `avatar`, `uid` FROM `mybb_users` WHERE `username` = ?", uName); local result = dbPoll(query, -1); if(result and #result >= 1) then if (query == nil or false) then return false end dbFree(query); end end end addEvent("download",true) addEventHandler("download",root,download) [11:12:55] WARNING: download/server.lua:22: Bad usage @ 'dbConnect ' User database already has more than 'max_user_connections' active conn ections] Keeps giving me that error, and then stops/crashes the server.
  3. Is there a possible way to fetch maps from a website rather than from the default place in mta called [maps], I saw someone do it before, just don't know how to actually do it.
  4. Just visited the server, nice server overall, love the features and simplicity it brings. Some things still need updating design wise, and more features needed. Overall, amazing, and strict server to roleplay at! Keep up the work!
  5. How can I get the total registered players within the server via default storage (internal.db), and show it in a DX Text?
  6. local x, y = interpolateBetween ( x1, x1, 0, -- Start point x, y x2, x2, 0, -- End point x, y progress, "Linear") -- You can change the "Linear" string with another easing type x1, x1 or x1, y1, x2, y2
  7. function dxDrawLogin() dxDrawImage(x*0,y*0,x*1280,y*720, "bg.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawText(guiGetText(edit_username), x*504, y*321, x*714, y*341, tocolor(255, 255, 255, 255), 1.00, "default", "left", "center", false, false, true, false, false) dxDrawText(string.rep ( "*", string.len ( guiGetText(edit_password) ) ), x*504, y*369, x*714, y*389, tocolor(255, 255, 255, 255), 1.00, "default", "left", "center", false, false, true, false, false) dxDrawText("Remember Credentials", x*560, y*416, x*700, y*438, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, true, false, false) local r,g,c if isMouseInPosition(x*452, y*448, x*335, y*41) then r,g,c = 0, 96, 93 else r,g,c = 127, 169, 168 end dxDrawRectangle(x*452, y*448, x*335, y*41, tocolor(r,g,c, 127), true) dxDrawText("Sign In", x*451, y*448, x*787, y*489, tocolor(255, 255, 255, 255), 1.40, "default", "center", "center", false, false, true, false, false) local r,g,c if isMouseInPosition(x*452, y*499, x*335, y*41) then r,g,c = 0, 96, 93 else r,g,c = 127, 169, 168 end dxDrawRectangle(x*452, y*499, x*335, y*41, tocolor(r,g,c, 127), true) dxDrawText("Play As Guest", x*451, y*499, x*787, y*540, tocolor(255, 255, 255, 255), 1.40, "default", "center", "center", false, false, true, false, false) end addEventHandler("onClientRender", root, dxDrawLogin) How would I slide all of this down with interpolateBetween? And what would the fastest way be to do this, because I want to animate multiple things in the same script?
  8. How can I make a loading circle, which is animated rotating, then fades away after the loading is complete?
  9. function UserLogin(userName,Password,Checksave) if not (userName == "") then if not (Password == "") then fetchRemote("http://forums.link.com/login.php", function(response,errno,player) if type(response) == "table" then if response.status == "SUCCESS" then triggerClientEvent(player,"loginHide",getRootElement()) triggerClientEvent(player,"showNotification",player, "Successfully logged in!", "success") UserData("success", data["member_id"], data["name"], player, userName, Password, Checksave) outputDebugString("True") else if response.msg == "ACCOUNT_NOT_FOUND" then triggerClientEvent(player,"showNotification",player, "Account doesn't exist!", "error") outputDebugString("False") elseif response.msg == "ACCOUNT_INVALID_PASSWORD" then triggerClientEvent(player,"showNotification",player, "Password doesn't match!", "error") end end elseif response == "ERROR" then triggerClientEvent(player,"showNotification",player, "Internal error. Please try again later. (Code "..errno..")", "error") end end , toJSON({user=userName, pass=Password}), false, source) else triggerClientEvent(source,"showNotification",source, "Please enter your password!", "error") end else triggerClientEvent(source,"showNotification",source, "Please enter your username!", "error") end end addEvent("UserWantToLogin",true) addEventHandler("UserWantToLogin",getRootElement(),UserLogin) function UserData(Status,UserID,uName,player,userName,Password,Checksave) if Status == "success" then if not getAccount (UserID) then acc = addAccount(tostring(UserID),tostring(Password)) end if not getAccount(UserID,Password) then setAccountPassword(getAccount(UserID),Password) end local acc = getAccount ( UserID,Password) if(not isGuestAccount(acc)) then logOut(player); end logIn (player, acc, Password) setElementData(player,"getForumID",UserID) setElementData(player,"getForumName",uName) end end LUA Script ^ <?php include 'mta_sdk.php'; $_SERVER['SCRIPT_FILENAME'] = __FILE__; $path = ''; require_once $path . 'init.php'; \IPS\Session\Front::i(); $input = mta::getInput(); $username = $input[0]['user']; $password = $input[0]['pass']; $member = \IPS\Member::load($username, 'name'); if( !$member->member_id ) { mta::doReturn( array( 'status' => 'FAILED', 'msg' => 'ACCOUNT_NOT_FOUND', ) ); exit; } $salt = $member->members_pass_salt; $hash = crypt($password, '$2a$13$' . $salt); if (\IPS\Login::compareHashes($member->members_pass_hash, $hash) === TRUE) { mta::doReturn( array( "status" => "SUCCESS", "connect_status" => ( $member->members_bitoptions['validating'] ) ? 'VALIDATING' : 'SUCCESS', "email" => $member->email, "name" => $member->name, "connect_id" => $member->member_id, ) ); } else { mta::doReturn( array( 'status' => 'FAILED', 'msg' => 'ACCOUNT_INVALID_PASSWORD', ) ); } ?> PHP ^ --- There's no output in the debug, and nothing happens, any ideas? @MrTasty
  10. <?php // PHP include 'mta_sdk.php'; // Correct path if you use a different one $servername = "********"; // Change these details $username = "********"; // Change these details $password = "*********"; // Change these details $dbname = "********"; // Change these details $table = "core_members"; $accountColumn = "name"; // change to "email" if you prefer logging in through email $conn = mysqli_connect($servername, $username, $password, $dbname); if (!$conn) { mta::doReturn(false, "Connection failed: " . mysqli_connect_error()); // Account not found #die("Connection failed: " . mysqli_connect_error()); } $input = mta::getInput(); if (isset($input[0]) && isset($input[1]) && isset($input[2]) && $input[0] == "verifyPasswords" ) { $sql = "SELECT `members_pass_salt`, `members_pass_hash`, `members_id` FROM `".$table."` WHERE `".$accountColumn."`='".strtolower($input[1])."' LIMIT 1"; $result = mysqli_query($conn, $sql); if (mysqli_num_rows($result) > 0) { $row = mysqli_fetch_assoc($result); if (crypt($input[2], '$2a$13$' . $row['members_pass_salt']) == $row['members_pass_hash']) { mta::doReturn(true, 0, $row, $input[3], $input[4]); // Password correct } else { mta::doReturn(false, 1, false, false, $input[4]); // Passwords don't match } } else { mta::doReturn(false, 2, false, false, $input[4]); // Account not found } } // Author: MrTasty ?> MTA SERVER SIDE SCRIPT - ABOVE IS PHP SCRIPT function UserLogin(userName,Password,Checksave) if not (userName == "") then if not (Password == "") then callRemote("[LINK]", function(response,extra,data,Checksave,player) if response == true then triggerClientEvent(player,"loginHide",getRootElement()) triggerClientEvent(player,"showNotification",player, "Successfully logged in!", "success") triggerClientEvent(player, "triggerLobby", player) UserData("success", data["member_id"], data["name"], player, userName, Password, Checksave); elseif extra == 1 then triggerClientEvent(player,"showNotification",player, "Password doesn't match!", "error") elseif extra == 2 then triggerClientEvent(player,"showNotification",player, "Account doesn't exist!", "error") end end ,"verifyPasswords", userName, Password, Checksave, source) else triggerClientEvent(source,"showNotification",source, "Please enter your password!", "error") end else triggerClientEvent(source,"showNotification",source, "Please enter your username!", "error") end end addEvent("UserWantToLogin",true) addEventHandler("UserWantToLogin",getRootElement(),UserLogin) So whenever I try to login, it says account doesnt exist, I dont understand what I'm doing wrong? Any help? @MrTasty
  11. We've just opened up our first CW Server, available for clanwars view more here - http://ftw-gaming.com
  12. It already does that, when the scoreboard opens, it lists all the players. Then once the mouse hovers over the 'Spectators' it lists the spectators but, then it overlaps all the current spectators, whereas, I am trying to make them all on separate lines. It's possible if I do screenH * 0.3583+33*ids+(k*33) But then it just creates a huge gap.
  13. Okay I'm trying something else - if (spectators==true) then spectators = {} spectators[i] = {} local spectatorteam = getPlayersInTeam(getTeamFromName ( "Spectators" )) or 0 for i=1, #spectatorteam do spectators[i].name = getPlayerName(v) spectators[i].fps = getElementData(v,"fps") spectators[i].ping = getPlayerPing(v) local y = offset * (i - 1) How would I get the separate people's data if I do it this way?
  14. No, as a whole the scoreboard works perfectly fine. But lets say, if the players join the spectators team right, and on the scoreboard if there's more than 1 spectator, the rectangles/names just to hover over each other. And I can't figure out where I'm gone wrong. They overlap, I tried different calculations, but I always get the same result.
  15. Didn't I already do that for spectators? In this part - if (spectators==true) then spectators = {} spectators[i] = {} local players = getPlayersInTeam(getTeamFromName ( "Spectators" )) or 0 for k,v in ipairs(players) do spectators[i].name = getPlayerName(v) spectators[i].fps = getElementData(v,"fps") spectators[i].ping = getPlayerPing(v) dxDrawRectangle(screenW * 0.2977, screenH * 0.3583+33*ids, screenW * 0.4055, screenH * 0.0431, tocolor(40, 40, 40, 114), false) dxDrawText(spectators[i].name, screenW * 0.3063, screenH * 0.3694+33*ids, screenW * 0.3633, screenH * 0.3917, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, true, false) dxDrawText(spectators[i].fps or 0, screenW * 0.6281, screenH * 0.3681+33*ids, screenW * 0.6453, screenH * 0.3875, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, true, false, false) dxDrawText(spectators[i].ping, screenW * 0.6672, screenH * 0.3681+33*ids, screenW * 0.6844, screenH * 0.3875, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, true, false, false) end
  16. local players = {} local spectators = {} local scroll = 0 local player = client local scoreboard local root = getRootElement() local player = getLocalPlayer() local counter = 0 local starttick local currenttick addEventHandler("onClientRender",root, function() if not starttick then starttick = getTickCount() end counter = counter + 1 currenttick = getTickCount() if currenttick - starttick >= 1000 then setElementData(player,"fps",counter) counter = 0 starttick = false end end ) function onPlayerJoinToServer() if source then findIDForPlayer(source) local country = call(getResourceFromName("admin"),"getPlayerCountry",source) if country then setElementData(source,"country",country) else setElementData(source,"country","?") end end end addEventHandler("onPlayerJoin",getRootElement(),onPlayerJoinToServer) function findIDForPlayer(thePlayer) if thePlayer and not getElementData(thePlayer,"ID") then local i = 0 local players = getElementsByType("player") repeat local foundID = false i = i + 1 for _,player in pairs(players) do if player ~= thePlayer then local playerID = tonumber(getElementData(player,"ID")) if playerID == i then foundID = true break end end end until not foundID setElementData(thePlayer,"ID",i) end end function onServerIDStart() for i,thePlayer in pairs(getElementsByType("player")) do findIDForPlayer(thePlayer) local country = call(getResourceFromName("admin"),"getPlayerCountry",source) if country then setElementData(source,"country",country) else setElementData(source,"country","?") end end end addEventHandler("onResourceStart",resourceRoot,onServerIDStart) function setScoreboardValues(thePlayer) players = {} local i = 1 for k, v in pairs(getElementsByType("player")) do local player = getPlayerName(v) playername = tostring ( player ):gsub( "_", " " ); playerping = getPlayerPing(v); players[i] = {} players[i].name = playername players[i].ping = playerping players[i].country = getElementData(v,"country") local playerTeam = getPlayerTeam ( v ) players[i].teamname = getTeamName ( playerTeam ) if not starttick then starttick = getTickCount() end counter = counter + 1 currenttick = getTickCount() if currenttick - starttick >= 1000 then setElementData(v,"fps",counter) counter = 0 starttick = false end players[i].fps = getElementData(v,"fps") i = i + 1 end end local screenW, screenH = guiGetScreenSize() scoreboard = false spectators = false team1 = false team2 = false referees = false function dxDrawScoreboard() scoreboard = true id = 0 ids = 0 dxDrawRectangle(screenW * 0.2086, screenH * 0.2778, screenW * 0.0891, screenH * 0.4889, tocolor(52, 52, 52, 248), false) dxDrawRectangle(screenW * 0.2977, screenH * 0.2333, screenW * 0.4055, screenH * 0.5333, tocolor(52, 52, 52, 200), false) dxDrawRectangle(screenW * 0.2977, screenH * 0.7236, screenW * 0.4055, screenH * 0.0431, tocolor(43, 43, 43, 255), false) dxDrawRectangle(screenW * 0.2977, screenH * 0.3083, screenW * 0.4055, screenH * 0.0431, tocolor(43, 43, 43, 255), false) dxDrawText("Name", screenW * 0.3117, screenH * 0.3167, screenW * 0.3367, screenH * 0.3444, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) dxDrawText("Country", screenW * 0.5141, screenH * 0.3167, screenW * 0.5500, screenH * 0.3444, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) dxDrawText("FPS", screenW * 0.6281, screenH * 0.3167, screenW * 0.6641, screenH * 0.3444, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) dxDrawText("Ping", screenW * 0.6672, screenH * 0.3167, screenW * 0.7031, screenH * 0.3444, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) dxDrawRectangle(screenW * 0.2086, screenH * 0.2778, screenW * 0.0891, screenH * 0.0444, tocolor(44, 44, 44, 248), false) dxDrawText("TEAMS", screenW * 0.2086, screenH * 0.2778, screenW * 0.2977, screenH * 0.3222, tocolor(255, 255, 255, 255), 1.50, "default-bold", "center", "center", false, false, false, false, false) dxDrawRectangle(screenW * 0.2086, screenH * 0.3333, screenW * 0.0883, screenH * 0.0403, tocolor(40, 40, 40, 248), false) dxDrawText("Team 1", screenW * 0.2086, screenH * 0.3333, screenW * 0.2969, screenH * 0.3722, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false) dxDrawRectangle(screenW * 0.2086, screenH * 0.3875, screenW * 0.0883, screenH * 0.0403, tocolor(40, 40, 40, 248), false) dxDrawText("Team 2", screenW * 0.2086, screenH * 0.3875, screenW * 0.2969, screenH * 0.4278, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false) local r,g,c if isMouseInPosition(screenW * 0.2094, screenH * 0.4472, screenW * 0.0883, screenH * 0.0403) then r,g,c = 80, 80, 80 spectators = true else r,g,c = 40, 40, 40 spectators = false end local specs = getTeamFromName ( "Spectators" ) local speccounter = countPlayersInTeam ( specs ) or 0 dxDrawRectangle(screenW * 0.2094, screenH * 0.4472, screenW * 0.0883, screenH * 0.0403, tocolor(r, g, c, 248), false) dxDrawText("Spectators".." ("..speccounter..")", screenW * 0.2078, screenH * 0.4472, screenW * 0.2977, screenH * 0.4875, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false) dxDrawRectangle(screenW * 0.2094, screenH * 0.5097, screenW * 0.0883, screenH * 0.0431, tocolor(40, 40, 40, 248), false) dxDrawText("Referees", screenW * 0.2086, screenH * 0.5097, screenW * 0.2977, screenH * 0.5500, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText(#getElementsByType("player").."/50", screenW * 0.6672, screenH * 0.2625, screenW * 0.7508, screenH * 0.3083, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) dxDrawText("Players:", screenW * 0.6672, screenH * 0.2486, screenW * 0.7109, screenH * 0.2986, tocolor(255, 255, 255, 255), 0.60, "default-bold", "left", "top", false, false, false, false, false) dxDrawText("Welcome to FTW Gaming's Clanwar Server!", screenW * 0.3195, screenH * 0.2542, screenW * 0.4039, screenH * 0.3028, tocolor(255, 255, 255, 255), 1.50, "default", "left", "top", false, false, false, false, false) for i = 1+scroll,8+scroll do if (players[i] and not spectators == true) then dxDrawRectangle(screenW * 0.2977, screenH * 0.3583+33*id, screenW * 0.4055, screenH * 0.0431, tocolor(40, 40, 40, 114), false) dxDrawText(players[i].name, screenW * 0.3063, screenH * 0.3694+33*id, screenW * 0.3633, screenH * 0.3917, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, true, false) dxDrawText(players[i].fps, screenW * 0.6281, screenH * 0.3681+33*id, screenW * 0.6453, screenH * 0.3875, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, true, false, false) dxDrawText(players[i].ping, screenW * 0.6672, screenH * 0.3681+33*id, screenW * 0.6844, screenH * 0.3875, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, true, false, false) else if (spectators==true) then spectators = {} spectators[i] = {} local players = getPlayersInTeam(getTeamFromName ( "Spectators" )) or 0 for k,v in ipairs(players) do spectators[i].name = getPlayerName(v) spectators[i].fps = getElementData(v,"fps") spectators[i].ping = getPlayerPing(v) dxDrawRectangle(screenW * 0.2977, screenH * 0.3583+33*ids, screenW * 0.4055, screenH * 0.0431, tocolor(40, 40, 40, 114), false) dxDrawText(spectators[i].name, screenW * 0.3063, screenH * 0.3694+33*ids, screenW * 0.3633, screenH * 0.3917, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, true, false) dxDrawText(spectators[i].fps or 0, screenW * 0.6281, screenH * 0.3681+33*ids, screenW * 0.6453, screenH * 0.3875, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, true, false, false) dxDrawText(spectators[i].ping, screenW * 0.6672, screenH * 0.3681+33*ids, screenW * 0.6844, screenH * 0.3875, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, true, false, false) end i = i + 1 end if scoreboard == true then bindKey( "mouse2", "both", showTheCursor ) else unbindKey( "mouse2", "both", showTheCursor ) end end id = id + 1 ids = ids + 1 end end function isMouseInPosition ( x, y, width, height ) if ( not isCursorShowing ( ) ) then return false end local sx, sy = guiGetScreenSize ( ) -- Get the player screen resolution local cx, cy = getCursorPosition ( ) -- Get the cursor position local cx, cy = ( cx * sx ), ( cy * sy ) -- Convert relative positions to absolute if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then return true else return false end end function showTheCursor( _, state ) if state == "down" then showCursor( true ) else if not (scoreboard==true) then showCursor( false ) end end end local function onToggleKey ( key, keyState ) if not scoreboard then local elementTable = getElementsByType ( "scoreboard" ) if #elementTable > 0 then scoreboard = elementTable[1] else return end end end bindKey ( "tab", "both", onToggleKey ) bindKey("tab", "down", function() addEventHandler("onClientRender", root, dxDrawScoreboard) bindKey("mouse_wheel_up", "down", scroll_up) bindKey("mouse_wheel_down", "down", scroll_down) updateTimer = setTimer(function () setScoreboardValues(); end, 100, 0) end) bindKey("tab", "up", function() removeEventHandler("onClientRender", root, dxDrawScoreboard) scoreboard = false unbindKey( "mouse2", "both", showTheCursor ) showCursor(false) unbindKey("mouse_wheel_up", "down", scroll_up) unbindKey("mouse_wheel_down", "down", scroll_down) killTimer(updateTimer) end) function scroll_up() if (scroll <= 2) then scroll = 0 else scroll = scroll - 2 end end function scroll_down() if (#getElementsByType("player") <= 2) then scroll = #getElementsByType("player") else scroll = scroll + 2 end end Here's the full script.
  17. Still doing the same thing, it's still overlapping
  18. My servers are all on the same machine, and the exports are in both servers too.
  19. Like the picture, the names overlap if they go on spectators, there's meant to be a gap.
  20. function dxDrawScoreboard() scoreboard = true id = 0 dxDrawRectangle(screenW * 0.2086, screenH * 0.2778, screenW * 0.0891, screenH * 0.4889, tocolor(52, 52, 52, 248), false) dxDrawRectangle(screenW * 0.2977, screenH * 0.2333, screenW * 0.4055, screenH * 0.5333, tocolor(52, 52, 52, 200), false) dxDrawRectangle(screenW * 0.2977, screenH * 0.7236, screenW * 0.4055, screenH * 0.0431, tocolor(43, 43, 43, 255), false) dxDrawRectangle(screenW * 0.2977, screenH * 0.3083, screenW * 0.4055, screenH * 0.0431, tocolor(43, 43, 43, 255), false) dxDrawText("Name", screenW * 0.3117, screenH * 0.3167, screenW * 0.3367, screenH * 0.3444, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) dxDrawText("Country", screenW * 0.5141, screenH * 0.3167, screenW * 0.5500, screenH * 0.3444, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) dxDrawText("FPS", screenW * 0.6281, screenH * 0.3167, screenW * 0.6641, screenH * 0.3444, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) dxDrawText("Ping", screenW * 0.6672, screenH * 0.3167, screenW * 0.7031, screenH * 0.3444, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) dxDrawRectangle(screenW * 0.2086, screenH * 0.2778, screenW * 0.0891, screenH * 0.0444, tocolor(44, 44, 44, 248), false) dxDrawText("TEAMS", screenW * 0.2086, screenH * 0.2778, screenW * 0.2977, screenH * 0.3222, tocolor(255, 255, 255, 255), 1.50, "default-bold", "center", "center", false, false, false, false, false) dxDrawRectangle(screenW * 0.2086, screenH * 0.3333, screenW * 0.0883, screenH * 0.0403, tocolor(40, 40, 40, 248), false) dxDrawText("Team 1", screenW * 0.2086, screenH * 0.3333, screenW * 0.2969, screenH * 0.3722, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false) dxDrawRectangle(screenW * 0.2086, screenH * 0.3875, screenW * 0.0883, screenH * 0.0403, tocolor(40, 40, 40, 248), false) dxDrawText("Team 2", screenW * 0.2086, screenH * 0.3875, screenW * 0.2969, screenH * 0.4278, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false) local r,g,c if isMouseInPosition(screenW * 0.2094, screenH * 0.4472, screenW * 0.0883, screenH * 0.0403) then r,g,c = 80, 80, 80 spectators = true else r,g,c = 40, 40, 40 spectators = false end local specs = getTeamFromName ( "Spectators" ) local speccounter = countPlayersInTeam ( specs ) or 0 dxDrawRectangle(screenW * 0.2094, screenH * 0.4472, screenW * 0.0883, screenH * 0.0403, tocolor(r, g, c, 248), false) dxDrawText("Spectators".." ("..speccounter..")", screenW * 0.2078, screenH * 0.4472, screenW * 0.2977, screenH * 0.4875, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false) dxDrawRectangle(screenW * 0.2094, screenH * 0.5097, screenW * 0.0883, screenH * 0.0431, tocolor(40, 40, 40, 248), false) dxDrawText("Referees", screenW * 0.2086, screenH * 0.5097, screenW * 0.2977, screenH * 0.5500, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText(#getElementsByType("player").."/50", screenW * 0.6672, screenH * 0.2625, screenW * 0.7508, screenH * 0.3083, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) dxDrawText("Players:", screenW * 0.6672, screenH * 0.2486, screenW * 0.7109, screenH * 0.2986, tocolor(255, 255, 255, 255), 0.60, "default-bold", "left", "top", false, false, false, false, false) dxDrawText("Welcome to FTW Gaming's Clanwar Server!", screenW * 0.3195, screenH * 0.2542, screenW * 0.4039, screenH * 0.3028, tocolor(255, 255, 255, 255), 1.50, "default", "left", "top", false, false, false, false, false) for i = 1+scroll,8+scroll do if (players[i] and not spectators == true) then dxDrawRectangle(screenW * 0.2977, screenH * 0.3583+33*id, screenW * 0.4055, screenH * 0.0431, tocolor(40, 40, 40, 114), false) dxDrawText(players[i].name, screenW * 0.3063, screenH * 0.3694+33*id, screenW * 0.3633, screenH * 0.3917, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, true, false) dxDrawText(players[i].fps, screenW * 0.6281, screenH * 0.3681+33*id, screenW * 0.6453, screenH * 0.3875, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, true, false, false) dxDrawText(players[i].ping, screenW * 0.6672, screenH * 0.3681+33*id, screenW * 0.6844, screenH * 0.3875, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, true, false, false) else if (spectators==true) then local i = 1 spectators = {} spectators[i] = {} local players = getPlayersInTeam(getTeamFromName ( "Spectators" )) or 0 for k,v in ipairs(players) do spectators[i].name = getPlayerName(v) spectators[i].fps = getElementData(v,"fps") spectators[i].ping = getPlayerPing(v) dxDrawRectangle(screenW * 0.2977, screenH * 0.3583+33*id, screenW * 0.4055, screenH * 0.0431, tocolor(40, 40, 40, 114), false) dxDrawText(spectators[i].name, screenW * 0.3063, screenH * 0.3694+33*id, screenW * 0.3633, screenH * 0.3917, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, true, false) dxDrawText(spectators[i].fps or 0, screenW * 0.6281, screenH * 0.3681+33*id, screenW * 0.6453, screenH * 0.3875, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, true, false, false) dxDrawText(spectators[i].ping, screenW * 0.6672, screenH * 0.3681+33*id, screenW * 0.6844, screenH * 0.3875, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, true, false, false) end i = i + 1 end if scoreboard == true then bindKey( "mouse2", "both", showTheCursor ) else unbindKey( "mouse2", "both", showTheCursor ) end end id = id + 1 end end It works for normal players like when they normally press TAB, but when they go to spectators, it just overlaps.
×
×
  • Create New...