Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2014-10-04, 01:39


Artysta

Lua, Lua, Czekolada






Wiek: 28
Na forum: 4466 dni
Posty: 240
Nick w MP: Artysta/Koojot

Piwa: 1427

Respekt: 205,8
Respekt: 205,8Respekt: 205,8

Witam serdecznie.
Mam problem, i? chc? wczyta? wszystkie pojazdy z pliku xml a wczytuje si? tylko jeden. Wydaje mi si?, ?e trzeba tu jak?? p?tle lecz nie mam zielonego poj?cia jak j? zrobi? z xlm :D


function wczytujemypojazdy ()
config xmlLoadFile("nowy.xml")
if config then
outputChatBox("Wczytano"source,255255255)

local model xmlNodeGetAttribute(config"model")
local x xmlNodeGetAttribute(config"x")
local y xmlNodeGetAttribute(config"y")
local z xmlNodeGetAttribute(config"z")
local pojazd createVehicle modelxy)
end
end
addCommandHandler("wczytaj"wczytujemypojazdy )


Podpis
Something is coming..
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-10-04, 09:40


TheTroll

Pan Majster






Wiek: 38
Na forum: 4764 dni
Posty: 219
Nick w MP: TheTroll

Piwa: 1114

Respekt: 120
Respekt: 120

Poka? tw?j plik xml.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-10-04, 10:21


Tostuch







Wiek: 27
Na forum: 4931 dni
Posty: 483
Nick w MP: Tost

Piwa: 137

Respekt: 110
Respekt: 110

Artysta, g?odny by?e?, ?e nawiasy pozjada?e? ? :D

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-10-04, 11:23


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4395 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

for k,v in ipairs xmlNodeGetChildren config ) ) do


Podpis

https://shufflecode.pl
Static Codes and Graphics - Join our discord!
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-10-04, 15:28


Artysta

Lua, Lua, Czekolada






Wiek: 28
Na forum: 4466 dni
Posty: 240
Nick w MP: Artysta/Koojot

Piwa: 1427

Respekt: 205,8
Respekt: 205,8Respekt: 205,8

A w dobry spos?b to zapisuj? w xml ?

root>
    <auto model="521" x="-1540.5615234375" y="967.8662109375" z="6.6133456230164" hp="1000" r="63" g="62" b="69" r2="163" g2="173" b2="198" wlasciciel="Davido" id="1"></auto>
    <auto model="586" x="-1540.2734375" y="969.9560546875" z="6.534679889679" hp="993" r="70" g="89" b="122" r2="245" g2="245" b2="245" wlasciciel="Davido" id="2"></auto>
</ root>


Podpis
Something is coming..
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-10-04, 15:41


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4395 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Skoro robisz xml to powiniene? to wiedzie?. Tak dobry.

Podpis

https://shufflecode.pl
Static Codes and Graphics - Join our discord!
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-10-04, 15:46


Artysta

Lua, Lua, Czekolada






Wiek: 28
Na forum: 4466 dni
Posty: 240
Nick w MP: Artysta/Koojot

Piwa: 1427

Respekt: 205,8
Respekt: 205,8Respekt: 205,8

Wi?c z t? p?tl? nic si? nie dzieje ani nie wywala.

for k,v in ipairs xmlNodeGetChildren config ) ) do


Podpis
Something is coming..
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-10-04, 16:49


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4395 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Bo da?em Ci sam? p?tle, a nie gotowca.. Musisz u?yc jeszcze xmlNodeGetAttribute do pobrania odpowiednich child?w.

Podpis

https://shufflecode.pl
Static Codes and Graphics - Join our discord!
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-10-04, 21:35


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

Artysta, hmm to nie jest trudne dam ci przyk?ad.
Urywek z mojego Panelu Lidere
function WejdzDoPaneluLidera(player)
local xml xmlLoadFile "config/lider.xml")
    if xml  then
        local file xmlFindChild (xml,"lider",0)
            for i,logowanielista in ipairs (xmlNodeGetChildren(file)) do
                frakcjanazwa xmlNodeGetAttribute (logowanielista,"acl")
                lidernazwa xmlNodeGetAttribute (logowanielista,"liderowiec")
                local ac getPlayerAccountplayer )
                local aclem getAccountNameac )
                    if lidernazwa == aclem then
                        triggerClientEvent(player,"pokazPanelLidera"getRootElement(), frakcjanazwa )
                    end
            end
    end
