
myyusuf
Members-
Posts
120 -
Joined
-
Last visited
Everything posted by myyusuf
-
thats what i want to know. THANK YOU!
-
server: local lastTimePlayed local month = {"January","February","March","April","May","June","Juli","August","September","October","November","December"} function timestampToDate(stamp) local time = getRealTime(stamp) return string.format("%d %s %02d:%02d",time.monthday,month[time.month+1],time.hour,time.minute) end addEvent("onMapStarting",true) addEventHandler ( 'onMapStarting', root, function ( mapInfo ) local mapname = getResourceName(map) local author = getResourceInfo(exports.mapmanager:getRunningGamemodeMap(),"author") local lastTimePlayed = timestampToDate(mapInfo.lastTimePlayed) local xml = xmlLoadFile("data/ratings.xml") if ( xml ) then local index = findIndexByName ( mapname ) if ( index ) then local map = xmlFindChild ( xml, "map", index ) local rating = xmlNodeGetAttribute ( map, "rating" ) local ratedBy = xmlNodeGetAttribute ( map, "ratedBy" ) local played = xmlNodeGetAttribute ( map, "played" ) triggerClientEvent(source,"INFO",getRootElement(),author,rating,ratedBy,played,lastTimePlayed) else outputChatBox ( "Map not found in our ratings list.", getRootElement(), 255, 0, 0, true ) end else outputChatBox ( "Unable to load map ratings XML file.", getRootElement(), 255, 0, 0, true ) end end ) function findIndexByName ( mapName ) local ratingsFile = xmlLoadFile("data/ratings.xml") if ( ratingsFile ) then for index, map in ipairs ( xmlNodeGetChildren ( ratingsFile ) ) do local name = xmlNodeGetAttribute ( map, "id" ) if ( name == mapName ) then return index -1 end end xmlUnloadFile(ratingsFile) end end client: local screenWidth, screenHeight = guiGetScreenSize() local endPosition = screenHeight-140 local moveback = false function handleMapInfo(mapInfo) name = mapInfo.name or "Unknown" author = mapInfo.author or "Unknown" lastTimePlayed = timestampToDate(mapInfo.lastTimePlayed) or "Unknown" playedCount = tostring(mapInfo.playedCount or "Unknown") modename = mapInfo.modename ~= "Destruction derby" and mapInfo.modename or "Destruction derby" hunterreached = huntersReached or "0" maprate = mapRates or "-" ratedtimes = ratedTimess or "0" position = screenHeight+90 movePosition = 5 tickCount = 400 moveback = false alpha = 0 end function getDrawText(author,rating,ratedBy,played,lastTimePlayed) addEventHandler ( "onClientRender", getRootElement(), drawMapInfo) if author then textA = "Author: "..author else textA = "Unknown" end if rating then textR = "Rate: " ..rating.. "/10 (by " ..ratedBy.. " players)" else textR = "Not rated yet" end if played then textP = "Times played: "..played.." times" else textP = "Never played before" end if lastTimePlayed then textPL = "Last Time Played\n"..lastTimePlayed else textPL = "Unknown" end end addEvent( "INFO", true ) addEventHandler( "INFO", getRootElement(), getDrawText ) function drawMapInfo () if position == endPosition then if tickCount == 0 then moveback = true end tickCount = tickCount-1 movePosition = 0 end if position >= screenHeight+91 then removeEventHandler("onClientRender",getRootElement(),drawMapInfo) end if moveback then movePosition = -2.5 alpha = alpha - 10 end alpha = alpha + 5 if alpha > 255 then alpha = 255 elseif alpha < 0 then alpha = 0 end local heighResize = dxGetFontHeight(1.15, "default-bold") local widthRezise1 = dxGetTextWidth("Map - "..name,1.15,"default-bold") local widthRezise2 = dxGetTextWidth("Lasttime played - "..lastTimePlayed,1.15,"default-bold") local widthRezise3 = dxGetTextWidth("By - "..author,1.15,"default-bold") if widthRezise1 > widthRezise2 and widthRezise1 > widthRezise3 then widthRezise = widthRezise1 elseif widthRezise2 > widthRezise1 and widthRezise2 > widthRezise3 then widthRezise = widthRezise2 elseif widthRezise3 > widthRezise1 and widthRezise3 > widthRezise2 then widthRezise = widthRezise3 end dxDrawImage(screenWidth/2-200,screenHeight/2+185,420.0,176.0, "images/info_bgr.png",0,0,0,tocolor(200,200,200,alpha)) dxDrawText ( "Name: " ..name,screenWidth/2-150,screenHeight/2+200,636.0,675.0,tocolor(255,255,255,255),1.5,"default-bold","left","top",false,false,false) dxDrawText ( textA,screenWidth/2-150,screenHeight/2+225.0,636.0,619.0,tocolor(255,255,255,255),1.5,"default-bold","left","top",false,false,false) dxDrawText ( textR,screenWidth/2-150,screenHeight/2+275,684.0,647.0,tocolor(255,255,255,255),1.5,"default-bold","left","top",false,false,false) dxDrawText ( textP,screenWidth/2-150,screenHeight/2+250,636.0,675.0,tocolor(255,255,255,255),1.5,"default-bold","left","top",false,false,false) dxDrawText ( textPL,screenWidth/2-150,screenHeight/2+300,684.0,647.0,tocolor(255,255,255,255),1.5,"default-bold","left","top",false,false,false) dxDrawText ( "Mode: Destruction Derby",screenWidth/2-150,screenHeight/2+325,506.0,699.0,tocolor(255,255,255,255),1.5,"default-bold","left","top",false,false,false) position = position - movePosition end i wanna take map folder name in server side's 12. line. but it doesnt take. can you help me please?
-
thank you. i have another problem now. <list> <map id="race-[dd]2012" rating="8.25" ratedBy="4" played="186"></map> <map id="race-[dd]ananzaaa" rating="5.25" ratedBy="9" played="25"></map> .. .. .. </list> addEventHandler ( 'onGamemodeMapStart', root, function ( uMapStart ) local mapname = getResourceName( uMapStart ) end ) local xml = xmlLoadFile("data/ratings.xml") local map = xmlFindChild ( xml, "map", 0 ) local id = xmlNodeGetAttribute(map, "id") if id == mapname then local rating = xmlNodeGetAttribute(map, "rating") local ratedBy = xmlNodeGetAttribute(map, "ratedBy") local played = xmlNodeGetAttribute(map, "played") outputChatBox ( "rated: " ..rating.. " ratedBy: " ..ratedBy.. " played " ..played, getRootElement(), 255, 0, 0, true ) else outputChatBox ( "FAIL", getRootElement(), 255, 0, 0, true ) i wanna do something like that. if id is map folder name, then take data from the map node. is that code right?
-
thank you. local xml = xmlLoadFile("data/ratings.xml") local list = xmlFindChild ( xml, "list", 0 ) local map = xmlFindChild ( list, "map", 0 ) local rating = xmlNodeGetAttribute(list, "rating") local ratedBy = xmlNodeGetAttribute(list, "ratedBy") local played = xmlNodeGetAttribute(list, "played") outputChatBox ( "rated: " ..rating.. " ratedBy: " ..ratedBy.. " played " ..played, getRootElement(), 255, 0, 0, true ) is that right for my xml file?
-
What you not understand? i solved the problem.. topic closed please.
-
oh local name, author, lastTimePlayed, playedCount, modename local startTick local month = {"January","February","March","April","May","June","Juli","August","September","October","November","December"} local screenWidth, screenHeight = guiGetScreenSize() local endPosition = screenHeight-140 local moveback = false function timestampToDate(stamp) local time = getRealTime(stamp) return string.format("%d %s %02d:%02d",time.monthday,month[time.month+1],time.hour,time.minute) end function handleMapInfo(mapInfo) name = mapInfo.name or "Unknown" author = mapInfo.author or "Unknown" lastTimePlayed = timestampToDate(mapInfo.lastTimePlayed) or "Unknown" playedCount = tostring(mapInfo.playedCount or "Unknown") modename = mapInfo.modename ~= "Destruction derby" and mapInfo.modename or "Destruction derby" position = screenHeight+90 movePosition = 5 tickCount = 400 moveback = false alpha = 0 addEventHandler("onClientRender",getRootElement(),drawMapInfo) end addEvent("onClientMapStarting",true) addEventHandler("onClientMapStarting",getRootElement(),handleMapInfo) function drawMapInfo () if position == endPosition then if tickCount == 0 then moveback = true end tickCount = tickCount-1 movePosition = 0 end if position >= screenHeight+91 then removeEventHandler("onClientRender",getRootElement(),drawMapInfo) end if moveback then movePosition = -2.5 alpha = alpha - 10 end alpha = alpha + 5 if alpha > 255 then alpha = 255 elseif alpha < 0 then alpha = 0 end local heighResize = dxGetFontHeight(1.15, "default-bold") local widthRezise1 = dxGetTextWidth("Map - "..name,1.15,"default-bold") local widthRezise2 = dxGetTextWidth("Lasttime played - "..lastTimePlayed,1.15,"default-bold") local widthRezise3 = dxGetTextWidth("By - "..author,1.15,"default-bold") if widthRezise1 > widthRezise2 and widthRezise1 > widthRezise3 then widthRezise = widthRezise1 elseif widthRezise2 > widthRezise1 and widthRezise2 > widthRezise3 then widthRezise = widthRezise2 elseif widthRezise3 > widthRezise1 and widthRezise3 > widthRezise2 then widthRezise = widthRezise3 end dxDrawImage(screenWidth/2-widthRezise/2-8,position-movePosition-(heighResize-3),widthRezise+16,140+heighResize, "bgr.png",0,0,0,tocolor(200,200,200,alpha)) dxDrawingColorText ( "#FF9900Map - #FFFFFF"..name,screenWidth/2,position-movePosition+heighResize,screenWidth/2,position-movePosition+heighResize, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) dxDrawingColorText ( "#FF9900By - #FFFFFF"..author,screenWidth/2,position-movePosition+heighResize*2,screenWidth/2,position-movePosition+heighResize*2, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) dxDrawingColorText ( "#FF9900Played - #FFFFFF"..playedCount.." times",screenWidth/2,position-movePosition+heighResize*3,screenWidth/2,position-movePosition+heighResize*3, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) dxDrawingColorText ( "#FF9900Lasttime played - #FFFFFF"..lastTimePlayed,screenWidth/2,position-movePosition+heighResize*4,screenWidth/2,position-movePosition+heighResize*4, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) dxDrawingColorText ( "#FF9900Mode - #FFFFFF"..modename,screenWidth/2,position-movePosition+heighResize*5,screenWidth/2,position-movePosition+heighResize*5, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) position = position - movePosition end function dxDrawingColorText ( text,left,top,right,bottom,color,scale,font,alignX,alignY) end function drawMyText ( text,left,top,right,bottom,color,scale,font,alignX,alignY) dxDrawingColorText ( text, left+scale, top , right+scale, bottom, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) dxDrawingColorText ( text, left+scale, top+scale , right+scale, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) dxDrawingColorText ( text, left, top+scale , right, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) dxDrawingColorText ( text, left-scale, top+scale , right-scale, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) dxDrawingColorText ( text, left-scale, top , right-scale, bottom, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) dxDrawingColorText ( text, left-scale, top-scale , right-scale, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) dxDrawingColorText ( text, left, top-scale , right, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) dxDrawingColorText ( text, left+scale, top-scale , right+scale, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) dxDrawingColorText ( text, left, top , right, bottom, color,scale,font,alignX,alignY) end i did this now. but i only can see the image. cant see the text. what is wrong?
-
local name, author, lastTimePlayed, playedCount, modename local startTick local month = {"January","February","March","April","May","June","Juli","August","September","October","November","December"} local screenWidth, screenHeight = guiGetScreenSize() local endPosition = screenHeight-140 local moveback = false function timestampToDate(stamp) local time = getRealTime(stamp) return string.format("%d %s %02d:%02d",time.monthday,month[time.month+1],time.hour,time.minute) end function handleMapInfo(mapInfo) name = mapInfo.name or "Unknown" author = mapInfo.author or "Unknown" lastTimePlayed = timestampToDate(mapInfo.lastTimePlayed) or "Unknown" playedCount = tostring(mapInfo.playedCount or "Unknown") modename = mapInfo.modename ~= "Destruction derby" and mapInfo.modename or "Destruction derby" position = screenHeight+90 movePosition = 5 tickCount = 400 moveback = false alpha = 0 addEventHandler("onClientRender",getRootElement(),drawMapInfo) end addEvent("onClientMapStarting",true) addEventHandler("onClientMapStarting",getRootElement(),handleMapInfo) function drawMapInfo () if position == endPosition then if tickCount == 0 then moveback = true end tickCount = tickCount-1 movePosition = 0 end if position >= screenHeight+91 then removeEventHandler("onClientRender",getRootElement(),drawMapInfo) end if moveback then movePosition = -2.5 alpha = alpha - 10 end alpha = alpha + 5 if alpha > 255 then alpha = 255 elseif alpha < 0 then alpha = 0 end local heighResize = dxGetFontHeight(1.15, "default-bold") local widthRezise1 = dxGetTextWidth("Map - "..name,1.15,"default-bold") local widthRezise2 = dxGetTextWidth("Lasttime played - "..lastTimePlayed,1.15,"default-bold") local widthRezise3 = dxGetTextWidth("By - "..author,1.15,"default-bold") if widthRezise1 > widthRezise2 and widthRezise1 > widthRezise3 then widthRezise = widthRezise1 elseif widthRezise2 > widthRezise1 and widthRezise2 > widthRezise3 then widthRezise = widthRezise2 elseif widthRezise3 > widthRezise1 and widthRezise3 > widthRezise2 then widthRezise = widthRezise3 end dxDrawImage(screenWidth/2-widthRezise/2-8,position-movePosition-(heighResize-3),widthRezise+16,140+heighResize, "bgr.png",0,0,0,tocolor(200,200,200,alpha)) dxDrawingColorText ( "#FF9900Map - #FFFFFF"..name,screenWidth/2,position-movePosition+heighResize,screenWidth/2,position-movePosition+heighResize, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) dxDrawingColorText ( "#FF9900By - #FFFFFF"..author,screenWidth/2,position-movePosition+heighResize*2,screenWidth/2,position-movePosition+heighResize*2, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) dxDrawingColorText ( "#FF9900Played - #FFFFFF"..playedCount.." times",screenWidth/2,position-movePosition+heighResize*3,screenWidth/2,position-movePosition+heighResize*3, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) dxDrawingColorText ( "#FF9900Lasttime played - #FFFFFF"..lastTimePlayed,screenWidth/2,position-movePosition+heighResize*4,screenWidth/2,position-movePosition+heighResize*4, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) dxDrawingColorText ( "#FF9900Mode - #FFFFFF"..modename,screenWidth/2,position-movePosition+heighResize*5,screenWidth/2,position-movePosition+heighResize*5, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) position = position - movePosition end function drawMyText ( text,left,top,right,bottom,color,scale,font,alignX,alignY) dxDrawingColorText ( text, left+scale, top , right+scale, bottom, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) dxDrawingColorText ( text, left+scale, top+scale , right+scale, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) dxDrawingColorText ( text, left, top+scale , right, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) dxDrawingColorText ( text, left-scale, top+scale , right-scale, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) dxDrawingColorText ( text, left-scale, top , right-scale, bottom, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) dxDrawingColorText ( text, left-scale, top-scale , right-scale, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) dxDrawingColorText ( text, left, top-scale , right, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) dxDrawingColorText ( text, left+scale, top-scale , right+scale, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) dxDrawingColorText ( text, left, top , right, bottom, color,scale,font,alignX,alignY) end info.lua:62: attemp to global 'dxDrawingColorText' (a nil value)
-
sorry but i just really dont understand this. i try it in all way. dont work
-
It's example function fStackOverflow( ) fStackOverflow( ) end local name, author, lastTimePlayed, playedCount, modename local startTick local month = {"January","February","March","April","May","June","Juli","August","September","October","November","December"} local screenWidth, screenHeight = guiGetScreenSize() local endPosition = screenHeight-140 local moveback = false function timestampToDate(stamp) local time = getRealTime(stamp) return string.format("%d %s %02d:%02d",time.monthday,month[time.month+1],time.hour,time.minute) end function handleMapInfo(mapInfo) name = mapInfo.name or "Unknown" author = mapInfo.author or "Unknown" lastTimePlayed = timestampToDate(mapInfo.lastTimePlayed) or "Unknown" playedCount = tostring(mapInfo.playedCount or "Unknown") modename = mapInfo.modename ~= "Destruction derby" and mapInfo.modename or "Destruction derby" position = screenHeight+90 movePosition = 5 tickCount = 400 moveback = false alpha = 0 addEventHandler("onClientRender",getRootElement(),drawMapInfo) end addEvent("onClientMapStarting",true) addEventHandler("onClientMapStarting",getRootElement(),handleMapInfo) function drawMapInfo () if position == endPosition then if tickCount == 0 then moveback = true end tickCount = tickCount-1 movePosition = 0 end if position >= screenHeight+91 then removeEventHandler("onClientRender",getRootElement(),drawMapInfo) end if moveback then movePosition = -2.5 alpha = alpha - 10 end alpha = alpha + 5 if alpha > 255 then alpha = 255 elseif alpha < 0 then alpha = 0 end local heighResize = dxGetFontHeight(1.15, "default-bold") local widthRezise1 = dxGetTextWidth("Map - "..name,1.15,"default-bold") local widthRezise2 = dxGetTextWidth("Lasttime played - "..lastTimePlayed,1.15,"default-bold") local widthRezise3 = dxGetTextWidth("By - "..author,1.15,"default-bold") if widthRezise1 > widthRezise2 and widthRezise1 > widthRezise3 then widthRezise = widthRezise1 elseif widthRezise2 > widthRezise1 and widthRezise2 > widthRezise3 then widthRezise = widthRezise2 elseif widthRezise3 > widthRezise1 and widthRezise3 > widthRezise2 then widthRezise = widthRezise3 end --Background dxDrawImage(screenWidth/2-widthRezise/2-8,position-movePosition-(heighResize-3),widthRezise+16,140+heighResize, "bgr.png",0,0,0,tocolor(200,200,200,alpha)) --Map dxDrawingColorText ( "#FF9900Map - #FFFFFF"..name,screenWidth/2,position-movePosition+heighResize,screenWidth/2,position-movePosition+heighResize, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) --By dxDrawingColorText ( "#FF9900By - #FFFFFF"..author,screenWidth/2,position-movePosition+heighResize*2,screenWidth/2,position-movePosition+heighResize*2, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) --Played dxDrawingColorText ( "#FF9900Played - #FFFFFF"..playedCount.." times",screenWidth/2,position-movePosition+heighResize*3,screenWidth/2,position-movePosition+heighResize*3, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) --Last time dxDrawingColorText ( "#FF9900Lasttime played - #FFFFFF"..lastTimePlayed,screenWidth/2,position-movePosition+heighResize*4,screenWidth/2,position-movePosition+heighResize*4, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) --Mode dxDrawingColorText ( "#FF9900Mode - #FFFFFF"..modename,screenWidth/2,position-movePosition+heighResize*5,screenWidth/2,position-movePosition+heighResize*5, tocolor(255,255,255,alpha), alpha, 1.15, "default-bold", "center", "bottom", false, false, false ) position = position - movePosition end function dxDrawingColorText ( text,left,top,right,bottom,color,scale,font,alignX,alignY) fStackOverflow( ) dxDrawingColorText ( text, left+scale, top , right+scale, bottom, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) dxDrawingColorText ( text, left+scale, top+scale , right+scale, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) dxDrawingColorText ( text, left, top+scale , right, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) dxDrawingColorText ( text, left-scale, top+scale , right-scale, bottom+scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) dxDrawingColorText ( text, left-scale, top , right-scale, bottom, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) dxDrawingColorText ( text, left-scale, top-scale , right-scale, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) dxDrawingColorText ( text, left, top-scale , right, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) dxDrawingColorText ( text, left+scale, top-scale , right+scale, bottom-scale, tocolor(30,30,30,Alpha),scale,font,alignX,alignY) dxDrawingColorText ( text, left, top , right, bottom, color,scale,font,alignX,alignY) end ?