Jump to content

downight

Members
  • Posts

    48
  • Joined

  • Last visited

Everything posted by downight

  1. Thanks guys but I really don't want to do this by myself since I'm not rly good at scripting.
  2. Whoever can do this give me your skype etc and i'll pay you via paypal
  3. Seben made it already for me.
  4. I can pay 5$ via paypal to someone who can put this image: http://www.speedyshare.com/W9dqP/logodon.png to my scoreboard and help me align it.
  5. I don't want to replace anything. I just want to add an image logo to scoreboard.
  6. How to add an image so it opens and closes when you press TAB? My code: -- 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 } customFont = "default-bold" fontScaleRace = 5 colorCode = {128,255,0} 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" ) local resource = getResourceFromName("race") if resource then customFont,fontScaleRace,colorCode = call(resource,"getRaceSettings") if not customFont then customFont = "default-bold" end if not customFont then customFont = "default-bold" end if not fontScaleRace then fontScaleRace = 5 end if not colorCode then colorCode = {128,255,0} end end addEventHandler( "onClientRender", getRootElement(), drawScoreboard ) triggerServerEvent( "onClientDXScoreboardResourceStart", getRootElement() ) readScoreboardSettings() triggerServerEvent( "requestServerInfo", localPlayer ) colorPicker.constructor() end ) function updateCustomSettings(customFontRace,fontScaleRaceRace,colorCodeRace) customFont,fontScaleRace,colorCode = customFontRace,fontScaleRaceRace,colorCodeRace readScoreboardSettings() end addEvent("onRaceWantUpdateInterfaceData",true) addEventHandler("onRaceWantUpdateInterfaceData",getRootElement(),updateCustomSettings) addEventHandler( "onClientPlayerQuit", getRootElement(), function() selectedRows[source] = nil end ) function sendServerInfo( output ) serverInfo = output end addEvent( "sendServerInfo", true ) addEventHandler( "sendServerInfo", getRootElement(), 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 getElementData(localPlayer,"loginState") then return end 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),
  7. Hi, I have two rectangles and I want them to be on the center of the screen on different resolutions e.g. I have it on center on 1600x900 but when I change res to other the rectangles move. How do I keep them on center? Code: font = guiCreateFont("font.ttf", 10) fonttimes = guiCreateFont("font.ttf", 9) -- -- toptimes_client.lua -- Created = {} CToptimes = {} CToptimes.__index = CToptimes CToptimes.instances = {} g_Settings = {} serverInfo = {} px = 0 sX,sY = guiGetScreenSize() toptimes = { anim = 360, size = {380,20}, mapname = "N/A", label = {"Empty","Empty","Empty","Empty","Empty","Empty","Empty","Empty","Empty","Empty","Empty"}, time = {"","","","","","","","","","",""}, data = {"","","","","","","","","","",""}, country = {"","","","","","","","","","",""}, personal = {false,pos = 9,name="",time="",data="",country=""}, state = false, animState = "closed", tick = getTickCount() } function drawToptimesIntreface() if toptimes.animState == "closed" then local tick = getTickCount() - toptimes.tick local progress = tick/1000 toptimes.anim = interpolateBetween(0,0,0,390,0,0,progress,"InOutBack") else local tick = getTickCount() - toptimes.tick local progress = tick/1000 toptimes.anim = interpolateBetween(390,0,0,0,0,0,progress,"OutBounce") end local clanColor = {128,255,0} if toptimes.state then local sX = sX+toptimes.anim dxDrawRectangle(sX-toptimes.size[1]-980,(sY/300)-(toptimes.size[2]),toptimes.size[1],200/8,tocolor(128,255,0,200)) dxDrawRectangle(sX-toptimes.size[1]-980,(sY/300)-(toptimes.size[2])+(200/8),toptimes.size[1],toptimes.size[2],tocolor(15,15,15,150)) for i=1,1 do dxDrawText(i..") "..toptimes.label[i],sX-toptimes.size[1]+(toptimes.size[1]*0.03)-980,(sY/300)-(toptimes.size[2])+(200/8)+((i-1)*20),sX-(toptimes.size[1]*0.1)-10,(sY/300)-(toptimes.size[2])+(200/8)+((i)*20),tocolor(255,255,255,255),1,"default-bold","left","center",true,false,false,true) dxDrawText(toptimes.time[i],sX-toptimes.size[1]+(toptimes.size[1]*0.52)-980,(sY/300)-(toptimes.size[2])+(200/8)+((i-1)*20),sX-(toptimes.size[1]*0.1)-10,(sY/300)-(toptimes.size[2])+(200/8)+((i)*20),tocolor(255,255,255,255),1,"default-bold","left","center",true,false,false,true) if toptimes.country[i] ~= "" then if fileExists(":admin/client/images/flags/"..toptimes.country[i]..".png") then dxDrawImage(sX-toptimes.size[1]+(toptimes.size[1]*0.75)-980,(sY/300)-(toptimes.size[2])+(200/8)+((i-1)*20)+3,16,11,":admin/client/images/flags/"..toptimes.country[i]..".png",tocolor(255,255,255,255)) dxDrawText(toptimes.country[i],sX-toptimes.size[1]+(toptimes.size[1]*0.75)-960,(sY/300)-(toptimes.size[2])+(200/8)+((i-1)*20),sX-(toptimes.size[1]*0.1)-10,(sY/300)-(toptimes.size[2])+(200/8)+((i)*20),tocolor(255,255,255,255),1,"default-bold","left","center",true,false,false,true) dxDrawImage(sX-toptimes.size[1]+(toptimes.size[1]*0.75)-940,(sY/300)-(toptimes.size[2])+(200/8)+((i-1)*20)+1,18,18,":record_on_map/1.png",tocolor(255,255,255,255)) dxDrawImage(sX-toptimes.size[1]+(toptimes.size[1]*0.75)-1272,(sY/300)-(toptimes.size[2])+(200/8)+((i-1)*20)+1,50,30,":record_on_map/2.png",tocolor(255,255,255,255)) end end end end end addEventHandler("onClientRender",getRootElement(),drawToptimesIntreface) --------------------------------------------------------------------------- -- Client -- Handle events from Race -- -- This is the 'interface' from Race -- --------------------------------------------------------------------------- addEventHandler('onClientResourceStart', g_ResRoot, function() triggerServerEvent('onLoadedAtClient_tt', g_Me) topTimePersonalLabel = false chatBlock = false end ) addEvent('onClientMapStarting', true) addEventHandler('onClientMapStarting', getRootElement(), function(mapinfo) outputDebug( 'TOPTIMES', 'onClientMapStarting' ) if g_CToptimes then g_CToptimes:onMapStarting(mapinfo) chatBlock = false end end ) addEvent('onClientMapStopping', true) addEventHandler('onClientMapStopping', getRootElement(), function() outputDebug( 'TOPTIMES', 'onClientMapStopping' ) if g_CToptimes then g_CToptimes:onMapStopping() end end ) addEvent('onClientPlayerFinish', true) addEventHandler('onClientPlayerFinish', getRootElement(), function() outputDebug( 'TOPTIMES', 'onClientPlayerFinish' ) if g_CToptimes then openToptimes() setTimer(closeToptimes,12000,1) end end ) addEvent('onClientSetMapName', true) addEventHandler('onClientSetMapName', getRootElement(), function(manName) if g_CToptimes then g_CToptimes:setWindowTitle(manName) end end ) function updateSettings(settings, playeradmin) end --------------------------------------------------------------------------- -- -- CToptimes:create() -- -- -- --------------------------------------------------------------------------- function CToptimes:create() local id = #CToptimes.instances + 1 CToptimes.instances[id] = setmetatable( { id = id, hasTimes = false }, self ) return CToptimes.instances[id] end function CToptimes:setWindowTitle( mapName ) toptimes.mapname = mapName end function string.findIgnoreCase(haystack,needle) return string.find(string.lower(haystack),string.lower(needle),1,true) end function CToptimes:onMapStarting(mapinfo) self:setWindowTitle( mapinfo.name ) self.hasTimes = true if self.hasTimes then self:doToggleToptimes( true ) openToptimes() setTimer(closeToptimes,12000,1) else self:doToggleToptimes( false ) closeToptimes() end end function CToptimes:onMapStopping() self:setWindowTitle( '' ) closeToptimes() end function CToptimes:doAutoShow() self.bAutoShow = true self:updateShow() end function CToptimes:updateShow(bOn) self:enableToptimeUpdatesFromServer(bOn) end function CToptimes:enableToptimeUpdatesFromServer( bOn ) triggerServerEvent('onClientRequestToptimesUpdates', g_Me, bOn, self.clientRevision ) end function CToptimes:doOnServerSentToptimes( data, serverRevision, playerPosition ) toptimes.personal[1] = false for i=1,1 do toptimes.label[i] = data[i].playerName local timeText = data[i].timeText if timeText:sub(1,1) == '0' then timeText = ' ' .. timeText:sub(2) end toptimes.time[i] = timeText toptimes.data[i] = string.sub(data[i].dateRecorded,1,10) toptimes.country[i] = data[i].country end if playerPosition then if not chatBlock then chatBlock = true end if playerPosition > 8 then toptimes.personal[1] = true toptimes.personal.pos = playerPosition toptimes.personal.name = data[playerPosition].playerName local timeText = data[playerPosition].timeText if timeText:sub(1,1) == '0' then timeText = ' ' .. timeText:sub(2) end toptimes.personal.time = timeText toptimes.personal.data = string.sub(data[playerPosition].dateRecorded,1,10) toptimes.personal.country = data[playerPosition].extra end end if not chatBlock then chatBlock = true end end function onServerSentToptimes( data, serverRevision, playerPosition ) g_CToptimes:doOnServerSentToptimes( data, serverRevision, playerPosition ) end function CToptimes:doToggleToptimes(bOn) self:updateShow(bOn) toptimes.state = bOn end --------------------------------------------------------------------------- -- Global instance --------------------------------------------------------------------------- g_CToptimes = CToptimes:create()
  8. Hi, I have two rectangles and I want them to be on the center of the screen on different resolutions e.g. I have it on center on 1600x900 but when I change res to other the rectangles move. How do I keep them on center? Code: font = guiCreateFont("font.ttf", 10) fonttimes = guiCreateFont("font.ttf", 9) -- -- toptimes_client.lua -- Created = {} CToptimes = {} CToptimes.__index = CToptimes CToptimes.instances = {} g_Settings = {} serverInfo = {} px = 0 sX,sY = guiGetScreenSize() toptimes = { anim = 360, size = {380,20}, mapname = "N/A", label = {"Empty","Empty","Empty","Empty","Empty","Empty","Empty","Empty","Empty","Empty","Empty"}, time = {"","","","","","","","","","",""}, data = {"","","","","","","","","","",""}, country = {"","","","","","","","","","",""}, personal = {false,pos = 9,name="",time="",data="",country=""}, state = false, animState = "closed", tick = getTickCount() } function drawToptimesIntreface() if toptimes.animState == "closed" then local tick = getTickCount() - toptimes.tick local progress = tick/1000 toptimes.anim = interpolateBetween(0,0,0,390,0,0,progress,"InOutBack") else local tick = getTickCount() - toptimes.tick local progress = tick/1000 toptimes.anim = interpolateBetween(390,0,0,0,0,0,progress,"OutBounce") end local clanColor = {128,255,0} if toptimes.state then local sX = sX+toptimes.anim dxDrawRectangle(sX-toptimes.size[1]-980,(sY/300)-(toptimes.size[2]),toptimes.size[1],200/8,tocolor(128,255,0,200)) dxDrawRectangle(sX-toptimes.size[1]-980,(sY/300)-(toptimes.size[2])+(200/8),toptimes.size[1],toptimes.size[2],tocolor(15,15,15,150)) for i=1,1 do dxDrawText(i..") "..toptimes.label[i],sX-toptimes.size[1]+(toptimes.size[1]*0.03)-980,(sY/300)-(toptimes.size[2])+(200/8)+((i-1)*20),sX-(toptimes.size[1]*0.1)-10,(sY/300)-(toptimes.size[2])+(200/8)+((i)*20),tocolor(255,255,255,255),1,"default-bold","left","center",true,false,false,true) dxDrawText(toptimes.time[i],sX-toptimes.size[1]+(toptimes.size[1]*0.52)-980,(sY/300)-(toptimes.size[2])+(200/8)+((i-1)*20),sX-(toptimes.size[1]*0.1)-10,(sY/300)-(toptimes.size[2])+(200/8)+((i)*20),tocolor(255,255,255,255),1,"default-bold","left","center",true,false,false,true) if toptimes.country[i] ~= "" then if fileExists(":admin/client/images/flags/"..toptimes.country[i]..".png") then dxDrawImage(sX-toptimes.size[1]+(toptimes.size[1]*0.75)-980,(sY/300)-(toptimes.size[2])+(200/8)+((i-1)*20)+3,16,11,":admin/client/images/flags/"..toptimes.country[i]..".png",tocolor(255,255,255,255)) dxDrawText(toptimes.country[i],sX-toptimes.size[1]+(toptimes.size[1]*0.75)-960,(sY/300)-(toptimes.size[2])+(200/8)+((i-1)*20),sX-(toptimes.size[1]*0.1)-10,(sY/300)-(toptimes.size[2])+(200/8)+((i)*20),tocolor(255,255,255,255),1,"default-bold","left","center",true,false,false,true) dxDrawImage(sX-toptimes.size[1]+(toptimes.size[1]*0.75)-940,(sY/300)-(toptimes.size[2])+(200/8)+((i-1)*20)+1,18,18,":record_on_map/1.png",tocolor(255,255,255,255)) dxDrawImage(sX-toptimes.size[1]+(toptimes.size[1]*0.75)-1272,(sY/300)-(toptimes.size[2])+(200/8)+((i-1)*20)+1,50,30,":record_on_map/2.png",tocolor(255,255,255,255)) end end end end end addEventHandler("onClientRender",getRootElement(),drawToptimesIntreface) --------------------------------------------------------------------------- -- Client -- Handle events from Race -- -- This is the 'interface' from Race -- --------------------------------------------------------------------------- addEventHandler('onClientResourceStart', g_ResRoot, function() triggerServerEvent('onLoadedAtClient_tt', g_Me) topTimePersonalLabel = false chatBlock = false end ) addEvent('onClientMapStarting', true) addEventHandler('onClientMapStarting', getRootElement(), function(mapinfo) outputDebug( 'TOPTIMES', 'onClientMapStarting' ) if g_CToptimes then g_CToptimes:onMapStarting(mapinfo) chatBlock = false end end ) addEvent('onClientMapStopping', true) addEventHandler('onClientMapStopping', getRootElement(), function() outputDebug( 'TOPTIMES', 'onClientMapStopping' ) if g_CToptimes then g_CToptimes:onMapStopping() end end ) addEvent('onClientPlayerFinish', true) addEventHandler('onClientPlayerFinish', getRootElement(), function() outputDebug( 'TOPTIMES', 'onClientPlayerFinish' ) if g_CToptimes then openToptimes() setTimer(closeToptimes,12000,1) end end ) addEvent('onClientSetMapName', true) addEventHandler('onClientSetMapName', getRootElement(), function(manName) if g_CToptimes then g_CToptimes:setWindowTitle(manName) end end ) function updateSettings(settings, playeradmin) end --------------------------------------------------------------------------- -- -- CToptimes:create() -- -- -- --------------------------------------------------------------------------- function CToptimes:create() local id = #CToptimes.instances + 1 CToptimes.instances[id] = setmetatable( { id = id, hasTimes = false }, self ) return CToptimes.instances[id] end function CToptimes:setWindowTitle( mapName ) toptimes.mapname = mapName end function string.findIgnoreCase(haystack,needle) return string.find(string.lower(haystack),string.lower(needle),1,true) end function CToptimes:onMapStarting(mapinfo) self:setWindowTitle( mapinfo.name ) self.hasTimes = true if self.hasTimes then self:doToggleToptimes( true ) openToptimes() setTimer(closeToptimes,12000,1) else self:doToggleToptimes( false ) closeToptimes() end end function CToptimes:onMapStopping() self:setWindowTitle( '' ) closeToptimes() end function CToptimes:doAutoShow() self.bAutoShow = true self:updateShow() end function CToptimes:updateShow(bOn) self:enableToptimeUpdatesFromServer(bOn) end function CToptimes:enableToptimeUpdatesFromServer( bOn ) triggerServerEvent('onClientRequestToptimesUpdates', g_Me, bOn, self.clientRevision ) end function CToptimes:doOnServerSentToptimes( data, serverRevision, playerPosition ) toptimes.personal[1] = false for i=1,1 do toptimes.label[i] = data[i].playerName local timeText = data[i].timeText if timeText:sub(1,1) == '0' then timeText = ' ' .. timeText:sub(2) end toptimes.time[i] = timeText toptimes.data[i] = string.sub(data[i].dateRecorded,1,10) toptimes.country[i] = data[i].country end if playerPosition then if not chatBlock then chatBlock = true end if playerPosition > 8 then toptimes.personal[1] = true toptimes.personal.pos = playerPosition toptimes.personal.name = data[playerPosition].playerName local timeText = data[playerPosition].timeText if timeText:sub(1,1) == '0' then timeText = ' ' .. timeText:sub(2) end toptimes.personal.time = timeText toptimes.personal.data = string.sub(data[playerPosition].dateRecorded,1,10) toptimes.personal.country = data[playerPosition].extra end end if not chatBlock then chatBlock = true end end function onServerSentToptimes( data, serverRevision, playerPosition ) g_CToptimes:doOnServerSentToptimes( data, serverRevision, playerPosition ) end function CToptimes:doToggleToptimes(bOn) self:updateShow(bOn) toptimes.state = bOn end --------------------------------------------------------------------------- -- Global instance --------------------------------------------------------------------------- g_CToptimes = CToptimes:create()
  9. OMG I just had to put resource.admin in acl.xml WTF. I just randomly added it and it worked. Damn sorry for double post.
  10. I think I have to add this resource to acl right? So i have to restart server...cuz cant access acl panel when on server...
  11. Commands work but it doesn't from panel
  12. SOMEONE HELP ME PLS I CAN GIVE YOU MONEY VIA PAYPAL! Hi, the resource panel on my server stopped working (its hosted). I can't stop or start any resource. This is how it looks on local which is OK: And here is my hosted server: Anyone knows what's happening? Also tried this: https://code.google.com/p/mtasa-resourc ... loads/list but still doesn't work
  13. So I edited race_toptimes by myself and it works. Topic closed.
  14. Thanks for nice bump dude (: Anyone knows how to do it?
  15. Hi I'm wondering how to show this R on screen with nick and time. Is it edited code from race_toptimes or what?
  16. I didn't think of that lol Thanks man ^^
  17. Nice, works But you know how to add shadow? I want to add a slight shadow to the text. I used: type("shadow", 1, 0, 0, 0, 255). But doesn't work tho
  18. Nvm for now. This ping code works good but I want "ping" text white and "ping number" 128,255,0 function DXdraw() --Variables local screenWidth, screenHeight = guiGetScreenSize ( ) setTimer(function() triggerServerEvent("online",getLocalPlayer()) end, 10000, 1, true) local ping = getPlayerPing ( getLocalPlayer(), "ping2") ping2= ' Ping:' ..ping dxDrawText(tostring(ping2),0, screenHeight - 190, screenWidth, screenHeight,tocolor(128,255,0),0.7,"bankgothic") end addEventHandler("onClientRender", getRootElement(), DXdraw)
  19. I have FPS script but in race.zip and it works fine. So could you help me edit it?
  20. Your code doesn't work either for me :3
  21. I don't know. How bad is it? I mean, does it slowdown the server or what?
  22. Hi, I want to show ping on screen. I've made code but doesn't work since I'm learning how to script Please help me function DXdraw() --Variables local screenWidth, screenHeight = guiGetScreenSize ( ) setTimer(function() triggerServerEvent("online",getLocalPlayer()) end, 10000, 1, true) local ping = getPlayerPing ( getLocalPlayer(), "ping") g_dxGUI = { ping = dxText:create("PING: ", screenWidth - 202,screenHeight - 86, false, 'bankgothic', 0.7), pingNumber = dxText:create(..ping, screenWidth - 150,screenHeight - 86, false, 'bankgothic', 0.7) } g_dxGUI.ping:color(255, 255, 255, 255) g_dxGUI.pingNumber:color(128,255,0,255) g_dxGUI.ping:type("shadow", 1, 0, 0, 0, 255) g_dxGUI.pingNumber:type("shadow", 1, 0, 0, 0, 255) end addEventHandler("onClientRender", getRootElement(), DXdraw) local pingEnabled = true function ping() if pingEnabled then g_dxGUI.ping:visible(false) g_dxGUI.pingNumber:visible(false) pingEnabled = false else g_dxGUI.pingEnabled = true g_dxGUI.ping:visible(true) g_dxGUI.pingNumber:visible(true) end end addCommandHandler("ping", ping, false, false)
  23. WHy I haven't thought of that lol. Works like a charm THANKS!
  24. No errors. When I press F9 the guiwindow doesn't even show up with your code. With my code it shows up the guiwindow and the button. You can click on the button but doesnt do anything. Also tried Jacobob14's code - doesn't work since I tried the same thing before.
×
×
  • Create New...