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

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


TheTroll

Pan Majster






Wiek: 39
Na forum: 4905 dni
Posty: 219
Nick w MP: TheTroll

Piwa: 1117

Respekt: 120
Respekt: 120

Po w??czeniu skryptu powinno stworzy? pojazd.

function spawnAut()
local xml = xmlLoadFile("auta.xml")
for i,v in ipairs (xmlNodeGetChildren(xml)) do
local modelauta = xmlNodeGetAttribute(v, "model")
local carX = xmlNodeGetAttribute(v, "posX")
local carY = xmlNodeGetAttribute(v, "posY")
local carZ = xmlNodeGetAttribute(v, "posZ")
local carRot = xmlNodeGetAttribute(v, "rot")
createVehicle(modelauta, tonumber(carX), tonumber(carY), tonumber(carZ), 0.0, 0.0, tonumber(carRot))
end
end
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), spawnAut)


Postaw piwo autorowi tego posta
 

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


Maximerr

Programmer PHP, LUA






Wiek: 25
Na forum: 4568 dni
Posty: 548

Piwa: 1051

Respekt: 365,3
Respekt: 365,3Respekt: 365,3Respekt: 365,3Respekt: 365,3

Nie tworzy.

PS. W xml mam tylko to, a czy nie powinnieniem doda? jeszcze czego??
<car model="528" posX="361.82711791992" posY="1365.4108886719" posZ="7.9832935333252" rot="90.0" />


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-10-05, 14:41


MeeShuffle

Programista/Grafik






Wiek: 33
Na forum: 4536 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8578

Respekt: 535,3
Respekt: 535,3

Pod wiecz?r wstawi? ca?y skrypt na zapis aut, macie tu kawa?ek kodu na spawn :

addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource() ), function ()
    xml = xmlLoadFile ( "auta.xml" )
    for _,v in ipairs ( xmlNodeGetChildren ( xml ) ) do
        id = tonumber ( xmlNodeGetAttribute ( v, "id" ) )
        x,y,z = tonumber ( xmlNodeGetAttribute ( v, "x" ) ), tonumber ( xmlNodeGetAttribute ( v, "y" ) ), tonumber ( xmlNodeGetAttribute ( v, "z" ) )
        c1, c2, c3 = tonumber ( xmlNodeGetAttribute ( v, "color1" ) ), tonumber ( xmlNodeGetAttribute ( v, "color2" ) ), tonumber ( xmlNodeGetAttribute ( v, "color3" ) )
        c4, c5, c6 = tonumber ( xmlNodeGetAttribute ( v, "color4" ) ), tonumber ( xmlNodeGetAttribute ( v, "color5" ) ), tonumber ( xmlNodeGetAttribute ( v, "color6" ) )
        auto = createVehicle ( id, x,y,z ) 
        setVehicleColor ( auto, c1, c2, c3, c4, c5, c6 )
    end
end)


Podpis

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

 
Tagi: zapis :: aut :: xml
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Zapis aut w xml 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