WDS-Markoes Posted January 13, 2012 Share Posted January 13, 2012 Hi there. i have a small question.. i know i am noob. but. the question is.... if you play in a dm/dd server.. you can see the map name on the botom on the left corner. right but sometimes you can also see the next map.. what brings to my qeustion..how i display the next map in the game.? So like this: Map = balblablabla Nextmap = blablablabla and what script must i wright it/ and what must i wright.? srry for my bad english .!!! anyway thanks for the help.. Link to comment
Paper Posted January 13, 2012 Share Posted January 13, 2012 You must modify the race_client.lua or you can make a separated script. In both you have to use the dxFunctions... Link to comment
WDS-Markoes Posted January 13, 2012 Author Share Posted January 13, 2012 ok i just try it. but it doenst work for me.... Can sombody maby please make/set an example for me here.? ( off the script). thx. Link to comment
FatalTerror Posted January 13, 2012 Share Posted January 13, 2012 ok i just try it. but it doenst work for me.... Show us your code and if have an error, we fix Link to comment
WDS-Markoes Posted January 13, 2012 Author Share Posted January 13, 2012 (edited) . Edited January 13, 2012 by Guest Link to comment
SnoopCat Posted January 13, 2012 Share Posted January 13, 2012 use [ lua ] [ /lua] tags plz Link to comment
Castillo Posted January 13, 2012 Share Posted January 13, 2012 Lua/Code tags won't work, the text is too long. Link to comment
12p Posted January 13, 2012 Share Posted January 13, 2012 Then split it in 2 codes. Isn't it obvious? Link to comment
WDS-Markoes Posted January 13, 2012 Author Share Posted January 13, 2012 Srry.. this is better.!! 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 g_Checkpoints = {} g_Pickups = {} g_VisiblePickups = {} g_Objects = {} addEventHandler('onClientResourceStart', g_ResRoot, function() g_Players = getElementsByType('player') exports.scoreboard:scoreboardSetSortBy("race rank") fadeCamera(false,0.0) -- create GUI local screenWidth, screenHeight = guiGetScreenSize() g_dxGUI = { ranknum = dxText:create('1', screenWidth - 130, 140, false, 'bankgothic', 2, 'right'), ranksuffix = dxText:create('Alive', screenWidth - 80, 140, false, 'bankgothic', 1), checkpoint = dxText:create('0/0', screenWidth - 15, screenHeight - 54, false, 'bankgothic', 0.8, 'right'), mapdisplay = dxText:create('Map: ', 10, screenHeight - dxGetFontHeight(0.2, 'bankgothic'), false, 'bankgothic', 0.6, 'left'), nextmapdisplay = dxText:create('NextMap: ', 3, screenHeight - dxGetFontHeight(0.2, 'bankgothic'), false, 'bankgothic', 0.6, 'left'), mapdisplayName = dxText:create('none', 55, screenHeight - dxGetFontHeight(0.4, 'bankgothic'), false, 'bankgothic',0.6, 'left'), -- nextdisplay = dxText:create('Nextmap: ', 2, screenHeight - dxGetFontHeight(0.2, 'bankgothic')-20, false, 'bankgothic', 0.6, 'left'), --nextdisplayName = dxText:create('Random', 100, screenHeight - dxGetFontHeight(0.2, 'bankgothic')-20, false, 'bankgothic', 0.6, 'left') } g_dxGUI.ranknum:color(0, 55, 200, 255) g_dxGUI.ranksuffix:color(0, 55, 200, 255) g_dxGUI.checkpoint:color(255, 128, 0, 255) g_dxGUI.mapdisplay:color(0, 55, 200, 255) g_dxGUI.mapdisplayName:color(255,255,255,255) --g_dxGUI.nextdisplay:color(255, 128, 0, 255) --g_dxGUI.nextdisplayName:color(255, 255, 255, 255) 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_GUI = { timeleftbg = guiCreateStaticImage(screenWidth/2-108/2, 0, 165, 50, 'img/timeleft.png', false, nil), timepassed = guiCreateLabel(screenWidth/2-35/2, 24, 165, 54, '', false), timeleft = guiCreateLabel(screenWidth/2-185/2, 24, 165, 54, '', false), healthbar = FancyProgress.create(250, 1000, 'img/progress_health_bg.png', -60, 90, 170, 30, 'img/progress_health.png', 55, 8, 108, 16), speedbar = FancyProgress.create(0, 1.5, 'img/progress_speed_bg.png', -1, 1, 1, 1, 'img/progress_speed.png', 8, 8, 100, 23),} guiSetFont(g_GUI.timeleft, 'default-bold-small') guiSetFont(g_GUI.timepassed, 'default-bold-small') guiLabelSetHorizontalAlign(g_GUI.timeleft, 'center') guiLabelSetHorizontalAlign(g_GUI.timepassed, 'center') g_GUI.speedbar:setProgress(0) hideGUIComponents('timeleftbg', 'timeleft', 'healthbar', 'ranknum', 'ranksuffix', 'checkpoint', 'timepassed') RankingBoard.precreateLabels(10) -- set update handlers g_PickupStartTick = getTickCount() addEventHandler('onClientRender', g_Root, updateBars) g_WaterCheckTimer = setTimer(checkWater, 1000, 0) -- load pickup models and textures tekstura2 = engineLoadTXD ( "model/wanken1.txd" ) engineImportTXD(tekstura2, 8838 ) engineImportTXD(tekstura2, 8558 ) tekstura3 = engineLoadTXD ( "model/wanken2.txd" ) engineImportTXD(tekstura3, 3458 ) 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) 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-400, screenHeight/2-300+adjustY, 800, 600, '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( '\n' ) g_dxGUI['titleText2']:text( 'Server:\n' .. 'Welcome to World Drivers Skills' ) 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-50, 512, 196, 'img/travelling.png', false, nil) g_dxGUI['travelText1'] = dxText:create('Switching Map To:', screenWidth/2, screenHeight/2-130, false, 'bankgothic', 0.60, 'center' ) g_dxGUI['travelText2'] = dxText:create('', screenWidth/2, screenHeight/2-100, false, 'bankgothic', 0.70, 'center' ) g_dxGUI['travelText3'] = dxText:create('', screenWidth/2, screenHeight/2-70, false, 'bankgothic', 0.70, 'center' ) g_dxGUI['travelText4'] = dxText:create('', screenWidth/2, screenHeight/2-300, false, 'bankgothic', 0.70, 'center' ) g_dxGUI['travelText1']:color(0,55,200) g_dxGUI['travelText4']:color(255,128,0) g_dxGUI['travelText4']:boundingBox(screenWidth/2-0.2*screenWidth, screenHeight/2, screenWidth/2+0.2*screenWidth, screenHeight, false) g_dxGUI['travelText4']:wordWrap(true) hideGUIComponents('travelImage', 'travelText1', 'travelText2', 'travelText3') end --[[ function travelImg() angle = angle + 45 dxDrawImage ( sW/2-22.25, sH/2+25, 44.5, 50, 'img/loading.png', angle, 0, 0, white, true ) end ]]-- function TravelScreen.show( mapName, authorName ) TravelScreen.startTime = getTickCount() g_dxGUI['travelText2']:text(mapName) g_dxGUI['travelText3']:text(authorName and "Author: " .. authorName or "") g_dxGUI['travelText4']:text(jokes) showGUIComponents('travelImage', 'travelText1', 'travelText2', 'travelText3', 'travelText4') guiMoveToBack(g_GUI['travelImage']) addEventHandler("onClientRender", getRootElement(), travelImg) end function TravelScreen.hide() hideGUIComponents('travelImage', 'travelText1', 'travelText2', 'travelText3', 'travelText4') removeEventHandler("onClientRender", getRootElement(), travelImg) 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() exports.scoreboard:scoreboardSetSortBy("race rank") 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("NextMap: ") g_dxGUI.mapdisplay:text("Map: ") g_dxGUI.mapdisplayName:text(g_MapInfo.name) --g_dxGUI.nextdisplay:text("NextMap: Random") 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) g_dxGUI.mapdisplayName: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,pickup in pairs(pickups) do pos = pickup.position object = createObject(g_ModelForPickupType[pickup.type], pos[1], pos[2], pos[3]) setElementCollisionsEnabled(object, false) colshape = createColSphere(pos[1], pos[2], pos[3], 3.5) g_Pickups[colshape] = { object = object } for k,v in pairs(pickup) do g_Pickups[colshape][k] = v end g_Pickups[colshape].load = true if g_Pickups[colshape].type == 'vehiclechange' then g_Pickups[colshape].label = dxText:create(getVehicleNameFromModel(g_Pickups[colshape].vehicle), 0.5, 0.5) g_Pickups[colshape].label:color(255, 255, 255, 0) g_Pickups[colshape].label:type("shadow",2) end end -- objects g_Objects = {} local pos, rot for i,object in ipairs(objects) do pos = object.position rot = object.rotation g_Objects[i] = createObject(object.model, pos[1], pos[2], pos[3], rot[1], rot[2], rot[3]) end if #g_Checkpoints > 0 then g_CurrentCheckpoint = 0 showNextCheckpoint() end -- GUI showGUIComponents('healthbar', 'speedbar') hideGUIComponents('timeleftbg', 'timeleft','timepassed') if ranked then showGUIComponents('ranknum', 'ranksuffix') else hideGUIComponents('ranknum', 'ranksuffix') end if #g_Checkpoints > 0 then showGUIComponents('checkpoint') else hideGUIComponents('checkpoint') end g_HurryDuration = g_GameOptions.hurrytime if duration then launchRace(duration) end fadeCamera( false, 0.0 ) -- Min 3 seconds on travel message local delay = TravelScreen.getTicksRemaining() delay = math.max(50,delay) setTimer(TravelScreen.hide,delay,1) -- Delay readyness until after title TitleScreen.bringForwardFadeout(3000) delay = delay + math.max( 0, TitleScreen.getTicksRemaining() - 1500 ) -- Do fadeup and then tell server client is ready setTimer(fadeCamera, delay + 750, 1, true, 10.0) setTimer(fadeCamera, delay + 1500, 1, true, 2.0) setTimer( function() triggerServerEvent('onNotifyPlayerReady', g_Me) end, delay + 3500, 1 ) outputDebug( 'MISC', 'initRace end' ) setTimer( function() setCameraBehindVehicle( g_Vehicle ) end, delay + 300, 1 ) end -- Called from the server when settings are changed function updateOptions ( gameoptions, mapoptions ) -- Update g_GameOptions = gameoptions g_MapOptions = mapoptions -- Apply updateVehicleWeapons() setCloudsEnabled(g_GameOptions.cloudsenable) setBlurLevel(g_GameOptions.blurlevel) g_dxGUI.mapdisplay:visible(g_GameOptions.showmapname) g_dxGUI.mapdisplayName:visible(g_GameOptions.showmapname) if engineSetAsynchronousLoading then engineSetAsynchronousLoading( g_GameOptions.asyncloading ) end end function launchRace(duration) g_Players = getElementsByType('player') if type(duration) == 'number' then showGUIComponents('timeleftbg', 'timeleft','timepassed') guiLabelSetColor(g_GUI.timeleft, 0, 135, 255) guiLabelSetColor(g_GUI.timepassed, 0, 135, 255) g_Duration = duration addEventHandler('onClientRender', g_Root, updateTime) end setVehicleDamageProof(g_Vehicle, false) g_StartTick = getTickCount() end addEventHandler('onClientElementStreamIn', g_Root, function() local colshape = table.find(g_Pickups, 'object', source) if colshape then local pickup = g_Pickups[colshape] if pickup.label then pickup.label:color(255, 255, 255, 0) pickup.label:visible(false) pickup.labelInRange = false end g_VisiblePickups[colshape] = source end end ) addEventHandler('onClientElementStreamOut', g_Root, function() local colshape = table.find(g_VisiblePickups, source) if colshape then local pickup = g_Pickups[colshape] if pickup.label then pickup.label:color(255, 255, 255, 0) pickup.label:visible(false) pickup.labelInRange = nil end g_VisiblePickups[colshape] = nil end end ) function updatePickups() local angle = math.fmod((getTickCount() - g_PickupStartTick) * 360 / 2000, 360) local g_Pickups = g_Pickups local pickup, x, y, cX, cY, cZ, pickX, pickY, pickZ for colshape,elem in pairs(g_VisiblePickups) do pickup = g_Pickups[colshape] if pickup.load then setElementRotation(elem, 0, 0, angle) if pickup.label then cX, cY, cZ = getCameraMatrix() pickX, pickY, pickZ = unpack(pickup.position) x, y = getScreenFromWorldPosition(pickX, pickY, pickZ + 2.85, 0.08 ) local distanceToPickup = getDistanceBetweenPoints3D(cX, cY, cZ, pickX, pickY, pickZ) if distanceToPickup > 80 then pickup.labelInRange = false pickup.label:visible(false) elseif x then if distanceToPickup < 60 then if isLineOfSightClear(cX, cY, cZ, pickX, pickY, pickZ, true, false, false, true, false) then if not pickup.labelInRange then if pickup.anim then pickup.anim:remove() end pickup.anim = Animation.createAndPlay( pickup.label, Animation.presets.dxTextFadeIn(500) ) pickup.labelInRange = true pickup.labelVisible = true end if not pickup.labelVisible then pickup.label:color(255, 255, 255, 255) end pickup.label:visible(true) else pickup.label:color(255, 255, 255, 0) pickup.labelVisible = false pickup.label:visible(false) end else if pickup.labelInRange then if pickup.anim then pickup.anim:remove() end pickup.anim = Animation.createAndPlay( pickup.label, Animation.presets.dxTextFadeOut(1000) ) pickup.labelInRange = false pickup.labelVisible = false pickup.label:visible(true) end end local scale = (60/distanceToPickup)*0.7 pickup.label:scale(scale) pickup.label:position(x, y, false) else pickup.label:color(255, 255, 255, 0) pickup.labelVisible = false pickup.label:visible(false) end if Spectate.fadedout then Link to comment
FatalTerror Posted January 13, 2012 Share Posted January 13, 2012 Why you post the complete race client ? lol Link to comment
WDS-Markoes Posted January 13, 2012 Author Share Posted January 13, 2012 haha.. because i don''t now where to put it . ok wait i found this en typed this line: nextmapdisplay = dxText:create('NextMap: ', 3, screenHeight - dxGetFontHeight(0.2, 'bankgothic'), false, 'bankgothic', 0.6, 'left'), fadeCamera(false,0.0) -- create GUI local screenWidth, screenHeight = guiGetScreenSize() g_dxGUI = { ranknum = dxText:create('1', screenWidth - 130, 140, false, 'bankgothic', 2, 'right'), ranksuffix = dxText:create('Alive', screenWidth - 80, 140, false, 'bankgothic', 1), checkpoint = dxText:create('0/0', screenWidth - 15, screenHeight - 54, false, 'bankgothic', 0.8, 'right'), mapdisplay = dxText:create('Map: ', 10, screenHeight - dxGetFontHeight(0.2, 'bankgothic'), false, 'bankgothic', 0.6, 'left'), nextmapdisplay = dxText:create('NextMap: ', 3, screenHeight - dxGetFontHeight(0.2, 'bankgothic'), false, 'bankgothic', 0.6, 'left'), mapdisplayName = dxText:create('none', 55, screenHeight - dxGetFontHeight(0.4, 'bankgothic'), false, 'bankgothic',0.6, 'left'), -- nextdisplay = dxText:create('Nextmap: ', 2, screenHeight - dxGetFontHeight(0.2, 'bankgothic')-20, false, 'bankgothic', 0.6, 'left'), --nextdisplayName = dxText:create('Random', 100, screenHeight - dxGetFontHeight(0.2, 'bankgothic')-20, false, 'bankgothic', 0.6, 'left') } g_dxGUI.ranknum:color(0, 55, 200, 255) g_dxGUI.ranksuffix:color(0, 55, 200, 255) g_dxGUI.checkpoint:color(255, 128, 0, 255) g_dxGUI.mapdisplay:color(0, 55, 200, 255) g_dxGUI.mapdisplayName:color(255,255,255,255) --g_dxGUI.nextdisplay:color(255, 128, 0, 255) --g_dxGUI.nextdisplayName:color(255, 255, 255, 255) 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 And the second: i add this line: g_dxGUI.mapdisplay:text("NextMap: ") -- Called from server function initRace(vehicle, checkpoints, objects, pickups, mapoptions, ranked, duration, gameoptions, mapinfo, playerInfo) outputDebug( 'MISC', 'initRace start' ) unloadAll() exports.scoreboard:scoreboardSetSortBy("race rank") 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("NextMap: ") g_dxGUI.mapdisplay:text("Map: ") g_dxGUI.mapdisplayName:text(g_MapInfo.name) --g_dxGUI.nextdisplay:text("NextMap: Random") But what know.. because i doenst work yet.. and i know that i miss something.. Link to comment
FatalTerror Posted January 13, 2012 Share Posted January 13, 2012 You set a text to the same dx... Create an new ._. 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