Whit3
Members-
Posts
51 -
Joined
-
Last visited
Everything posted by Whit3
-
Sisi Ho capito anche se a me a volte i team mi si buggano e si vanno a settare in un team a caso . Ritornando al problema, io dovrei fare una specie di destruction derby, con active players ho provato. Tipo il destruction derby ( in race ) quando sono tutti morti esce un messaggio con scritto: Gino is the last survivor.. Come Posso fare?
-
E' meglio che ti spieghi cosa devo fare.. Se Stanno in quella stanza, e sono tutti morti esce un messaggio nel mio caso un outputchatbox function check1() local alive = getDeadPlayers() for k,v in ipairs(getElementsByType("player")) do local room = getElementData(v,"room") if ("alive" <= 0) then outputChatBox("no vivi") end end end setTimer(check1, 500, -1)
-
Voglio sapere il conteggio dello stato dei giocatori vivi. Con Questo: local g_Me = getLocalPlayer() getElementData(g_Me, "state") ~= "dead" O meglio voglio sapere quanti giocatori hanno lo state dead e se un tot di giocatori sono morti, mi scrive un messaggio in chatbox.
-
I want to get the amount of the state alive players
-
i Want To get the count of the state of alive players local g_Me = getLocalPlayer() function check () alive = getElementData(g_Me, "state") ~= "alive" if alive <= 0 then outputChatBox ("Test") end end
-
Esattamente Hunterix. - No, non si setta automaticamente perchè non è una Race.
-
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)
-
Si, se tipo io devo prendere questo tempo? Come dovrei fare ?
-
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;
-
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
-
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
-
This is the Code Edited( but it don't set the time ) The Defalut Code is this: local realtime = tonumber(string.sub(get("#"..resName..".time"),1,2)) or 0; ( but don't set correctly the time ) local mapMeta = xmlLoadFile(":"..resName.."/meta.xml") if mapMeta then local mapChild = xmlFindChild(mapMeta,"map",0) local mapPath = xmlNodeGetAttributes(mapChild) local mapFile = xmlLoadFile(":"..resName.."/"..mapPath["src"]) --------------------------------------------- for i, v in ipairs(xmlNodeGetChildren(mapMeta)) do local name = xmlNodeGetName(v) if name == "settings" then local sname = xmlNodeGetAttribute(v,"name") if sname == "#time" then local value = xmlNodeGetAttribute(v, "value") if value then value = string.gsub(value, "%s+", "") value = string.gsub(value, "[%[%]]", "") setTime(value:match('(%d+)%d+)')) realtime = value else setTime(0,0) end end end end --------------------------------------------- if mapFile then local tempTable = {} local fileTable = {} local fileSize = 0 local spawnTable = {} local scripts = xmlNodeGetChildren(mapMeta) -- il primo for for i, node in ipairs(scripts) do local type = xmlNodeGetName(node) if type == "script" then local info = xmlNodeGetAttributes(node) if info["type"] and info["type"] == "client" then local hFile = fileOpen (":"..resName.."/"..info["src"],true) if hFile then local size = fileGetSize(hFile) tempTable[#tempTable+1] = {type,fileRead(hFile, size)} fileClose(hFile) end end elseif type == "file" then local info = xmlNodeGetAttributes(node) if info["src"] then --if not string.find(info["src"],".mp3",1) and not string.find(info["src"],".ogg",1) then fileTable[#fileTable+1] = info ["src"] local hFile = fileOpen (":"..resName.."/"..info["src"],true) fileSize = fileSize + fileGetSize (hFile) fileClose(hFile) --end end end end local mapStuff = xmlNodeGetChildren(mapFile) for i,node in ipairs(mapStuff) do local type = xmlNodeGetName(node) local attrs = xmlNodeGetAttributes ( node ) local et = {} local st = {} if type == "object" then local collisions = true; local alpha = 255; local doublesided = false local interior = 0; local scale = 1; if (attrs["interior"]) then interior = attrs["interior"]; end if (attrs["doublesided"]) then doublesided = attrs["doublesided"] end if (attrs["collisions"]) then collisions = attrs["collisions"]; end if (attrs["alpha"]) then alpha = attrs["alpha"]; end if (attrs["MSTalpha"]) then alpha = attrs["MSTalpha"]; end if (attrs["scale"]) then scale = attrs["scale"]; end et = {type,attrs["model"],attrs["posX"],attrs ["posY"],attrs["posZ"],attrs["rotX"],attrs["rotY"],attrs ["rotZ"],interior,collisions,alpha,scale,doublesided} elseif type == "marker" then et = {type,attrs["posX"],attrs["posY"],attrs ["posZ"],attrs["type"],attrs["size"],attrs["color"],attrs["interior"],attrs["id"]} elseif type == "vehicle" then et = {type,attrs["model"],attrs["posX"],attrs ["posY"],attrs["posZ"],attrs["rotX"],attrs["rotY"],attrs["rotZ"]} elseif type == "racepickup" then et = {type,attrs["type"],attrs["vehicle"],attrs ["posX"],attrs["posY"],attrs["posZ"],attrs["rotX"],attrs["rotY"],attrs["rotZ"]} elseif type == "spawnpoint" then et = {type,attrs["vehicle"],attrs["posX"],attrs ["posY"],attrs["posZ"],attrs["rotX"],attrs["rotY"],attrs["rotZ"]} end tempTable[#tempTable+1] = et en local weather = tonumber(get("#"..resName..".weather")) or 0; if (arg2 == 2) then setElementData(source,"Map",mapName2) triggerLatentClientEvent (source,"onServerSendMapTable",200000,false,source,tempTable,0,weather,resName,fileTable,fil eSize); elseif (arg2 == 1) then g_Map["Hunter"] = {tempTable,realtime,weather,resName,fileTable,fileSize,mapName2}; for k,v in ipairs(getElementsByType("player")) do local room = getElementData(v,"room"); if room and (room == 1) then setElementData(v,"Map",mapName2) triggerLatentClientEvent (v,"onServerSendMapTable",200000,false,v,g_Map["Hunter"][1],g_Map["Hunter"][2],g_Map ["Hunter"][3],g_Map["Hunter"][4],g_Map["Hunter"][5],g_Map["Hunter"][6]); end end elseif (arg2 == 4) then g_Map["DM"] = {tempTable,realtime,weather,resName,fileTable,fileSize,mapName2}; for k,v in ipairs(getElementsByType("player")) do local room = getElementData(v,"room"); if room and (room == 4) then setElementData(v,"Map",mapName2) setElementData(v,"Ready",false) setElementData(v,"State","Loading") triggerLatentClientEvent (v,"onServerSendMapTable",200000,false,v,g_Map["DM"][1],g_Map["DM"][2],g_Map["DM"][3],g_Map ["DM"][4],g_Map["DM"][5],g_Map["DM"][6]); end end DMState = "waiting"; elseif (arg2 == 5) then g_Map["DD"] = {tempTable,realtime,weather,resName,fileTable,fileSize,mapName2}; local id = 1; for k,v in ipairs(getElementsByType("player")) do local room = getElementData(v,"room"); if room and (room == 5) then setElementData(v,"Map",mapName2) setElementData(v,"Ready",false) setElementData(v,"State","Loading") triggerLatentClientEvent (v,"onServerSendMapTable",200000,false,v,g_Map["DD"][1],g_Map["DD"][2],g_Map["DD"][3],g_Map ["DD"][4],g_Map["DD"][5],g_Map["DD"][6],id); id = id + 1; end end DDState = "waiting"; elseif (arg2 == 6) then g_Map["Shooter"] = {tempTable,realtime,weather,resName,fileTable,fileSize,mapName2}; for k,v in ipairs(getElementsByType("player")) do local room = getElementData(v,"room"); if room and (room == 6) then setElementData(v,"Map",mapName2) setElementData(v,"Ready",false) setElementData(v,"State","Loading") triggerLatentClientEvent (v,"onServerSendMapTable",200000,false,v,g_Map["Shooter"][1],g_Map["Shooter"][2],g_Map ["Shooter"][3],g_Map["Shooter"][4],g_Map["Shooter"][5],g_Map["Shooter"][6]); end end OSState = "waiting"; end xmlUnloadFile(mapFile) end xmlUnloadFile(mapMeta) end end
-
Ok fixed but it don't set the time
-
Error: end' expected ( to close 'if' at line 165) near 'eof' end expected to close if at line 165 eof --------------- i'm trying to edit the time on the map... if sname == "#time" then --------------- local mapMeta = xmlLoadFile(":"..resName.."/meta.xml") if mapMeta then local mapChild = xmlFindChild(mapMeta,"map",0) local mapPath = xmlNodeGetAttributes(mapChild) local mapFile = xmlLoadFile(":"..resName.."/"..mapPath["src"]) if mapFile then local tempTable = {} local fileTable = {} local fileSize = 0 local spawnTable = {} local scripts = xmlNodeGetChildren(mapMeta) for i, v in ipairs(xmlNodeGetChildren(mapMeta)) do local name = xmlNodeGetName(v) if name == "settings" then local sname = xmlNodeGetAttribute(v,"name") if sname == "#time" then local value = xmlNodeGetAttribute(v, "value") if value then value = string.gsub(value, "%s+", "") value = string.gsub(value, "[%[%]]", "") setTime(value:match('(%d+)%d+)')) else setTime(12,0) end -- il primo for for i, node in ipairs(scripts) do local type = xmlNodeGetName(node) if type == "script" then local info = xmlNodeGetAttributes(node) if info["type"] and info["type"] == "client" then local hFile = fileOpen (":"..resName.."/"..info["src"],true) if hFile then local size = fileGetSize(hFile) tempTable[#tempTable+1] = {type,fileRead(hFile, size)} fileClose(hFile) end end -- local name = xmlNodeGetName(v) -- local sname = xmlNodeGetAttribute(v,"name") -- elseif sname == "#time" then -- local value = xmlNodeGetAttribute(v, "value") --if value then -- value = string.gsub(value, "%s+", "") --value = string.gsub(value, "[%[%]]", "") -- setTime(value:match('(%d+)%d+)')) --mapTime = value --else --setTime(12,0) --end elseif type == "file" then local info = xmlNodeGetAttributes(node) if info["src"] then --if not string.find(info["src"],".mp3",1) and not string.find(info["src"],".ogg",1) then fileTable[#fileTable+1] = info["src"] local hFile = fileOpen (":"..resName.."/"..info["src"],true) fileSize = fileSize + fileGetSize (hFile) fileClose(hFile) --end end end end local mapStuff = xmlNodeGetChildren(mapFile) for i,node in ipairs(mapStuff) do local type = xmlNodeGetName(node) local attrs = xmlNodeGetAttributes ( node ) local et = {} local st = {} if type == "object" then local collisions = true; local alpha = 255; local doublesided = false local interior = 0; local scale = 1; if (attrs["interior"]) then interior = attrs["interior"]; end if (attrs["doublesided"]) then doublesided = attrs["doublesided"] end if (attrs["collisions"]) then collisions = attrs["collisions"]; end if (attrs["alpha"]) then alpha = attrs["alpha"]; end if (attrs["MSTalpha"]) then alpha = attrs["MSTalpha"]; end if (attrs["scale"]) then scale = attrs["scale"]; end et = {type,attrs["model"],attrs["posX"],attrs ["posY"],attrs["posZ"],attrs["rotX"],attrs["rotY"],attrs ["rotZ"],interior,collisions,alpha,scale,doublesided} elseif type == "marker" then et = {type,attrs["posX"],attrs["posY"],attrs ["posZ"],attrs["type"],attrs["size"],attrs["color"],attrs["interior"],attrs["id"]} elseif type == "vehicle" then et = {type,attrs["model"],attrs["posX"],attrs ["posY"],attrs["posZ"],attrs["rotX"],attrs["rotY"],attrs["rotZ"]} elseif type == "racepickup" then et = {type,attrs["type"],attrs["vehicle"],attrs ["posX"],attrs["posY"],attrs["posZ"],attrs["rotX"],attrs["rotY"],attrs["rotZ"]} elseif type == "spawnpoint" then et = {type,attrs["vehicle"],attrs["posX"],attrs ["posY"],attrs["posZ"],attrs["rotX"],attrs["rotY"],attrs["rotZ"]} end tempTable[#tempTable+1] = et end local realtime = tonumber(string.sub(get("#"..resName..".time"),1,2)) or 0; local weather = tonumber(get("#"..resName..".weather")) or 0; if (arg2 == 2) then setElementData(source,"Map",mapName2) triggerLatentClientEvent (source,"onServerSendMapTable",200000,false,source,tempTable,0,weather,resName,fileTable,file Size); elseif (arg2 == 1) then g_Map["Hunter"] = {tempTable,realtime,weather,resName,fileTable,fileSize,mapName2}; for k,v in ipairs(getElementsByType("player")) do local room = getElementData(v,"room"); if room and (room == 1) then setElementData(v,"Map",mapName2) triggerLatentClientEvent (v,"onServerSendMapTable",200000,false,v,g_Map["Hunter"][1],g_Map["Hunter"][2],g_Map ["Hunter"][3],g_Map["Hunter"][4],g_Map["Hunter"][5],g_Map["Hunter"][6]); end end elseif (arg2 == 4) then g_Map["DM"] = {tempTable,realtime,weather,resName,fileTable,fileSize,mapName2}; for k,v in ipairs(getElementsByType("player")) do local room = getElementData(v,"room"); if room and (room == 4) then setElementData(v,"Map",mapName2) setElementData(v,"Ready",false) setElementData(v,"State","Loading") triggerLatentClientEvent (v,"onServerSendMapTable",200000,false,v,g_Map["DM"][1],g_Map["DM"][2],g_Map["DM"][3],g_Map ["DM"][4],g_Map["DM"][5],g_Map["DM"][6]); end end DMState = "waiting"; elseif (arg2 == 5) then g_Map["DD"] = {tempTable,realtime,weather,resName,fileTable,fileSize,mapName2}; local id = 1; for k,v in ipairs(getElementsByType("player")) do local room = getElementData(v,"room"); if room and (room == 5) then setElementData(v,"Map",mapName2) setElementData(v,"Ready",false) setElementData(v,"State","Loading") triggerLatentClientEvent (v,"onServerSendMapTable",200000,false,v,g_Map["DD"][1],g_Map["DD"][2],g_Map["DD"][3],g_Map ["DD"][4],g_Map["DD"][5],g_Map["DD"][6],id); id = id + 1; end end DDState = "waiting"; elseif (arg2 == 6) then g_Map["Shooter"] = {tempTable,realtime,weather,resName,fileTable,fileSize,mapName2}; for k,v in ipairs(getElementsByType("player")) do local room = getElementData(v,"room"); if room and (room == 6) then setElementData(v,"Map",mapName2) setElementData(v,"Ready",false) setElementData(v,"State","Loading") triggerLatentClientEvent (v,"onServerSendMapTable",200000,false,v,g_Map["Shooter"][1],g_Map["Shooter"][2],g_Map ["Shooter"][3],g_Map["Shooter"][4],g_Map["Shooter"][5],g_Map["Shooter"][6]); end end OSState = "waiting"; end xmlUnloadFile(mapFile) end xmlUnloadFile(mapMeta) end end
-
Bad Argument @ExecuteCommandHandler, [Expected element at Argument got nil] DestructionDerby function restartami () setTimer ( function() executeCommandHandler("redo", source, map) outputChatBox ( "Restart" ) end, 3000, 1 ) end addEvent ( "restartami", true ) addEventHandler("restartami", root, restartami) function DestructionDerby:onPlayerWasted(player) if isActivePlayer(player) then self:handleFinishActivePlayer(player) if getMapDM() then if getActivePlayerCount() <= 0 then triggerEvent ( "restartami", getRootElement()) triggerClientEvent ( "showWinMessage", getRootElement()) RaceMode.endMap() else TimerManager.createTimerFor("map",player):setTimer (clientCall, 2000, 1, player, 'Spectate.start', 'auto') end local activePlayers = getActivePlayers() if getActivePlayerCount() == 1 then if getElementModel(getPedOccupiedVehicle(activePlayers[1])) == 425 then setElementHealth(activePlayers[1],0) end end else if getActivePlayerCount() <= 1 then triggerClientEvent ( "showWinMessage", getRootElement()) RaceMode.endMap() else TimerManager.createTimerFor("map",player):setTimer (clientCall, 2000, 1, player, 'Spectate.start', 'auto') end end end RaceMode.setPlayerIsFinished(player) showBlipsAttachedTo(player, false) end