xmlUnloadFile(xml)    
end
--//Place-Game Projekt RPG 2014


[ Dodano: 2014-10-04, 21:36 ]
PS: Struktura xml:
<root>
    <lider>
       <lider acl="Policja" liderowiec="luki123luki" >Policja</lider>
       <lider acl="Pomoc Drogowa" liderowiec="login" >Pomoc Drogowa</lider>
       <lider acl="Pogotowie" liderowiec="login" >Pogotowie</lider>
       <lider acl="Taxi" liderowiec="login" >Taxi</lider>
       <lider acl="Salon" liderowiec="login" >Salon</lider>
       <lider acl="Ammo" liderowiec="login" >Ammunation</lider>
       <lider acl="Petrol" liderowiec="login" >Petrol</lider>
    </lider> 
</root>


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-10-05, 16:10


Artysta

Lua, Lua, Czekolada






Wiek: 28
Na forum: 4466 dni
Posty: 240
Nick w MP: Artysta/Koojot

Piwa: 1427

Respekt: 205,8
Respekt: 205,8Respekt: 205,8

Pr?bowa?em tak ale tylko wywala.


function wczytujemypojazdy ()
local config xmlLoadFile("nowy.xml")
if config then
outputChatBox("Wczytano"source,255255255)
        local file xmlFindChild (config,"auto",0)
for i,v in ipairs (xmlNodeGetChildren(file)) do
local model xmlNodeGetAttribute(v"model")
local x xmlNodeGetAttribute(v"x")
local y xmlNodeGetAttribute(v"y")
local z xmlNodeGetAttribute(v"z")
local pojazd createVehicle modelxy)
end
end
end
addCommandHandler("wczytaj"wczytujemypojazdy )


Podpis
Something is coming..
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-10-05, 16:25


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

Artysta, niemo?liwe sam tak mam zawsz? w panelach i zawsz? dzia?a.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-10-05, 17:12


Artysta

Lua, Lua, Czekolada






Wiek: 28
Na forum: 4466 dni
Posty: 240
Nick w MP: Artysta/Koojot

Piwa: 1427

Respekt: 205,8
Respekt: 205,8Respekt: 205,8

Wywala takie co?.



Xml

root>
    <auto model="521" x="-1540.5615234375" y="967.8662109375" z="6.6133456230164" hp="1000" r="63" g="62" b="69" r2="163" g2="173" b2="198" wlasciciel="Davido" id="1"></auto>
    <auto model="586" x="-1540.2734375" y="969.9560546875" z="6.534679889679" hp="993" r="70" g="89" b="122" r2="245" g2="245" b2="245" wlasciciel="Davido" id="2"></auto>
</ root>




Podpis
Something is coming..
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-10-05, 18:01


TheTroll

Pan Majster






Wiek: 38
Na forum: 4764 dni
Posty: 219
Nick w MP: TheTroll

Piwa: 1114

Respekt: 120
Respekt: 120

Spr?buj tak

function wczytujemypojazdy ()
local config xmlLoadFile("nowy.xml")
if config then
outputChatBox("Wczytano"source,255255255)
        local file xmlFindChild (config,"root",0)
for i,v in ipairs (xmlNodeGetChildren(file)) do
local model xmlNodeGetAttribute(v"model")
local x xmlNodeGetAttribute(v"x")
local y xmlNodeGetAttribute(v"y")
local z xmlNodeGetAttribute(v"z")
local pojazd createVehicle modelxy)
end
end
end
addCommandHandler("wczytaj"wczytujemypojazdy )


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-10-05, 18:13


Artysta

Lua, Lua, Czekolada






Wiek: 28
Na forum: 4466 dni
Posty: 240
Nick w MP: Artysta/Koojot

Piwa: 1427

Respekt: 205,8
Respekt: 205,8Respekt: 205,8

Nadal wywala tak samo.

Podpis
Something is coming..
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-10-05, 18:42


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4395 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Napisz do mnie, mam do sprzedania dopiero co pisany system zapisu aut xml.

Podpis

https://shufflecode.pl
Static Codes and Graphics - Join our discord!
Postaw piwo autorowi tego posta
 

 
Tagi: xml :: wczytujemy :: zawartości :: tych :: samy :: nazwach
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku