SuleymanM Posted April 12, 2013 Share Posted April 12, 2013 Hi all, One problem ... When i enter first from the server Loading nextmap and no spawn ... Window is black... I modify server_client.LUA Link to comment
PaiN^ Posted April 12, 2013 Share Posted April 12, 2013 Well, Show us what you have done .. Link to comment
Turky1 Posted April 12, 2013 Share Posted April 12, 2013 Hi all,One problem ... When i enter first from the server Loading nextmap and no spawn ... Window is black... I modify server_client.LUA That has happend to me before. Link to comment
SuleymanM Posted April 12, 2013 Author Share Posted April 12, 2013 (edited) Look original script : Edited April 12, 2013 by Guest Link to comment
SuleymanM Posted April 12, 2013 Author Share Posted April 12, 2013 How to modify this for show only "Map: " with code #00FF00 ? --- race_client.LUA (40%) g_Root = getRootElement() g_ResRoot = getResourceRootElement(getThisResource()) g_Me = getLocalPlayer() g_ArmedVehicleIDs = table.create({ 425, 447, 520, 430, 464, 432 }, true) g_WaterCraftIDs = table.create({ 539, 460, 417, 447, 472, 473, 493, 595, 484, 430, 453, 452, 446, 454 }, true) g_ModelForPickupType = { nitro = 2221, repair = 2222, vehiclechange = 2223 } g_HunterID = 425 local localPlayer = getLocalPlayer() local root = getRootElement() local resRoot = getResourceRootElement(getThisResource()) g_Checkpoints = {} g_Pickups = {} g_VisiblePickups = {} g_Objects = {} fontX = nil sW, sH = guiGetScreenSize() addEventHandler('onClientResourceStart', g_ResRoot, function() g_Players = getElementsByType('player') serkanfont = guiCreateFont("serkanfont.ttf",sH*(sH/(sH*90))) serkanfontx = guiCreateFont("serkanfont.ttf",sH*(sH/(sH*50))) fadeCamera(false,0.0) -- create GUI g_PickupStartTick = getTickCount() local screenWidth, screenHeight = guiGetScreenSize() local fonts = relativeScale(screenHeight) fontX = dxGetFontHeight(fonts, 'bankgothic') g_dxGUI = { --ranknum = dxText:create('1', screenWidth - 60, screenHeight - 95, false, 'bankgothic', 2, 'right'), --ranksuffix = dxText:create('st', screenWidth - 40, screenHeight - 86, false, 'bankgothic', 1), checkpoint = dxText:create('0/0', screenWidth - 15, screenHeight - 54, false, 'bankgothic', 0.8, 'right'), --timepassed = dxText:create('0:00:00', screenWidth - 10, screenHeight - 25, false, 'bankgothic', 0.7, 'right'), mapdisplay = dxText:create('#00FF00M#00FF00ap: #FFFFFFnone', 2, screenHeight - fontX/2, false, 'default-bold', fonts*2, 'left'), nextmapdisplay = dxText:create('#00FF00Next Map: #ffffffNoNE...', 2, screenHeight - fontX/2, false, 'default-bold', fonts*2, 'left') } } fps:type('shadow', 1, 0, 0, 0, 175) --fps:colorCoded(true) spectators:type('shadow', 1, 0, 0, 0, 175) --spectators:colorCoded(true) --g_dxGUI.ranknum:type('stroke', 2, 0, 0, 0, 255) --g_dxGUI.ranksuffix:type('stroke', 2, 0, 0, 0, 255) g_dxGUI.checkpoint:type('stroke', 1, 0, 0, 0, 255) --g_dxGUI.timepassed:type('stroke', 1, 0, 0, 0, 255) g_dxGUI.mapdisplay:type('shadow', 1, 0, 0, 0, 175) --g_dxGUI.mapdisplay:colorCoded(true) g_dxGUI.nextmapdisplay:type('shadow', 1, 0, 0, 0, 175) --g_dxGUI.nextmapdisplay:colorCoded(true) g_dxGUI.nextmapdisplay:visible(false) g_GUI = { timeleftbg = guiCreateStaticImage(screenWidth/2-65, 0, 165, 50, 'img/timeleft.png', false, nil), timeleft = guiCreateLabel(screenWidth/2-70, 24, 100, 30, '', false), timepassed = guiCreateLabel(screenWidth/2+38, 24, 100, 30, '', false), healthbar = FancyProgress.create(250, 1000, 'img/progress_health_bg.png', -60, 90, 170, 30, 'img/progress_health.png', 54, 8, 108, 16), } guiSetFont(g_GUI.timeleft, serkanfont) guiSetFont(g_GUI.timepassed, serkanfont) guiSetFont(g_GUI.clienttime, serkanfontx) guiSetText(g_GUI.clienttime, getServerTime()[2]) guiLabelSetHorizontalAlign(g_GUI.timeleft, 'left') guiLabelSetHorizontalAlign(g_GUI.timeleft, 'left') --guiSetFont(g_GUI.timepassed, 'default-bold-small') guiLabelSetHorizontalAlign(g_GUI.timepassed, 'left') --g_GUI.speedbar:setProgress(0) guiSetAlpha(g_GUI.timeleftbg, 0) guiSetAlpha(g_GUI.timepassed, 0) guiSetAlpha(g_GUI.timeleft, 0) guiSetAlpha(g_GUI.clienttime, 0) --hideGUIComponents('timeleftbg', 'timeleft', --[['healthbar']] 'checkpoint', 'timepassed', 'clienttime') --Animation.createAndPlay(g_GUI.clienttime, Animation.presets.guiFadeIn(2000)) --guiSetSlowVisible( g_GUI.clienttime, false) RankingBoard.precreateLabels(10) -- set update handlers addEventHandler('onClientRender', g_Root, updateBars) g_WaterCheckTimer = setTimer(checkWater, 1000, 0) -- load pickup models and textures for name,id in pairs(g_ModelForPickupType) do engineImportTXD(engineLoadTXD('model/' .. name .. '.txd'), id) engineReplaceModel(engineLoadDFF('model/' .. name .. '.dff', id), id) -- Double draw distance for pickups engineSetModelLODDistance( id, 60 ) end if isVersion101Compatible() then -- Dont clip vehicles (1.0.1 function) setCameraClip ( true, false ) end -- Init presentation screens TravelScreen.init() TitleScreen.init() -- Show title screen now TitleScreen.show() setPedCanBeKnockedOffBike(g_Me, false) --addEventHandler("onClientRender", getRootElement(), updateFPS) --addEventHandler("onClientRender", getRootElement(), updateSpecs) end ) ------------------------------------------------------- -- Title screen - Shown when player first joins the game ------------------------------------------------------- TitleScreen = {} TitleScreen.startTime = 0 function TitleScreen.init() local screenWidth, screenHeight = guiGetScreenSize() local adjustY = math.clamp( -30, -15 + (-30- -15) * (screenHeight - 480)/(900 - 480), -15 ); g_GUI['titleImage'] = guiCreateStaticImage(screenWidth/2-256, screenHeight/2-256+adjustY, 512, 512, 'img/title.png', false) --g_dxGUI['titleText1'] = dxText:create('', 30, screenHeight-67, false, 'bankgothic', 0.70, 'left' ) --g_dxGUI['titleText2'] = dxText:create('', 120, screenHeight-67, false, 'bankgothic', 0.70, 'left' ) --g_dxGUI['titleText1']:text( 'KEYS: \n' .. --[[ 'F4 \n' .. 'F5 \n' .. 'ENTER' ) --g-_dxGUI['titleText2']:text( '\n' .. '- TRAFFIC ARROWS \n' .. '- TOP TIMES \n' .. '- RETRY' ) --hideGUIComponents('titleImage','titleText1','titleText2')]]-- end function TitleScreen.show() showGUIComponents('titleImage'--[['titleText1','titleText2']]) guiMoveToBack(g_GUI['titleImage']) TitleScreen.startTime = getTickCount() TitleScreen.bringForward = 0 addEventHandler('onClientRender', g_Root, TitleScreen.update) end function TitleScreen.update() local secondsLeft = TitleScreen.getTicksRemaining() / 1000 local alpha = math.min(1,math.max( secondsLeft ,0)) guiSetAlpha(g_GUI['titleImage'], alpha) -- g_dxGUI['titleText1']:color(220,220,220,255*alpha) --g_dxGUI['titleText2']:color(220,220,220,255*alpha) if alpha == 0 then hideGUIComponents('titleImage'--[[,'titleText1','titleText2']]) removeEventHandler('onClientRender', g_Root, TitleScreen.update) end end function TitleScreen.getTicksRemaining() return math.max( 0, TitleScreen.startTime - TitleScreen.bringForward + 10000 - getTickCount() ) end -- Start the fadeout as soon as possible function TitleScreen.bringForwardFadeout(maxSkip) local ticksLeft = TitleScreen.getTicksRemaining() local bringForward = ticksLeft - 1000 outputDebug( 'MISC', 'bringForward ' .. bringForward ) if bringForward > 0 then TitleScreen.bringForward = math.min(TitleScreen.bringForward + bringForward,maxSkip) outputDebug( 'MISC', 'TitleScreen.bringForward ' .. TitleScreen.bringForward ) end end ------------------------------------------------------- ------------------------------------------------------- -- Travel screen - Message for client feedback when loading maps ------------------------------------------------------- TravelScreen = {} TravelScreen.startTime = 0 function TravelScreen.init() local screenWidth, screenHeight = guiGetScreenSize() g_GUI['travelImage'] = guiCreateStaticImage(screenWidth/2-256, screenHeight/2-90, 512, 256, 'img/travelling.png', false, nil) g_dxGUI['travelText1'] = dxText:create('Travelling to', screenWidth/2, screenHeight/2-130, false, 'bankgothic', 0.6, 'center' ) g_dxGUI['travelText2'] = dxText:create('', screenWidth/2, screenHeight/2-100, false, 'bankgothic', 0.7, 'center' ) g_dxGUI['travelText3'] = dxText:create('', screenWidth/2, screenHeight/2-70, false, 'bankgothic', 0.9, 'center' ) g_dxGUI['travelText1']:color(240,240,240) g_dxGUI['travelText2']:color(255,150,0) hideGUIComponents('travelImage', 'travelText1', 'travelText2', 'travelText3') end function TravelScreen.show( mapName, authorName ) TravelScreen.startTime = getTickCount() g_dxGUI['travelText2']:text(mapName) g_dxGUI['travelText3']:text("#ee7700Sait:mtasa-ex.clan.su") showGUIComponents('travelImage', 'travelText1', 'travelText2', 'travelText3') guiMoveToBack(g_GUI['travelImage']) end function TravelScreen.hide() hideGUIComponents('travelImage', 'travelText1', 'travelText2', 'travelText3') end function TravelScreen.getTicksRemaining() return math.max( 0, TravelScreen.startTime + 3000 - getTickCount() ) end ------------------------------------------------------- -- Called from server function notifyLoadingMap( mapName, authorName ) fadeCamera( false, 0.0, 0,0,0 ) -- fadeout, instant, black TravelScreen.show( mapName, authorName ) end -- Called from server function initRace(vehicle, checkpoints, objects, pickups, mapoptions, ranked, duration, gameoptions, mapinfo, playerInfo) outputDebug( 'MISC', 'initRace start' ) unloadAll() g_Players = getElementsByType('player') g_MapOptions = mapoptions g_GameOptions = gameoptions g_MapInfo = mapinfo g_PlayerInfo = playerInfo triggerEvent('onClientMapStarting', g_Me, mapinfo ) g_dxGUI.mapdisplay:text("#00FF00M#00FF00ap: #00FF00"..g_MapInfo.name) fadeCamera(true) showHUD(false) g_Vehicle = vehicle setVehicleDamageProof(g_Vehicle, true) OverrideClient.updateVars(g_Vehicle) --local x, y, z = getElementPosition(g_Vehicle) setCameraBehindVehicle(vehicle) --alignVehicleToGround(vehicle) updateVehicleWeapons() setCloudsEnabled(g_GameOptions.cloudsenable) setBlurLevel(g_GameOptions.blurlevel) g_dxGUI.mapdisplay:visible(g_GameOptions.showmapname) if engineSetAsynchronousLoading then engineSetAsynchronousLoading( g_GameOptions.asyncloading ) end -- checkpoints g_Checkpoints = checkpoints -- pickups local object local pos local colshape for i, Link to comment
codeluaeveryday Posted April 13, 2013 Share Posted April 13, 2013 Untested (Sure it will work though) Replace the 'race/textlib.lua' with: dxText = {} dxText_mt = { __index = dxText } local idAssign,idPrefix = 0,"c" local g_screenX,g_screenY = guiGetScreenSize() local visibleText = {} ------ defaults = { fX = 0.5, fY = 0.5, bRelativePosition = true, strText = "", bVerticalAlign = "center", bHorizontalAlign = "center", tColor = {255,255,255,255}, fScale = 1, strFont = "default", strType = "normal", tAttributes = {}, bPostGUI = false, bClip = false, bWordWrap = true, bVisible = true, tBoundingBox = false, --If a bounding box is not set, it will not be used. bRelativeBoundingBox = true, } local validFonts = { default = true, ["default-bold"] = true, clear = true, arial = true, pricedown = true, bankgothic = true, diploma = true, beckett = true, } local validTypes = { normal = true, shadow = true, border = true, stroke = true, --Clone of border } local validAlignTypes = { center = true, left = true, right = true, } function dxText:create( text, x, y, relative, strFont, fScale, horzA ) assert(not self.fX, "attempt to call method 'create' (a nil value)") if ( type(text) ~= "string" ) or ( not tonumber(x) ) or ( not tonumber(y) ) then outputDebugString ( "dxText:create - Bad argument", 0, 112, 112, 112 ) return false end local new = {} setmetatable( new, dxText_mt ) --Add default settings for i,v in pairs(defaults) do new[i] = v end idAssign = idAssign + 1 new.id = idPrefix..idAssign new.strText = text or new.strText new.fX = x or new.fX new.fY = y or new.fY if type(relative) == "boolean" then new.bRelativePosition = relative end new:scale( fScale or new.fScale ) new:font( strFont or new.strFont ) new:align( horzA or new.bHorizontalAlign ) visibleText[new] = true return new end function dxText:text(text) if type(text) ~= "string" then return self.strText end self.strText = text return true end function dxText:position(x,y,relative) if not tonumber(x) then return self.fX, self.fY end self.fX = x self.fY = y if type(relative) == "boolean" then self.bRelativePosition = relative else self.bRelativePosition = true end return true end function dxText:color(r,g,b,a) if not tonumber(r) then return unpack(self.tColor) end g = g or self.tColor[2] b = b or self.tColor[3] a = a or self.tColor[4] self.tColor = { r,g,b,a } return true end function dxText:scale(scale) if not tonumber(scale) then return self.fScale end self.fScale = scale return true end function dxText:visible(bool) if type(bool) ~= "boolean" then return self.bVisible end if self.bVisible == bool then return end self.bVisible = bool if bool then visibleText[self] = true else visibleText[self] = nil end return true end function dxText:destroy() self.bDestroyed = true setmetatable( self, self ) return true end function dxText:font(font) if not validFonts[font] then return self.strFont end self.strFont = font return true end function dxText:postGUI(bool) if type(bool) ~= "boolean" then return self.bPostGUI end self.bPostGUI = bool return true end function dxText:clip(bool) if type(bool) ~= "boolean" then return self.bClip end self.bClip = bool return true end function dxText:wordWrap(bool) if type(bool) ~= "boolean" then return self.bWordWrap end self.bWordWrap = bool return true end function dxText:type(type,...) if not validTypes[type] then return self.strType, unpack(self.tAttributes) end self.strType = type self.tAttributes = {...} return true end function dxText:align(horzA, vertA) if not validAlignTypes[horzA] then return self.bHorizontalAlign, self.bVerticalAlign end vertA = vertA or self.bVerticalAlign self.bHorizontalAlign, self.bVerticalAlign = horzA, vertA return true end function dxText:boundingBox(left,top,right,bottom,relative) if left == nil then if self.tBoundingBox then return unpack(boundingBox) else return false end elseif tonumber(left) and tonumber(right) and tonumber(top) and tonumber(bottom) then self.tBoundingBox = {left,top,right,bottom} if type(relative) == "boolean" then self.bRelativeBoundingBox = relative else self.bRelativeBoundingBox = true end else self.tBoundingBox = false end return true end addEventHandler ( "onClientRender", getRootElement(), function() for self,_ in pairs(visibleText) do while true do if self.bDestroyed then visibleText[self] = nil break end if self.tColor[4] < 1 then break end local l,t,r,b --If we arent using a bounding box if not self.tBoundingBox then --Decide if we use relative or absolute local p_screenX,p_screenY = 1,1 if self.bRelativePosition then p_screenX,p_screenY = g_screenX,g_screenY end local fX,fY = (self.fX)*p_screenX,(self.fY)*p_screenY if self.bHorizontalAlign == "left" then l = fX r = fX + g_screenX elseif self.bHorizontalAlign == "right" then l = fX - g_screenX r = fX else l = fX - g_screenX r = fX + g_screenX end if self.bVerticalAlign == "top" then t = fY b = fY + g_screenY elseif self.bVerticalAlign == "bottom" then t = fY - g_screenY b = fY else t = fY - g_screenY b = fY + g_screenY end elseif type(self.tBoundingBox) == "table" then local b_screenX,b_screenY = 1,1 if self.bRelativeBoundingBox then b_screenX,b_screenY = g_screenX,g_screenY end l,t,r,b = self.tBoundingBox[1],self.tBoundingBox[2],self.tBoundingBox[3],self.tBoundingBox[4] l = l*b_screenX t = t*b_screenY r = r*b_screenX b = b*b_screenY end local type,att1,att2,att3,att4,att5 = self:type() if type == "border" or type == "stroke" then att2 = att2 or 0 att3 = att3 or 0 att4 = att4 or 0 att5 = att5 or self.tColor[4] outlinesize = att1 or 2 if outlinesize > 0 then for offsetX=-outlinesize,outlinesize,outlinesize do for offsetY=-outlinesize,outlinesize,outlinesize do if not (offsetX == 0 and offsetY == 0) then dxDrawText(self.strText, l + offsetX, t + offsetY, r + offsetX, b + offsetY, tocolor(att2, att3, att4, att5), self.fScale, self.strFont, self.bHorizontalAlign, self.bVerticalAlign, self.bClip, self.bWordWrap, self.bPostGUI, true ) end end Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now