Jump to content

Tempo


Whit3

Recommended Posts

Posted (edited)

MI potreste aiutare nel prendere il "#time" che si trova nel mapMeta?

Ho provato ma non riesco a capire perchè non setta il tempo..

  
local mapMeta = xmlLoadFile("Meta.xml") 
..................... 
  
for i, v in ipairs(xmlNodeGetChildren(mapMeta)) do 
                             local name = xmlNodeGetName(v) 
                               if name == "settings" then 
                                outputChatBox ( "dentro Setting" ) 
                                local sname = xmlNodeGetAttribute(v,"name") 
                                     if sname == "#time" then 
                                     outputChatBox ( "in time" ) 
                                   local value = xmlNodeGetAttribute(v, "value") 
                                  if value then 
                                   value = string.gsub(value, "%s+", "") 
                                 value = string.gsub(value, "[%[%]]", "") 
                                   setTime(value:match('(%d+)%d+)')) 
                                                tempo = value 
                                                outputChatBox ( "Al mytime" ) 
                  
                                      else 
                                         setTime(0,0) 
                                      end 
                                            end 
                                          end 
                                        end  

Edited by Guest
Posted

No è uno script per una gm a stanze.

Devo Devo prendere il tempo di ogni mappa che carica e settarlo..

Dalle tue domande

- Dovrei Usarlo Nel ServerSide

- E' devo prendere il tempo della mappa e settarlo successivamente

  
local mapMeta = xmlLoadFile("Meta.xml")-- Sarebbe il meta della mappa  
for i, v in ipairs(xmlNodeGetChildren(mapMeta)) do 
                             local name = xmlNodeGetName(v) 
                               if name == "settings" then-- questo dovrebbe prendere il nodo del setting 
                                outputChatBox ( "dentro Setting" ) -- Fino a qui ci siamo lo script arriva fino a qui poi si ferma.. non riesce a prendere il #time e settarlo.. 
                                local sname = xmlNodeGetAttribute(v,"name") 
                                     if sname == "#time" then  
                                     outputChatBox ( "in time" )-- Qui mi informa se riesce a trovare la stringa #time che si trova nel nodo "settings" 
                                   local value = xmlNodeGetAttribute(v, "value") 
                                  if value then-- Questo mi dovrebbe informare se riesce a trovare il valore del #time 
                                   value = string.gsub(value, "%s+", "") 
                                 value = string.gsub(value, "[%[%]]", "") 
                                   setTime(value:match('(%d+)%d+)')) 
                                                tempo = value 
                                                outputChatBox ( "Al mytime" ) 
                  
                                      else 
                                         setTime(0,0) 
                                      end 
                                            end 
                                          end 
   end 

Posted

Il tempo di default era questo ma ti settava sempre 0, quindi ho deciso di fare quello che ho scritto prima

local realtime = tonumber(string.sub(get("#"..resName..".time"),1,2)) or 0;

Posted

Se sono mappe che crei tu puoi semplicemente creare un setting e chiamare il valore con get,ovviamente server side.

Posted

Meta :

  
-- ovviamente tra  e  
-- vedo che hai messo value 5:40 che sarebbero 5 minuti e 40 secondi,il value cmq devi metterlo in milisecondi. 
-- ma puoi mettere anche 1 e moltiplicarlo dopo . . . esempio. 
    
    "*Time" value="5" 
          friendlyname="Number Minute Timer Mappa" 
    /> 
                      
  

Sever :

  
-- Puoi usare onResourceStart oppure un altro evento 
local Timer = tonumber(get("Time")) * 10000 -- Timer = 50000 milisecondi 
-- ora puoi usare Timer per un trigger o altro 
  

Posted

Ok quello che hai scritto è giusto però io voglio prendere il valore che sta in ogni meta di una mappe e successivamente settarlo.

Non posso semplicemente mettere

poichè i valori sono due 5, 40 quindi il mio problema è questo

setTime(5:40)

Posted

Mi sono confuso perche non mi hai dato abbastanza informazioni.

Allora,tu vuoi che quando parte la mappa chiami il setting "#time" e vai a settare il tempo del gioco con il setting della meta.

Ma non dovrebbe settarsi da solo scusa? Dimmi esattamente cosa devi fare.

Posted

Allora,posta qui il meta di una mappa che usi e dimmi su che gm gira.

Stasera vedo come posso aiutarti,per non sprecare tempo puoi aggiungermi su steam.

Posted

Appunto che la gm non è race dovresti dare un occhiata proprio alla gamemode race per capire cosa è stato usato.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...