Jump to content

h4x7o0r

Members
  • Posts

    203
  • Joined

  • Last visited

Everything posted by h4x7o0r

  1. Thank you for your help. I've seen the script that u provided but there are some things that aren't that clear for me. I think there's a standalone script and not a modification of the destructionderby.lua With this one i should call or trigger some functions from from he main destructionderby.lua : function DestructionDerby:onPlayerQuit(player) function DestructionDerby:onPlayerWasted(player) And definitely i don;t know to restrict to dd or dm.
  2. Thank you for your code. I've tried it and obviously last player can finish the map but when hunter is taken nothing happens. And also with this modification, the setting is also available on DD maps which is no good at all.
  3. Hey guys , i've tried to modify the destructionderby.lua to work just like autob resource. To be more explicit: on DM maps for example I wanna let last player alive to finish the map ( by default when 1 player's remaining the race's considered finished and votemanager starts vote or nextmap). And also when last player alive is taking the hunter (425 veh) race to be finished and votemap to appear. I've tried some many ways to make it work but without any luck. Here's the last destructionderby.lua (res:0910) DestructionDerby = setmetatable({}, RaceMode) DestructionDerby.__index = DestructionDerby DestructionDerby:register('Destruction derby') function DestructionDerby:isApplicable() return not RaceMode.checkpointsExist() and RaceMode.getMapOption('respawn') == 'none' end function DestructionDerby:getPlayerRank(player) return #getActivePlayers() end -- Copy of old updateRank function DestructionDerby:updateRanks() for i,player in ipairs(g_Players) do if not isPlayerFinished(player) then local rank = self:getPlayerRank(player) if not rank or rank > 0 then setElementData(player, 'race rank', rank) end end end -- Make text look good at the start if not self.running then for i,player in ipairs(g_Players) do setElementData(player, 'race rank', '' ) setElementData(player, 'checkpoint', '' ) end end end function DestructionDerby:onPlayerWasted(player) if isActivePlayer(player) then self:handleFinishActivePlayer(player) if getActivePlayerCount() <= 1 then RaceMode.endMap() else TimerManager.createTimerFor("map",player):setTimer(clientCall, 2000, 1, player, 'Spectate.start', 'auto') end end RaceMode.setPlayerIsFinished(player) showBlipsAttachedTo(player, false) end function DestructionDerby:onPlayerQuit(player) if isActivePlayer(player) then self:handleFinishActivePlayer(player) if getActivePlayerCount() <= 1 then RaceMode.endMap() end end end function DestructionDerby:handleFinishActivePlayer(player) -- Update ranking board for player being removed if not self.rankingBoard then self.rankingBoard = RankingBoard:create() self.rankingBoard:setDirection( 'up', getActivePlayerCount() ) end local timePassed = self:getTimePassed() self.rankingBoard:add(player, timePassed) -- Do remove local rank = self:getPlayerRank(player) finishActivePlayer(player) if rank and rank > 1 then triggerEvent( "onPlayerFinishDD",player,tonumber( rank ) ) end -- Update ranking board if one player left local activePlayers = getActivePlayers() if #activePlayers == 1 then self.rankingBoard:add(activePlayers[1], timePassed) showMessage(getPlayerName(activePlayers[1]) .. ' is the final survivor!', 0, 255, 0) triggerEvent( "onPlayerWinDD",activePlayers[1] ) end end ------------------------------------------------------------ -- activePlayerList stuff -- function isActivePlayer( player ) return table.find( g_CurrentRaceMode.activePlayerList, player ) end function addActivePlayer( player ) table.insertUnique( g_CurrentRaceMode.activePlayerList, player ) end function removeActivePlayer( player ) table.removevalue( g_CurrentRaceMode.activePlayerList, player ) end function finishActivePlayer( player ) table.removevalue( g_CurrentRaceMode.activePlayerList, player ) table.insertUnique( g_CurrentRaceMode.finishedPlayerList, _getPlayerName(player) ) end function getFinishedPlayerCount() return #g_CurrentRaceMode.finishedPlayerList end function getActivePlayerCount() return #g_CurrentRaceMode.activePlayerList end function getActivePlayers() return g_CurrentRaceMode.activePlayerList end and i've tried to change onPlayerWasted Function like this : if getActivePlayerCount() <= 1 then -- WITH this one if getActivePlayerCount() < 1 then or to add another handler : addEventHandler("onElementModelChange",root, function(old,new) if (getElementType(source) == "vehicle") then if #activePlayers == 1 then if (new == 425) then RaceMode.endMap() end end end end) or maybe : -- Update ranking board if one player left local activePlayers = getActivePlayers() if #activePlayers == 1 then self.rankingBoard:add(activePlayers[1], timePassed) showMessage(getPlayerName(activePlayers[1]) .. ' is the final survivor!', 0, 255, 0) triggerEvent( "onPlayerWinDD",activePlayers[1] ) if (getElementModel(getPedOccupiedVehicle(activePlayers[1])) == 425) then RaceMode.endMap() end How can i fix it to work , i've tried to create a separate resource but didn't know how to trigger activeplayers function from there. That would have been more useful . Thanks in advance.
  4. So yeah looks like now i'm having a really strange problem. The toggle it's working very well, it's autostarting the textures when player connect but the problem is with reconnecting. For example: I log in to the server everything's fine. without pressing the toggle button i'm tryin to reconnect. After resources are loaded , the mta's crashing. I tried different ways to replicate this problem, it's only present at player reconnect. I've noticed that if u are playing on the server and then are u going for some time to another server , when u are coming back to the first server , mta's crashing. I think it's smth with cache or idk. maybe some files remained loaded and when u tryin to reconnect the new/same files tryin to be reloaded.
  5. If you are using Race resource, you better change vehicle colors. So go to resource panel -> race (double click) -> (scrolldown) Vechile colors -> change from random to file.
  6. I've tried your script, it's not working / no errors. Maybe because img needs to be rendered different way inside dxscoreboard otherwise isn't shown. I've managed to fix the previous version and now i think it;'s working very well. Thank you for your help solidsnake14 and zoomka. All the best guys. LE : Zoomka's script's working perfect right now too and doesn't need any dxscoreboard modification. (maybe only width and height to be exactly 16 x 11, for the flag to be properly displayed.) Thank you again for all your help. LE2: Is there any way that zoomka's script to work with countryid resource (https://community.multitheftauto.com/index.php?p= ... ls&id=1995) ? I mean that the country code and country flag to be exported in a common column named "country" for example.
  7. Thank you for your reply, So what i'm trying to do is to display the country flag just in front of the player nicknames in scoreboard. Good point, i've just just updated my scoareboard resource with the last one from here (mta-resources-r909). I think this is the last one. So now i'm having this code (untouched) dxscoreboard_client -- THESE CAN BE CHANGED triggerKey = "tab" -- default button to open/close scoreboard settingsKey = "F7" -- default button to open the settings window drawOverGUI = true -- draw scoreboard over gui? seperationSpace = 80 -- the space between top/bottom screen and scoreboard top/bottom in pixels -- BUT DON'T TOUCH THESE scoreboardToggled = false scoreboardForced = false scoreboardDrawn = false forceScoreboardUpdate = false useAnimation = true scoreboardIsToggleable = false showServerInfo = false showGamemodeInfo = false showTeams = true useColors = true drawSpeed = 1 scoreboardScale = 1 teamHeaderFont = "clear" contentFont = "default-bold" columnFont = "default-bold" serverInfoFont = "default" rmbFont = "clear" cBlack = tocolor( 0, 0, 0 ) cWhite = tocolor( 255, 255, 255 ) cSettingsBox = tocolor( 255, 255, 255, 150 ) MAX_PRIRORITY_SLOT = 500 scoreboardColumns = {} resourceColumns = {} scoreboardDimensions = { ["width"] = 0, ["height"] = 0, ["phase"] = 1, ["lastSeconds"] = 0 } scoreboardTicks = { ["lastUpdate"] = 0, ["updateInterval"] = 500 } scoreboardContent = {} firstVisibleIndex = 1 sortBy = { ["what"] = "__NONE__", ["dir"] = -1 } -- -1 = dec, 1 = asc sbOutOffset, sbInOffset = 1, 1 sbFont = "clear" sbFontScale = 0.68 serverInfo = {} fontScale = { -- To make all fonts be equal in height ["default"] = 1.0, ["default-bold"] = 1.0, ["clear"] = 1.0, ["arial"] = 1.0, ["sans"] = 1.0, ["pricedown"] = 0.5, ["bankgothic"] = 0.5, ["diploma"] = 0.5, ["beckett"] = 0.5 } selectedRows = {} addEvent( "onClientPlayerScoreboardClick" ) addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), function ( resource ) cScoreboardBackground = tocolor( defaultSettings.bg_color.r, defaultSettings.bg_color.g, defaultSettings.bg_color.b, defaultSettings.bg_color.a ) cSelection = tocolor( defaultSettings.selection_color.r, defaultSettings.selection_color.g, defaultSettings.selection_color.b, defaultSettings.selection_color.a ) cHighlight = tocolor( defaultSettings.highlight_color.r, defaultSettings.highlight_color.g, defaultSettings.highlight_color.b, defaultSettings.highlight_color.a ) cHeader = tocolor( defaultSettings.header_color.r, defaultSettings.header_color.g, defaultSettings.header_color.b, defaultSettings.header_color.a ) cTeam = tocolor( defaultSettings.team_color.r, defaultSettings.team_color.g, defaultSettings.team_color.b, defaultSettings.team_color.a ) cBorder = tocolor( defaultSettings.border_color.r, defaultSettings.border_color.g, defaultSettings.border_color.b, defaultSettings.border_color.a ) cServerInfo = tocolor( defaultSettings.serverinfo_color.r, defaultSettings.serverinfo_color.g, defaultSettings.serverinfo_color.b, defaultSettings.serverinfo_color.a ) cContent = tocolor( defaultSettings.content_color.r, defaultSettings.content_color.g, defaultSettings.content_color.b, defaultSettings.content_color.a ) bindKey( triggerKey, "down", "Toggle scoreboard", "1" ) bindKey( triggerKey, "up", "Toggle scoreboard", "0" ) bindKey( settingsKey, "down", "Open scoreboard settings", "1" ) addEventHandler( "onClientRender", getRootElement(), drawScoreboard ) triggerServerEvent( "onClientDXScoreboardResourceStart", getRootElement() ) readScoreboardSettings() triggerServerEvent( "requestServerInfo", getRootElement() ) colorPicker.constructor() end ) addEventHandler( "onClientPlayerQuit", getRootElement(), function() selectedRows[source] = nil end ) function sendServerInfo( output ) serverInfo = output end addEvent( "sendServerInfo", true ) addEventHandler( "sendServerInfo", getResourceRootElement( getThisResource() ), sendServerInfo ) function toggleScoreboard( _, state ) state = iif( state == "1", true, false ) if scoreboardIsToggleable and state then scoreboardToggled = not scoreboardToggled elseif not scoreboardIsToggleable then scoreboardToggled = state end end addCommandHandler( "Toggle scoreboard", toggleScoreboard ) function openSettingsWindow() if scoreboardDrawn then local sX, sY = guiGetScreenSize() if not (windowSettings and isElement( windowSettings ) and guiGetVisible( windowSettings )) then createScoreboardSettingsWindow( sX-323, sY-350 ) showCursor( true ) elseif isElement( windowSettings ) then destroyScoreboardSettingsWindow() end end end addCommandHandler( "Open scoreboard settings", openSettingsWindow ) addCommandHandler( "scoreboard", function () scoreboardToggled = not scoreboardToggled end ) function iif( cond, arg1, arg2 ) if cond then return arg1 end return arg2 end function doDrawScoreboard( rtPass, onlyAnim, sX, sY ) if #scoreboardColumns ~= 0 then -- -- In/out animation -- local currentSeconds = getTickCount() / 1000 local deltaSeconds = currentSeconds - scoreboardDimensions.lastSeconds scoreboardDimensions.lastSeconds = currentSeconds deltaSeconds = math.clamp( 0, deltaSeconds, 1/25 ) if scoreboardToggled or scoreboardForced then local phases = { [1] = { ["width"] = s(10), ["height"] = s(5), ["incToWidth"] = s(10), ["incToHeight"] = s(5), ["decToWidth"] = 0, ["decToHeight"] = 0 }, [2] = { ["width"] = s(40), ["height"] = s(5), ["incToWidth"] = calculateWidth(), ["incToHeight"] = s(5), ["decToWidth"] = s(10), ["decToHeight"] = s(5) }, [3] = { ["width"] = calculateWidth(), ["height"] = s(30), ["incToWidth"] = calculateWidth(), ["incToHeight"] = calculateHeight(), ["decToWidth"] = calculateWidth(), ["decToHeight"] = s(5) } } if not useAnimation then scoreboardDimensions.width = calculateWidth() scoreboardDimensions.height = calculateHeight() scoreboardDimensions.phase = #phases end local maxChange = deltaSeconds * 30*drawSpeed local maxWidthDiff = math.clamp( -maxChange, phases[scoreboardDimensions.phase].incToWidth - scoreboardDimensions.width, maxChange ) local maxHeightDiff = math.clamp( -maxChange, phases[scoreboardDimensions.phase].incToHeight - scoreboardDimensions.height, maxChange ) if scoreboardDimensions.width < phases[scoreboardDimensions.phase].incToWidth then scoreboardDimensions.width = scoreboardDimensions.width + maxWidthDiff * phases[scoreboardDimensions.phase].width if scoreboardDimensions.width > phases[scoreboardDimensions.phase].incToWidth then scoreboardDimensions.width = phases[scoreboardDimensions.phase].incToWidth end elseif scoreboardDimensions.width > phases[scoreboardDimensions.phase].incToWidth and not scoreboardDrawn then scoreboardDimensions.width = scoreboardDimensions.width - maxWidthDiff * phases[scoreboardDimensions.phase].width if scoreboardDimensions.width < phases[scoreboardDimensions.phase].incToWidth then scoreboardDimensions.width = phases[scoreboardDimensions.phase].incToWidth end end if scoreboardDimensions.height < phases[scoreboardDimensions.phase].incToHeight then scoreboardDimensions.height = scoreboardDimensions.height + maxHeightDiff * phases[scoreboardDimensions.phase].height if scoreboardDimensions.height > phases[scoreboardDimensions.phase].incToHeight then scoreboardDimensions.height = phases[scoreboardDimensions.phase].incToHeight end elseif scoreboardDimensions.height > phases[scoreboardDimensions.phase].incToHeight and not scoreboardDrawn then scoreboardDimensions.height = scoreboardDimensions.height - maxHeightDiff * phases[scoreboardDimensions.phase].height if scoreboardDimensions.height < phases[scoreboardDimensions.phase].incToHeight then scoreboardDimensions.height = phases[scoreboardDimensions.phase].incToHeight end end if scoreboardDimensions.width == phases[scoreboardDimensions.phase].incToWidth and scoreboardDimensions.height == phases[scoreboardDimensions.phase].incToHeight then if phases[scoreboardDimensions.phase + 1] then scoreboardDimensions.phase = scoreboardDimensions.phase + 1 else if not scoreboardDrawn then bindKey( "mouse2", "both", showTheCursor ) bindKey( "mouse_wheel_up", "down", scrollScoreboard, -1 ) bindKey( "mouse_wheel_down", "down", scrollScoreboard, 1 ) addEventHandler( "onClientClick", getRootElement(), scoreboardClickHandler ) if not (windowSettings and isElement( windowSettings )) then showCursor( false ) end triggerServerEvent( "requestServerInfo", getRootElement() ) end scoreboardDrawn = true end end elseif scoreboardDimensions.width ~= 0 and scoreboardDimensions.height ~= 0 then local phases = { [1] = { ["width"] = s(10), ["height"] = s(5), ["incToWidth"] = s(10), ["incToHeight"] = s(5), ["decToWidth"] = 0, ["decToHeight"] = 0 }, [2] = { ["width"] = s(40), ["height"] = s(5), ["incToWidth"] = calculateWidth(), ["incToHeight"] = s(5), ["decToWidth"] = s(10), ["decToHeight"] = s(5) }, [3] = { ["width"] = calculateWidth(),
  8. don't wanna bother you guys, but can anyone help me in my problem. This is kinda strange just because the flag hasn't been displayed properly and i need to move the nicknames from every single player 2 pixels on the right. i've also tried to figure it out but without any luck. Can can anyone help me with this ? Thanks in advance.
  9. Here's a PM system if that's what u need it or from where to start : https://community.multitheftauto.com/index.php?p= ... ls&id=1562
  10. Now the flag's present, but it's somehow under the name (about 1/2 of flag is under player's name). How can i move to the right a little player's name ? I've tried this to add "+10" for k, v in ipairs( colorCodes ) do local firstCodePos = v[2] local secondCodePos = colorCodes[k+1] and colorCodes[k+1][2]-1 or #playerName if firstCodePos ~= 1 and k == 1 then local secondPos = firstCodePos-1 local firstPos = 1 local partOfName = string.sub( playerName, firstPos, secondPos ) local textLength = dxGetTextWidth( partOfName, fontscale(contentFont, s(1)), contentFont ) dxDrawText( partOfName, xPos+s(1)+10, y+s(1), topX+x+s(1+column.width), y+s(11)+dxGetFontHeight( fontscale(contentFont, scoreboardScale), contentFont ), tocolor( 0, 0, 0, a or 255 ), fontscale(contentFont, s(1)), contentFont, "left", "top", true, false, drawOverGUI ) dxDrawText( partOfName, xPos, y, topX+x+s(column.width), y+dxGetFontHeight( fontscale(contentFont, scoreboardScale), contentFont ), tocolor( r or 255, g or 255, b or 255, a or 255 ), fontscale(contentFont, s(1)), contentFont, "left", "top", true, false, drawOverGUI ) xPos = xPos + textLength but that's not working. Maybe the place where i've added it isn't right.
  11. Thank you again for your time / help. I've tried again to replace by myself what u've suggested. I found where names are rendered and tried to put the dxDrawImage before name rendering but the flag's not showing (yet again). Here's the modified code: flag function showcountry ( ) local flag = exports.admin:getPlayerCountry ( source ) or "N/A" if ( flag ) then setElementData ( source, "Name", { ":admin/client/images/flags/".. flag ..".png", flag } ) end end addEventHandler ( "onPlayerJoin", root, showcountry ) dxscoreboard_client -- THESE CAN BE CHANGED triggerKey = "tab" -- default button to open/close scoreboard settingsKey = "F7" -- default button to open the settings window drawOverGUI = true -- draw scoreboard over gui? seperationSpace = 80 -- the space between top/bottom screen and scoreboard top/bottom in pixels -- BUT DON'T TOUCH THESE scoreboardToggled = false scoreboardForced = false scoreboardDrawn = false forceScoreboardUpdate = false useAnimation = true scoreboardIsToggleable = false showServerInfo = false showGamemodeInfo = false showTeams = true useColors = true drawSpeed = 1 scoreboardScale = 1 teamHeaderFont = "clear" contentFont = "default-bold" columnFont = "default-bold" serverInfoFont = "default" rmbFont = "clear" cBlack = tocolor( 0, 0, 0 ) cWhite = tocolor( 255, 255, 255 ) cSettingsBox = tocolor( 255, 255, 255, 150 ) MAX_PRIRORITY_SLOT = 500 scoreboardColumns = {} resourceColumns = {} scoreboardDimensions = { ["width"] = 0, ["height"] = 0, ["phase"] = 1, ["lastSeconds"] = 0 } scoreboardTicks = { ["lastUpdate"] = 0, ["updateInterval"] = 500 } scoreboardContent = {} firstVisibleIndex = 1 sortBy = { ["what"] = "__NONE__", ["dir"] = -1 } -- -1 = dec, 1 = asc sbOutOffset, sbInOffset = 1, 1 sbFont = "clear" sbFontScale = 0.68 serverInfo = {} fontScale = { -- To make all fonts be equal in height ["default"] = 1.0, ["default-bold"] = 1.0, ["clear"] = 1.0, ["arial"] = 1.0, ["sans"] = 1.0, ["pricedown"] = 0.5, ["bankgothic"] = 0.5, ["diploma"] = 0.5, ["beckett"] = 0.5 } selectedRows = {} addEvent( "onClientPlayerScoreboardClick" ) addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), function ( resource ) cScoreboardBackground = tocolor( defaultSettings.bg_color.r, defaultSettings.bg_color.g, defaultSettings.bg_color.b, defaultSettings.bg_color.a ) cSelection = tocolor( defaultSettings.selection_color.r, defaultSettings.selection_color.g, defaultSettings.selection_color.b, defaultSettings.selection_color.a ) cHighlight = tocolor( defaultSettings.highlight_color.r, defaultSettings.highlight_color.g, defaultSettings.highlight_color.b, defaultSettings.highlight_color.a ) cHeader = tocolor( defaultSettings.header_color.r, defaultSettings.header_color.g, defaultSettings.header_color.b, defaultSettings.header_color.a ) cTeam = tocolor( defaultSettings.team_color.r, defaultSettings.team_color.g, defaultSettings.team_color.b, defaultSettings.team_color.a ) cBorder = tocolor( defaultSettings.border_color.r, defaultSettings.border_color.g, defaultSettings.border_color.b, defaultSettings.border_color.a ) cServerInfo = tocolor( defaultSettings.serverinfo_color.r, defaultSettings.serverinfo_color.g, defaultSettings.serverinfo_color.b, defaultSettings.serverinfo_color.a ) cContent = tocolor( defaultSettings.content_color.r, defaultSettings.content_color.g, defaultSettings.content_color.b, defaultSettings.content_color.a ) bindKey( triggerKey, "down", "Toggle scoreboard", "1" ) bindKey( triggerKey, "up", "Toggle scoreboard", "0" ) bindKey( settingsKey, "down", "Open scoreboard settings", "1" ) addEventHandler( "onClientRender", getRootElement(), drawScoreboard ) triggerServerEvent( "onClientDXScoreboardResourceStart", getRootElement() ) readScoreboardSettings() triggerServerEvent( "requestServerInfo", getRootElement() ) colorPicker.constructor() end ) addEventHandler( "onClientPlayerQuit", getRootElement(), function() selectedRows[source] = nil end ) function sendServerInfo( output ) serverInfo = output end addEvent( "sendServerInfo", true ) addEventHandler( "sendServerInfo", getResourceRootElement( getThisResource() ), sendServerInfo ) function toggleScoreboard( _, state ) state = iif( state == "1", true, false ) if scoreboardIsToggleable and state then scoreboardToggled = not scoreboardToggled elseif not scoreboardIsToggleable then scoreboardToggled = state end end addCommandHandler( "Toggle scoreboard", toggleScoreboard ) function openSettingsWindow() if scoreboardDrawn then local sX, sY = guiGetScreenSize() if not (windowSettings and isElement( windowSettings ) and guiGetVisible( windowSettings )) then createScoreboardSettingsWindow( sX-323, sY-350 ) showCursor( true ) elseif isElement( windowSettings ) then destroyScoreboardSettingsWindow() end end end addCommandHandler( "Open scoreboard settings", openSettingsWindow ) addCommandHandler( "scoreboard", function () scoreboardToggled = not scoreboardToggled end ) function iif( cond, arg1, arg2 ) if cond then return arg1 end return arg2 end function doDrawScoreboard( rtPass, onlyAnim, sX, sY ) if #scoreboardColumns ~= 0 then -- -- In/out animation -- local currentSeconds = getTickCount() / 1000 local deltaSeconds = currentSeconds - scoreboardDimensions.lastSeconds scoreboardDimensions.lastSeconds = currentSeconds deltaSeconds = math.clamp( 0, deltaSeconds, 1/25 ) if scoreboardToggled or scoreboardForced then local phases = { [1] = { ["width"] = s(10), ["height"] = s(5), ["incToWidth"] = s(10), ["incToHeight"] = s(5), ["decToWidth"] = 0, ["decToHeight"] = 0 }, [2] = { ["width"] = s(40), ["height"] = s(5), ["incToWidth"] = calculateWidth(), ["incToHeight"] = s(5), ["decToWidth"] = s(10), ["decToHeight"] = s(5) }, [3] = { ["width"] = calculateWidth(), ["height"] = s(30), ["incToWidth"] = calculateWidth(), ["incToHeight"] = calculateHeight(), ["decToWidth"] = calculateWidth(), ["decToHeight"] = s(5) } } if not useAnimation then scoreboardDimensions.width = calculateWidth() scoreboardDimensions.height = calculateHeight() scoreboardDimensions.phase = #phases end local maxChange = deltaSeconds * 30*drawSpeed local maxWidthDiff = math.clamp( -maxChange, phases[scoreboardDimensions.phase].incToWidth - scoreboardDimensions.width, maxChange ) local maxHeightDiff = math.clamp( -maxChange, phases[scoreboardDimensions.phase].incToHeight - scoreboardDimensions.height, maxChange ) if scoreboardDimensions.width < phases[scoreboardDimensions.phase].incToWidth then scoreboardDimensions.width = scoreboardDimensions.width + maxWidthDiff * phases[scoreboardDimensions.phase].width if scoreboardDimensions.width > phases[scoreboardDimensions.phase].incToWidth then scoreboardDimensions.width = phases[scoreboardDimensions.phase].incToWidth end elseif scoreboardDimensions.width > phases[scoreboardDimensions.phase].incToWidth and not scoreboardDrawn then scoreboardDimensions.width = scoreboardDimensions.width - maxWidthDiff * phases[scoreboardDimensions.phase].width if scoreboardDimensions.width < phases[scoreboardDimensions.phase].incToWidth then scoreboardDimensions.width = phases[scoreboardDimensions.phase].incToWidth end end if scoreboardDimensions.height < phases[scoreboardDimensions.phase].incToHeight then scoreboardDimensions.height = scoreboardDimensions.height + maxHeightDiff * phases[scoreboardDimensions.phase].height if scoreboardDimensions.height > phases[scoreboardDimensions.phase].incToHeight then scoreboardDimensions.height = phases[scoreboardDimensions.phase].incToHeight end elseif scoreboardDimensions.height > phases[scoreboardDimensions.phase].incToHeight and not scoreboardDrawn then scoreboardDimensions.height = scoreboardDimensions.height - maxHeightDiff * phases[scoreboardDimensions.phase].height if scoreboardDimensions.height < phases[scoreboardDimensions.phase].incToHeight then scoreboardDimensions.height = phases[scoreboardDimensions.phase].incToHeight end end if scoreboardDimensions.width == phases[scoreboardDimensions.phase].incToWidth and scoreboardDimensions.height == phases[scoreboardDimensions.phase].incToHeight then if phases[scoreboardDimensions.phase + 1] then scoreboardDimensions.phase = scoreboardDimensions.phase + 1 else if not scoreboardDrawn then bindKey( "mouse2", "both", showTheCursor ) bindKey( "mouse_wheel_up", "down", scrollScoreboard, -1 ) bindKey( "mouse_wheel_down", "down", scrollScoreboard, 1 ) addEventHandler( "onClientClick", getRootElement(), scoreboardClickHandler ) if not (windowSettings and isElement( windowSettings )) then showCursor( false ) end triggerServerEvent( "requestServerInfo", getRootElement() ) end scoreboardDrawn = true end end elseif scoreboardDimensions.width ~= 0 and scoreboardDimensions.height ~= 0 then local phases = { [1] = { ["width"] = s(10), ["height"] = s(5), ["incToWidth"] = s(10), ["incToHeight"] = s(5), ["decToWidth"] = 0, ["decToHeight"] = 0 }, [2] = { ["width"] = s(40), ["height"] = s(5), ["incToWidth"] = calculateWidth(), ["incToHeight"] = s(5), ["decToWidth"] = s(10), ["decToHeight"] = s(5) }, [3] = { ["width"] = calculateWidth(),
  12. Hmm I think a better option will be to render the flag just in front of the player's name. Where should I insert that dxDrawImage ?
  13. I think there's not a problem with the position but it's something with country script. For example, u suggested me to put this line after dxDrawImage (flag). dxDrawText ( tostring ( content [ 2 ] ), topX+theX + 5, y+s(1), 16, 11, cWhite, 1, "default", "right", "bottom", true, false, drawOverGUI ) There's an argument "tostring (content [2] ). How can scoreboard resource know to retrieve the country code as long as it's noting related to. For me it's kinda ambiguous. I think i need to make a modification also in country resource just because it's a 3rd party component. country resource : -- IMPORTANT: If you don't want to read this just don't read it -- and please if you change the script, keep my credits. --[[ ****************************************** * * PROJECT: Country ID Project v1.1.1 * * Made by: Timic * Thanks to: lil_Toady * ****************************************** >> Description "Hello, thanks for using this resource, I'm very glad to update it to 1.1 and improve it I'll still continue this project, so report every bug on the community." ========================================== >> Installation Just open countryid.zip and then you'll have to insert it into a folder, so create a folder called countryid and then put files into the folder you created. You'll also have to put this folder into "<HARD DISK>:\Program Files\<Your MTA folder>\server\mods\deathmatch\resources\" folder. If your server was running at the time of installation, just type: refresh in console or /refresh in chat box. Of course you must be logged in as admin to use these commands. IMPORTANT: Of course you'll have to put it in the ACL.xml file. (ACL means Access Control List) Example: a) Open ACL.XML b) Add after <group name="Admin"> the following line c) <object name="resource.CountryID" /> d) Save it e) Restart the server f) Type in console refresh or type /refresh in chatbox g) Start it (Type in console start or type /start in chatbox) ========================================== >> LICENCE NO WARRANTY THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY WARRANTY. IT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. ]] g_Root = getRootElement() function Initiate() country = getPlayerCountry(source) if country == nil or country == false then country = "n/a" end setElementData(source, "country", country) end addEventHandler('onPlayerJoin', g_Root, Initiate) addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),function() -- You can remove this if you want outputChatBox('#ffffff[C_ID] #ffff00Initiating CID system... #ffffffDONE', getRootElement(), 255, 100, 100, true) call(getResourceFromName("scoreboard"),"addScoreboardColumn","country", getRootElement(), 9, 50) setTimer( function() country = getPlayerCountry(source) if country == nil or country == false then country = "n/a" end setElementData(source, "country", country) end, 4000, 1) end ) aCountries = {} function getPlayerCountry ( player ) return getIpCountry ( getPlayerIP ( player ) ) end function getIpCountry ( ip ) local ip_group = tonumber ( gettok ( ip, 1, 46 ) ) local ip_code = ( gettok ( ip, 1, 46 ) * 16777216 ) + ( gettok ( ip, 2, 46 ) * 65536 ) + ( gettok ( ip, 3, 46 ) * 256 ) + ( gettok ( ip, 4, 46 ) ) if ( #aCountries == 0 ) then loadIPGroups () end if ( not aCountries[ip_group] ) then aCountries[ip_group] = {} end for id, group in ipairs ( aCountries[ip_group] ) do if ( ( group.rstart <= ip_code ) and ( ip_code <= group.rend ) ) then return group.rcountry end end return false end -- Load all IP groups from "conf/IpToCountryCompact.csv" function loadIPGroups () unrelPosReset() local readFilename = "conf/IpToCountryCompact.csv"; local hReadFile = fileOpen( readFilename, true ) if not hReadFile then outputHere ( "Cannot read " .. readFilename ) return end local buffer = "" while true do local endpos = string.find(buffer, "\n") -- If can't find CR, try to load more from the file if not endpos then if fileIsEOF( hReadFile ) then break end buffer = buffer .. fileRead( hReadFile, 500 ) end if endpos then -- Process line local line = string.sub(buffer, 1, endpos - 1) buffer = string.sub(buffer, endpos + 1) local parts = split( line, string.byte(',') ) if #parts > 2 then local rstart = tonumber(parts[1]) local rend = tonumber(parts[2]) local rcountry = parts[3] -- Relative to absolute numbers rstart = unrelRange ( rstart ) rend = unrelRange ( rend ) local group = math.floor( rstart / 0x1000000 ) if not aCountries[group] then aCountries[group] = {} end local count = #aCountries[group] + 1 aCountries[group][count] = {} aCountries[group][count].rstart = rstart aCountries[group][count].rend = rend aCountries[group][count].rcountry = rcountry end end end fileClose(hReadFile) end -- Make a stream of absolute numbers relative to each other local relPos = 0 function relPosReset() relPos = 0 end function relRange( v ) local rel = v - relPos relPos = v return rel end -- Make a stream of relative numbers absolute local unrelPos = 0 function unrelPosReset() unrelPos = 0 end function unrelRange( v ) local unrel = v + unrelPos unrelPos = unrel return unrel end -- IP2C logging function outputHere( msg ) --outputServerLog ( msg ) outputChatBox ( msg ) end ---------------------------------------------------------------------------------------- -- -- Set to true to enable commands "makecsv" and "iptest" -- ---------------------------------------------------------------------------------------- local makeAndTestCompactCsv = false if makeAndTestCompactCsv then local makeCor -- Takes a 'IPV4 CSV' file sourced from [url=http://software77.net/geo-ip/]http://software77.net/geo-ip/[/url] -- and makes a smaller one for use by Admin addCommandHandler ( "makecsv", function () local status = makeCor and coroutine.status(makeCor) if (status == "suspended") then outputHere( "Please wait" ) return end makeCor = coroutine.create ( makeCompactCsvWorker ) coroutine.resume ( makeCor ) end ) function makeCompactCsvWorker () outputHere ( "makeCompactCsv started" ) relPosReset() local readFilename = "conf/IpToCountry.csv"; local hReadFile = fileOpen( readFilename, true ) if not hReadFile then outputHere ( "Cannot read " .. readFilename ) return end local writeFilename = "conf/IpToCountryCompact.csv";
  14. No, it's working only the image (flag). The text isn't shown.
  15. h4x7o0r

    Question

    Open Race.zip (race resource) and go to "model" there you have nitro / repair / vehiclechange .dffs + .txds. Replace them with yours.
  16. oh just noticed that the error is on dxDrawImage not dxDrawText. So sorry, that's my bad. Thank you for your time and help.
  17. Yes the image (flag) is present but no text.
  18. yes, that's what it says to me. But i think country resource should be modified because i can see the flag but can't see the name of the country [uS_FLAG US} for example.
  19. WARNING: scoreboard\dxscoreboard_client.lua:719: Bad argument @'dxDrawText' [Expected material at argument 5, got nil] same
  20. WARNING: scoreboard\dxscoreboard_client.lua:719: Bad argument @'dxDrawText' [Expected material at argument 5, got nil] Hmm , but should modify the country resource ? i'm asking u because the flag was present before and only country text need to appear.
  21. WARNING: scoreboard\dxscoreboard_client.lua:720: Bad argument @'dxDrawText' [Expected number at argument 5, got boolean] WARNING : scoreboard\dxscoreboard_client.lua:720: Bad argument @ 'getElementData' [Expected element at argument 1, got nil]
×
×
  • Create New...