-
Posts
208 -
Joined
-
Last visited
Everything posted by Newbie
-
This how it looks. Like i said when i test same map with other toptimes they're showing. But in this case shows only 1... Maybe bug is in other file ?
-
I did it. I tested it on map while chanin my nick and reconnecting the server everytime i got top time. When i load other toptimes script they are showing all 1. 2. 3. .. Ect but this shows on only 1. Dont show others
-
when i test with other toptimes it works and shows all taken toptimes of the map.
-
Heu. I've edited toptimes and noticed one defect. It just shows one top time. other times does not show up.. 1. SomePlayerName (visible) 2. Does not show 3. Does not show 4. Does not show 5. Does not show 6. Does not show 7. Does not show 8. Does not show local topsFont = dxCreateFont( "font.ttf") -- -- toptimes_client.lua -- Created = {} CToptimes = {} CToptimes.__index = CToptimes CToptimes.instances = {} g_Settings = {} serverInfo = {} px = 0 sX,sY = guiGetScreenSize() toptimes = { anim = 360, size = {380,160}, mapname = "N/A", label = {"","","","","","","","","","",""}, 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 = {220,20,60} if toptimes.state then local sX = sX+toptimes.anim dxDrawRectangle(sX-toptimes.size[1]-10,(sY/2)-(toptimes.size[2]),toptimes.size[1],200/8,tocolor(232,31,31,200)) dxDrawText(toptimes.mapname,sX-toptimes.size[1]-10,(sY/2)-(toptimes.size[2]),sX-10,(sY/2)-(toptimes.size[2])+(200/8),tocolor(255,255,255,255),1,topsFont,"center","center",true) dxDrawRectangle(sX-toptimes.size[1]-10,(sY/2)-(toptimes.size[2])+(200/8),toptimes.size[1],toptimes.size[2],tocolor(15,15,15,150)) for i=1,8 do dxDrawText(i..") "..toptimes.label[i],sX-toptimes.size[1]+(toptimes.size[1]*0.03)-10,(sY/2)-(toptimes.size[2])+(200/8)+((i-1)*20),sX-(toptimes.size[1]*0.1)-10,(sY/2)-(toptimes.size[2])+(200/8)+((i)*20),tocolor(255,255,255,255),1,topsFont,"left","center",true,false,false,true) dxDrawText(toptimes.time[i],sX-toptimes.size[1]+(toptimes.size[1]*0.52)-10,(sY/2)-(toptimes.size[2])+(200/8)+((i-1)*20),sX-(toptimes.size[1]*0.1)-10,(sY/2)-(toptimes.size[2])+(200/8)+((i)*20),tocolor(255,255,255,255),1,topsFont,"left","center",true,false,false,true) dxDrawText(toptimes.data[i],sX-toptimes.size[1]+(toptimes.size[1]*0.75)-10,(sY/2)-(toptimes.size[2])+(200/8)+((i-1)*20),sX-(toptimes.size[1]*0.1)-10,(sY/2)-(toptimes.size[2])+(200/8)+((i)*20),tocolor(255,255,255,255),1,topsFont,"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.93)-10,(sY/2)-(toptimes.size[2])+(200/8)+((i-1)*20)+3,16,11,":admin/client/images/flags/"..toptimes.country[i]..".png",tocolor(255,255,255,255)) end end end if toptimes.personal[1] then dxDrawRectangle(sX-toptimes.size[1]-10,(sY/2)+(200/8),toptimes.size[1],30,tocolor(15,15,15,150)) dxDrawLine(sX-toptimes.size[1],(sY/2)+(200/8),sX-20,(sY/2)+(200/8),tocolor(141,182,205,255)) dxDrawText("#8DB6CD"..toptimes.personal.pos..") #FFFFFF "..toptimes.personal.name,sX-toptimes.size[1]+(toptimes.size[1]*0.03)-10,(sY/2)+(200/8),sX-(toptimes.size[1]*0.1)-10,(sY/2)+(200/8)+30,tocolor(255,255,255,255),1,topsFont,"left","center",true,false,false,true) dxDrawText(toptimes.personal.time,sX-toptimes.size[1]+(toptimes.size[1]*0.52)-10,(sY/2)+(200/8),sX-(toptimes.size[1]*0.1)-10,(sY/2)+(200/8)+30,tocolor(255,255,255,255),1,topsFont,"left","center",true,false,false,true) dxDrawText(toptimes.personal.data,sX-toptimes.size[1]+(toptimes.size[1]*0.75)-10,(sY/2)+(200/8),sX-(toptimes.size[1]*0.1)-10,(sY/2)+(200/8)+30,tocolor(255,255,255,255),1,topsFont,"left","center",true,false,false,true) if toptimes.personal.country ~= "" then if fileExists(":admin/client/images/flags/"..toptimes.personal.country..".png") then dxDrawImage(sX-toptimes.size[1]+(toptimes.size[1]*0.93)-10,(sY/2)-(toptimes.size[2])+(200/8)+((i-1)*20)+3,16,11,":admin/client/images/flags/"..toptimes.personal.country..".png",tocolor(255,255,255,255)) end end end end end addEventHandler("onClientRender",getRootElement(),drawToptimesIntreface) function toggleToptimes() if toptimes.animState == "open" then closeToptimes() else openToptimes() end end bindKey("F5","down",toggleToptimes) function openToptimes() if toptimes.state and toptimes.animState == "closed" then toptimes.tick = getTickCount() toptimes.animState = "open" end end function closeToptimes() if toptimes.state and toptimes.animState == "open" then toptimes.tick = getTickCount() toptimes.animState = "closed" end end --------------------------------------------------------------------------- -- 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,5000,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 = false -- table.dump(mapinfo) -- if self.startshow then --if mapinfo.name and string.findIgnoreCase(mapinfo.name,"[DM]") then for _,e in pairs(getElementsByType("racepickup") or {}) do local t = getElementData(e,"type") if t and t == "vehiclechange" then local v = getElementData(e,"vehicle") if v and tonumber(v) == 425 then self.hasTimes = true break end end end --end if self.hasTimes then self:doToggleToptimes( true ) openToptimes() setTimer(closeToptimes,5000,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,8 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
-
Where to change "Next map starts in" in race ?
-
Yesterday and a couple of days ago i tryed to fix my panel script but now i decided to make it by other way. Simply command code. Here is it: It says that i dont have money but i have, thats all. function buyMap(player, command, ...) local account = getPlayerAccount(thePlayer) if not (isGuestAccount(account)) then local playerCash = tonumber(getAccountData(account,"cash")) if g_ForcedNextMap then outputChatBox( "* Next map is " .. getMapName( g_ForcedNextMap ), player ) return end local query = #{...}>0 and table.concat({...},' ') or nil if not query then if g_ForcedNextMap then outputChatBox( "* Next map is " .. getMapName( g_ForcedNextMap ), player ) else outputChatBox( "* Next map is not set", player, 255, 255, 255 ) end return end local map = findMap(query) if not map then outputChatBox(errormsg, player) return end if ( playerCash ) and ( playerCash >= 1000 ) then if lastmap_B == map then outputChatBox( "* That map has been played recently.", player, 255, 255, 255 ) else g_ForcedNextMap = map outputChatBox(getPlayerName(player).. " bought next map to be " ..getMapName(g_ForcedNextMap).. "", g_Root, 255, 255, 255) setAccountData(account,"cash",playerCash - 1000) addStat(account,"buyedMaps",1) lastmap_B = g_ForcedNextMap end else outputChatBox("* You need more cash", player, 255, 255, 255) end end end addCommandHandler('bm', buyMap) addCommandHandler('buymap', buyMap)
-
My function: function getMapName( map ) return getResourceInfo( map, "name" ) or getResourceName( map ) or "unknown" end
-
lol.. Now when i buy map it writes that i bought unknown.. http://i.imgur.com/akePWrJ.png
-
Lock another one. I didnt understand what to do. Do you see those codes ? The first one is in my panel, when i click to buy selected map it does not set next map.. Just this.
-
Can someone show me an example so i can start learning.
-
I just cant make this viewtopic.php?f=91&t=72258 **** working..
-
I need to make it work with: triggerEvent("onBoughtMap",getRootElement(),mapName) not with: triggerServerEvent("doBuyNextMap",localPlayer,localPlayer,map) addEvent("doBuyNextMap",true) addEventHandler("doBuyNextMap",getRootElement(),function(player,mapName) if not player or not mapName then return else if not g_ForcedNextMap or g_ForcedNextMap == nil then executeCommandHandler("buyMap", player, mapName) end end end) addEvent("doBuyRedoMap",true) addEventHandler("doBuyRedoMap",getRootElement(),function(player) if not player then return else if not g_ForcedNextMap or g_ForcedNextMap == nil then local mapName = call(getResourceFromName("mapmanager"),"getRunningGamemodeMap") executeCommandHandler("buyMap", player,getMapName(mapName)) end end end) addCommandHandler("buyMap",function(player,command, ...) local query = #{...} > 0 and table.concat ( {...}, ' ' ) or nil if not query then if g_ForcedNextMap then outputDebugString ( 'Next map is ' .. getMapName ( g_ForcedNextMap ) ); else outputDebugString ( 'Next map is not set' ); end return end local map, errormsg = findMap ( query ); if not map then outputRace ( errormsg, player ); return end g_ForcedNextMap = map; outputChatBox ( "#ff6666[MAP] #ffffff"..getPlayerName ( player ) .. ' #ffffffhas bought #ff6666'..getMapName ( g_ForcedNextMap ).." #ffffffas next map", g_Root, 255, 255, 255, true ); end)
-
Look: It should set next map but it does not. I think i need to do smt in racevot.. But what
-
When i buy next map the script outputs that i have buyed map. But when i die it comes a random map, my buyed map does't start. Can you exactly tell what should i do ?
-
It seems to be well, but it doesn't set next map.. When i buy map in panel. -- Buy a next map function buyMap(thePlayer,mapName,command) local account = getPlayerAccount(thePlayer) if not (isGuestAccount(account)) then local playerCash = tonumber(getAccountData(account,"cash")) if not (mapName == "") then if playerCash >= mapCost then if command then mapName = getMapName(mapName) else mapName = tostring(mapName) end if not mapTimer[mapName] then if not tableFind(mapQueue,mapName) then table.insert(mapQueue,mapName) outputChatBox("#00BFFF[NEXT] #ffffff"..getPlayerName(thePlayer).."#FFFFFF has bought #00BFFF"..tostring(mapName).."#ffffff!",getRootElement(),255,255,255,true) outputChatBox("#00BFFF[NEXT] #ffffff"..tostring(mapName).."#ffffff successfully added to map queue!",getRootElement(),255,255,255,true) addStat(account,"buyedMaps",1) setAccountData(account,"cash",playerCash - mapCost) scoreboardRefresh(thePlayer) mapTimer[mapName] = setTimer(resetMapTimer,60000*35,1,mapName) if #mapQueue <= 1 then triggerEvent("onBoughtMap",getRootElement(),mapName) end callClientFunction(getRootElement(),"setMapQueue",mapQueue) else outputChatBox("#00BFFF[NEXT] #FFFFFFMap "..mapName.." is already in map queue.",thePlayer,255,255,255,true) end else local remaining, executesRemaining, totalExecutes = getTimerDetails(mapTimer[mapName]) if remaining < 60000 then remaining = math.floor(remaining/1000).."#ffffff second" else minutes = math.floor(remaining/60000) remaining = string.format('%02d',minutes).."#ffffff minutes" end outputChatBox("#00BFFF[NEXT] #FFFFFFYou have to wait #00BFFF"..remaining.." to set this map!",thePlayer,255,255,255,true) end else outputChatBox("#00BFFF[NEXT] #FFFFFFYou don't have enough money to set a map!",thePlayer,255,255,255,true) end else outputChatBox("#00BFFF[NEXT] #FFFFFFPlease select a map from the list first!",thePlayer,255,255,255,true) end else outputChatBox("#00BFFF[NEXT] #FFFFFFA map is already set at the moment! Please try again later.",thePlayer,255,255,255,true) end end function resetMapSetStatus(g_MapInfo) if #mapQueue >= 1 then if g_MapInfo.name ~= mapQueue[1] then triggerEvent("onBoughtMap",getRootElement(),mapQueue[1]) removeFromTable(mapQueue,mapQueue[1]) else removeFromTable(mapQueue,mapQueue[1]) if mapQueue[1] then triggerEvent("onBoughtMap",getRootElement(),mapQueue[1]) end end end for i,player in pairs(getElementsByType("player")) do respawnFix[player] = false end respawnFix = {} callClientFunction(getRootElement(),"setMapQueue",mapQueue) end addEvent("onMapStarting",true) addEventHandler("onMapStarting",getRootElement(),resetMapSetStatus) function removeFromTable(tabela,value) if tabela ~= nil then for i,data in pairs(tabela) do if data == value then table.remove(tabela,i) end end end end function tableFind(tabela,value) local ifIs = false for i,data in pairs(tabela) do if data == value then ifIs = true break end end return ifIs end addCommandHandler("resetMapBlock", function () mapIsAlreadySet = false mapName = "" mapBlock = "" end) function resetMapTimer(mapName) mapTimer[mapName] = nil outputChatBox( "#00BFFF[NEXT] #ffffffMap #00BFFF"..mapName.." #ffffffcan be bought again!", getRootElement(), 255,255,255,true) end function buyMapCommand(player,command, ... ) local query = #{...}>0 and table.concat({...},' ') or nil if query then local map, errormsg = findMap( query ) if not map then outputChatBox( "#00BFFF[NEXT] #ffffff"..errormsg, player, 255,255,255,true) return end buyMap(player,map,true) end end addCommandHandler("bm",buyMapCommand) racevoting_server -------------------- addCommandHandler('bm', function( player, command, ... ) if not getElementData (getRootElement(),"mapIsAlreadySet") == true then --this check need for /bm, if guy bought map (/bm),not from user panel(so you can modify code for bm(take player money too)finish it local query = #{...}>0 and table.concat({...},' ') or nil if not query then if g_ForcedNextMap then outputChatBox( '#abcdefNext map is #ffffff ' .. getMapName( g_ForcedNextMap ), player, 255, 255, 255, true ) else outputChatBox( '#abcdefNext map is not set', player, 255, 255 ,255, true ) end return end local map, errormsg = findMap( query ) if not map then outputRace( errormsg, player ) return end if (isGuestAccount(getPlayerAccount(player)) == false) then g_ForcedNextMap = map outputChatBox('#FF6600* Next map set from #ABCDEF'..getPlayerName( player )..' #FFFFFF[' .. getMapName( g_ForcedNextMap ).." ]", g_Root, 0, 240, 0,true) else outputChatBox("#00ff00*[bM] #FF0000ERROR: #ffffffPlease Register or Login!",player,255,255,255,true) end else outputChatBox("#FF0000* #FFFFFFA map is already #ff0000set #ffffffat the moment! Please try again later.",player,255,255,255,true) end end )
