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

Wysłany: 2015-01-16, 21:16


Sekllik

owner - newRPG






Wiek: 25
Na forum: 4374 dni
Posty: 23
Nick w MP: Sekllik

Piwa: 139

Respekt: 12

Ostrzeżeń: 20%
Witam i? posiadam skrypt na zapis aut w XML ale jest problem poniewa? jak pisze /zapisz to wyskakuje b??d w DB3 (debugscript 3) SS :
A o to skrypt:


addCommandHandler ( "zapisz", function ( plr )
    local accName = getAccountName ( getPlayerAccount ( plr ) )
    if not isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then
        return outputChatBox ( "Nie posiadasz praw Administratora", plr, 255, 0, 0 ) end
    xml = xmlLoadFile ( "xml.xml" )
    for _,v in ipairs ( xmlNodeGetChildren ( xml ) ) do
        xmlDestroyNode ( v )
    end
    xmlSaveFile ( xml )
    for _,v in ipairs ( getElementsByType ( "vehicle" ) ) do
        model = getElementModel ( v )
        x,y,z = getElementPosition ( v )
        c1,c2,c3,c4,c5,c6 = getVehicleColor ( v )
        r1,r2,r3 = getVehicleRotation ( v )
        child = xmlCreateChild ( xml, "pojazd" )
        id = tonumber ( getElementData ( v, "id" ) )
        owner = getElementData ( v, "owner" )
            if not tonumber ( getElementData ( v, "id" ) ) then
                id = tonumber ( math.random ( 1, 1000 ) ) end
            if not owner then
            owner = "Publiczne" end
        xmlNodeSetAttribute ( child, "model", tonumber(model) )
        xmlNodeSetAttribute ( child, "x", tonumber(x) )
        xmlNodeSetAttribute ( child, "y", tonumber(y) )
        xmlNodeSetAttribute ( child, "z", tonumber(z) )
        xmlNodeSetAttribute ( child, "color1", tonumber(c1) )
        xmlNodeSetAttribute ( child, "color2", tonumber(c2) )
        xmlNodeSetAttribute ( child, "color3", tonumber(c3) )
        xmlNodeSetAttribute ( child, "color4", tonumber(c4) )
        xmlNodeSetAttribute ( child, "color5", tonumber(c5) )
        xmlNodeSetAttribute ( child, "color6", tonumber(c6) )
        xmlNodeSetAttribute ( child, "rotation1", tonumber(r1) )
        xmlNodeSetAttribute ( child, "rotation2", tonumber(r2) )
        xmlNodeSetAttribute ( child, "rotation3", tonumber(r3) )
        xmlNodeSetAttribute ( child, "owner", owner )
        xmlNodeSetAttribute ( child, "id", tonumber(id) )
    end
    xmlSaveFile ( xml )
    if xml then
        outputChatBox ( "Pojazdy zapisane", plr )
        xmlUnloadFile ( xml )
    end
end)



addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource() ), function ()
    xml = xmlLoadFile ( "xml.xml" )
    for _,v in ipairs ( xmlNodeGetChildren ( xml ) ) do
        model = tonumber ( xmlNodeGetAttribute ( v, "model" ) )
        id = tonumber ( xmlNodeGetAttribute ( v, "id" ) )
        owner = xmlNodeGetAttribute ( v, "owner" )
        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" ) )
        r1, r2, r3 = tonumber ( xmlNodeGetAttribute ( v, "rotation1" ) ), tonumber ( xmlNodeGetAttribute ( v, "rotation2" ) ), tonumber ( xmlNodeGetAttribute ( v, "rotation3" ) )
        auto = createVehicle ( model, x,y,z, r1, r2, r3 ) 
        setVehicleColor ( auto, c1, c2, c3, c4, c5, c6 )
        setElementData ( auto, "owner", owner )
        setElementData ( auto, "id", id )
    end
end)


addEventHandler ( "onVehicleStartEnter", root, function ( gracz, miejsce, kierowca )
    if kierowca then
        name = getPlayerName ( kierowca )
        return outputChatBox ( "*"..name.." ju? prowadzi ten pojazd!", gracz, 255, 255, 255 ) end
        if miejsce ~= 0 then return end
        if getElementData ( source, "owner" ) == "Publiczne" then 
        return outputChatBox ( "Pami?taj, ?e prowadzenie publicznego pojazdu jest nielegalne!", plr, 255, 255, 255 ) end
        if getElementData ( source, "owner" ) ~= getPlayerName ( gracz ) then
        outputChatBox ( "* Ten pojazd nale?y do "..getElementData ( source, "owner" ).."!", gracz, 255, 255, 255 ) 
            return cancelEvent() end
end)


Ostatnio zmieniony przez Sekllik 2015-01-16, 21:53, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-01-16, 21:45


Fanciak

BOT






Wiek: 26
Na forum: 4587 dni
Posty: 728
Nick w MP: Fanciak

Piwa: 1572

Respekt: 500
Respekt: 500

W [.lua] [./lua] to daj - bez kropek

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-01-16, 21:51


Wittx

8===D






Wiek: 27
Na forum: 4935 dni
Posty: 121
Nick w MP: wittula

Piwa: 1906

Respekt: 120
Respekt: 120

XML si? nie nadaje jako baza danych. Prawda jest taka, ?e je?li dwie osoby naraz u?yj? tej komendy - XML pada na dechy (trzeba otworzyc plik i go zamkn??). Co innego w SQL. Radzi?bym Tobie zapozna? si? z SQL. Na przysz?o?? bardzo przydatne. ;)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-01-16, 23:23


MeeShuffle

Programista/Grafik






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

Piwa: 8578

Respekt: 535,3
Respekt: 535,3

To m?j stary kod, kt?ry jak powiedzia? banan, nie nadaje si? na baz?. wstawi? nied?ugo zapis MySQL pojazd?w, jak znajd? czas.

Podpis

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

 
Wysłany: 2015-01-17, 12:12


Piorun







Wiek: 33
Na forum: 6853 dni
Posty: 1837
Nick w MP: Piorun

Piwa: 516

Respekt: 480,7
Respekt: 480,7

Polecam zapozna? si? z tym :) -> https://www.youtube.com/watch?v=Erj1DDCZywM

Podpis
Możesz mnie znaleźć na: Facebook
Postaw piwo autorowi tego posta
 

 
Tagi: skrypt :: zapisu :: 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 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