Jump to content

Tempo


Whit3

Recommended Posts

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
Link to comment

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 

Link to comment

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 
  

Link to comment

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.

Link to comment

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...