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

Wysłany: 2014-06-01, 16:17


Bilguun







Wiek: 26
Na forum: 5071 dni
Posty: 133
Nick w MP: Bilguun

Piwa: 4

Respekt: 50

Ostrzeżeń: 20%
Witam, nie wiem dlaczego ustawiam warto?? tak: setElementData(pojazd,"veh:spawned",v.spawned) oczywi?cie v.spawned ==1

a jak daje:

for k,v in ipairs(getElementsByType("vehicle"))do
local test getElementData(v,"veh:spawned")
outputChatBox(tostring(test))--zwraca false
end

Dlaczego to zwraca false ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-06-01, 16:32


MeeShuffle

Programista/Grafik






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

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Poka? setEleemntData

Podpis

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

 
Wysłany: 2014-06-01, 17:13


Bilguun







Wiek: 26
Na forum: 5071 dni
Posty: 133
Nick w MP: Bilguun

Piwa: 4

Respekt: 50

Ostrzeżeń: 20%
Poda?em przecierz . . .
setElementData(pojazd,"veh:spawned",v.spawned) oczywi?cie v.spawned ==1

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-06-01, 22:00


MeeShuffle

Programista/Grafik






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

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Co pobiera ? String czy number ?

Podpis

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

 
Wysłany: 2014-06-01, 22:08


Bilguun







Wiek: 26
Na forum: 5071 dni
Posty: 133
Nick w MP: Bilguun

Piwa: 4

Respekt: 50

Ostrzeżeń: 20%
String, ale gdy u?ywam getElementData to robie tonumber(getElementData......)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-06-01, 22:11


MeeShuffle

Programista/Grafik






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

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Je?li string nie dawaj tostring, daj zwyk?e getElementData. Co do sprawdzenia :

addCommandHandler "sprawdz", function()
for k,v in ipairs getElementsByType "vehicle") ) do
outputChatBox getElementData v"veh:spawned" ), root )
end
end)


Zaczniemy od podstaw, czyli sprawdzenia czy nada?o date.

Podpis

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

 
Wysłany: 2014-06-02, 13:23


Wielebny







Wiek: 41
Na forum: 5498 dni
Posty: 257
Nick w MP: Wielebny

Piwa: 1690

Respekt: 180
Respekt: 180Respekt: 180

Skoro getElementData zwraca false, to ewidentnie jest tam false. B??d musi si? znajdowa? we fragmencie kodu, kt?rego nie pokazujesz.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-06-02, 16:46


Bilguun







Wiek: 26
Na forum: 5071 dni
Posty: 133
Nick w MP: Bilguun

Piwa: 4

Respekt: 50

Ostrzeżeń: 20%
Ale nie ma b??d?w w debugu, a v.spawned na pewno zwraca warto?? string "1"

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-06-02, 16:46


MeeShuffle

Programista/Grafik






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

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Sprawd? to kodem kt?ry poda?em wy?ej. Sprawdzimy co nada?o.

Podpis

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

 
Wysłany: 2014-06-02, 17:25


Bilguun







Wiek: 26
Na forum: 5071 dni
Posty: 133
Nick w MP: Bilguun

Piwa: 4

Respekt: 50

Ostrzeżeń: 20%
Sprawdzi?em, i na czecie wyskakuje 1 ale w debugu pisz? bad argument @ outputChatBox [EXPETCED STRING AT ARGUMENT 1, GOT BOOLEAN]

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-06-02, 17:28


MeeShuffle

Programista/Grafik






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

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

addCommandHandler ( "sprawdz", function()
for k,v in ipairs ( getElementsByType ( "vehicle") ) do
x = getElementData ( v, "veh:spawned" )
outputChatBox ( x, root )
end
end)


Spr?buj tak.

Podpis

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

 
Wysłany: 2014-06-02, 17:33


Bilguun







Wiek: 26
Na forum: 5071 dni
Posty: 133
Nick w MP: Bilguun

Piwa: 4

Respekt: 50

Ostrzeżeń: 20%
local x getElementData ( v, "veh:spawned" ) *

To samo :(

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-06-02, 17:36


MeeShuffle

Programista/Grafik






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

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Nie local, tylko global ma by?.

Podpis

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

 
Wysłany: 2014-06-02, 17:47


Bilguun







Wiek: 26
Na forum: 5071 dni
Posty: 133
Nick w MP: Bilguun

Piwa: 4

Respekt: 50

Ostrzeżeń: 20%
Dalej nic.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-06-02, 17:48


MeeShuffle

Programista/Grafik






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

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Ten sam b??d ?

Podpis

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

 
Tagi: getelementdata :: zwraca :: false
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » getElementData zwraca false 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