Wysłany: 2014-05-06, 19:11
luki123luki123
Place Game
Wiek: 28 Na forum: 5275 dni Posty: 1948
Nick w MP: LuKiO
Piwa : 6101
Witam mam plik xml i chcia?bym wyszuka? wiersz gdzie b?dzie taki sam argument co podaje przy komendzie. Jak to zrobi? ?
Wysłany: 2014-05-06, 19:40
Vike4562
LUA <3
Wiek: 28 Na forum: 4937 dni Posty: 144
Nick w MP: Vike4562
Piwa : 32
Strona to: server
Kod: function odczytplikuXML()
local xml = xmlLoadFile ("plik.xml" )
if xml then
local i = 0
while xmlFindChild (xml, "Wiersz", i ) do
local find = xmlFindChild (xml, "Wiersz", i )
if tostring(xmlNodeGetAttribute(find,"argument")) == argument then
outputChatBox("Znaleziono argument w linijce: "..i.."", source, 255, 255, 255)
end
i = i + 1
end
xmlUnloadFile(xml)
end
return tonumber(0)
end
Wysłany: 2014-05-06, 20:14
luki123luki123
Place Game
Wiek: 28 Na forum: 5275 dni Posty: 1948
Nick w MP: LuKiO
Piwa : 6101
Vike4562 , jak teraz odczyta? co? z tego wiersza
local xml = xmlLoadFile ( "config/auta.xml" )
if xml then
local i = 0
while xmlFindChild ( xml , "Pojazdy" , i ) do
local find = xmlFindChild ( xml , "Pojazdy" , i )
if tostring ( xmlNodeGetAttribute ( find , "tablica" )) == tablica then
local wlaciciel = xmlNodeGetAttribute ( find , "rejestracja-na" )
end
i = i + 1
end
xmlUnloadFile ( xml )
end
return tonumber ( 0 )
Wysłany: 2014-05-06, 20:37
Vike4562
LUA <3
Wiek: 28 Na forum: 4937 dni Posty: 144
Nick w MP: Vike4562
Piwa : 32
Jak na przyk?ad wywo?ujesz funkcje tak:
Kod: function skrypt()
jakastamfunckja(rejestracja)
outputChatBox("Co? tam: "..rejestracja.."", source)
end
Kod:
function jakastamfunkcja()
local xml = xmlLoadFile ("config/auta.xml" )
if xml then
local i = 0
while xmlFindChild (xml, "Pojazdy", i ) do
local find = xmlFindChild (xml, "Pojazdy", i )
if tostring(xmlNodeGetAttribute(find,"tablica")) == tablica then
return xmlNodeGetAttribute(find,"rejestracja-na")
end
i = i + 1
end
xmlUnloadFile(xml)
end
return tonumber(0)
end
w: if tostring(xmlNodeGetAttribute(find,"tablica")) == tablica then musisz da? z czym to ma por?wna? chodzi o: tablica
Wysłany: 2014-05-06, 20:52
Vike4562
LUA <3
Wiek: 28 Na forum: 4937 dni Posty: 144
Nick w MP: Vike4562
Piwa : 32
ale chcesz ?eby zwr?ci?o wla?ciciel'a pojazdu ?
Wysłany: 2014-05-06, 20:56
luki123luki123
Place Game
Wiek: 28 Na forum: 5275 dni Posty: 1948
Nick w MP: LuKiO
Piwa : 6101
Vike4562 , chce spawdzic co jest w tym argumencie
Wysłany: 2014-05-06, 21:00
Vike4562
LUA <3
Wiek: 28 Na forum: 4937 dni Posty: 144
Nick w MP: Vike4562
Piwa : 32
Kod: addEvent("S-P-P", true)
addEventHandler("S-P-P", getRootElement(), przerejestowanie_pojazdu)
sprawdzasz to z client'a prawda?
co masz tam takiego ?e zrobisz tego w server? og?lnie ?atwiej by by?o ( przynajmniej jak ja bym to robi? )
ale je?eli musi by? w client to mo?esz u?y? triggera powrotnego do clienta "triggerClientEvent" z argumentem w?a?ciciela
Wysłany: 2014-05-06, 21:02
luki123luki123
Place Game
Wiek: 28 Na forum: 5275 dni Posty: 1948
Nick w MP: LuKiO
Piwa : 6101
Vike4562 , to tak ja to z klient do serwer przenosz? i moj? pytanie jak te spawdzic w tym xml nie odbiegajmy od tematu
Wysłany: 2014-05-06, 21:12
Vike4562
LUA <3
Wiek: 28 Na forum: 4937 dni Posty: 144
Nick w MP: Vike4562
Piwa : 32
no to tu masz sprawdzenie co jest w argumencie:
Kod: function przerejestowanie_pojazdu(player, komu)
local auto = getPedOccupiedVehicle( player )
if auto then
local tablica = getVehiclePlateText ( auto )
--Poczatek XML
local xml = xmlLoadFile ("config/auta.xml" )
if xml then
local i = 0
while xmlFindChild (xml, "Pojazdy", i ) do
local find = xmlFindChild (xml, "Pojazdy", i )
if tostring(xmlNodeGetAttribute(find,"tablica")) == tablica then
local wlaciciel = xmlNodeGetAttribute(find,"rejestracja-na")
end
i = i + 1
end
xmlUnloadFile(xml)
end
return tonumber(0)
--Koniec xml
end
addEvent("S-P-P", true)
addEventHandler("S-P-P", getRootElement(), przerejestowanie_pojazdu)
pod "local wlaciciel = xmlNodeGetAttribute(find,"rejestracja-na")" mo?esz da? "outputChatBox(wlasciciel)" i b?dziesz wiedzia? czy sprawdza dobrze.
Tagi: szukanie :: xml
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: