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

Wysłany: 2015-06-20, 15:45


Dixers

No-Life






Wiek: 26
Na forum: 4454 dni
Posty: 549
Nick w MP: Dixers

Piwa: 412

Respekt: 56,8

Siema. Mam kod Maxi'ego i problem polega w tym, ?e jak TYLKO zmieniam id pojazdu w tym przypadku z 596 na 418 pojawia si? b??d i db, kt?ry m?wi:
ERROR:aplety_c.lua:18:attempt to perform arithmetic on local 'z' (a nil value)

Chodzi o t? linijk?:

local marker = createMarker ( x, y, z-1, "cylinder", 3, 255, 0, 0, 170 )


Ca?y kod (c-side):


okno = guiCreateWindow(419, 223, 525, 275, "Interakcja Pojazdu Specjalnego", false)
guiWindowSetSizable(okno, false)
zamknij = guiCreateButton(290, 203, 216, 52, "Zamknij", false, okno)
grid = guiCreateGridList(14, 29, 262, 226, false, okno)
guiGridListAddColumn(grid , "Interakcja", 0.9)
opis = guiCreateLabel(290, 31, 216, 113, "Interakcje Pojazdu Specjalnego", false, okno)
guiLabelSetHorizontalAlign(opis, "center", false)
guiLabelSetVerticalAlign(opis, "center")
guiSetVisible ( okno, false )

player = getLocalPlayer()

function klikam()
local auto = getPedOccupiedVehicle ( localPlayer )
if isPedInVehicle ( player ) and getElementModel ( auto ) == 418 then
if not getElementData ( auto, "int:specjalna" ) then
local x,y,z = getVehicleComponentPosition ( auto, "boot_dummy", "world" )
local marker = createMarker ( x, y, z-1, "cylinder", 3, 255, 0, 0, 170 )
setElementFrozen ( auto, true )
outputChatBox ( "W??czy?e? interakcje pojazdu specjalnego.")
setElementData ( auto, "int:specjalna", true )
setElementData ( marker, "marker:specjalny", getPlayerName ( localPlayer ) )
setElementData ( localPlayer, "player:specjalny", true)
setVehicleDoorState ( auto, 1, 1 )
else
setElementFrozen ( auto, false)
for _,v in ipairs ( getElementsByType ( "marker" ) ) do
if getElementData ( v, "marker:specjalny") == getPlayerName ( localPlayer ) then
destroyElement ( v )
end
end
setElementData ( auto, "int:specjalna", false )
setElementData ( localPlayer, "player:specjalny", false )
outputChatBox ( "Wy??czy?e? interakcje pojazdu specjalnego.")
setVehicleDoorState ( auto, 1, 0 )
end
end
end
addCommandHandler ( "lspd", klikam)

function MarkerHit ( element )
if element ~= getLocalPlayer() then return end
if getElementData ( localPlayer, "player:specjalny") then
if not isPedInVehicle ( localPlayer ) then
local row = guiGridListAddRow (grid)
local row1 = guiGridListAddRow (grid)
local row2 = guiGridListAddRow (grid)
local row3 = guiGridListAddRow (grid)
guiGridListSetItemText(grid, row, 1, "Linia ga?nicza", false, false)
guiGridListSetItemText(grid, row1, 1, "Pi?a motorowa", false, false)
guiGridListSetItemText(grid, row3, 1, "AODO", false, false)
guiSetVisible ( okno, true )
showCursor ( true )
end
end
end
addEventHandler ( "onClientMarkerHit", getRootElement(), MarkerHit )

function close()
guiSetVisible ( okno, false )
showCursor ( false )
guiGridListClear ( grid )
end
addEventHandler ( "onClientGUIClick", zamknij, close, false )

function p1()
local wyb = guiGridListGetItemText(grid, guiGridListGetSelectedItem (grid), 1)
if wyb == "Linia ga?nicza" then
triggerServerEvent ("interakcjaEMKA", getRootElement(), player )
end
end
addEventHandler ( "onClientGUIClick", grid, p1, false )

function p2()
local wyb = guiGridListGetItemText(grid, guiGridListGetSelectedItem (grid), 1)
if wyb == "Pi?a motorowa" then
triggerServerEvent ("interakcjaDeagle", getRootElement(), player )
end
end
addEventHandler ( "onClientGUIClick", grid, p2, false )

function p4()
local wyb = guiGridListGetItemText(grid, guiGridListGetSelectedItem (grid), 1)
if wyb == "AODO" then
triggerServerEvent ("interakcjaArmor", getRootElement(), player )
end
end
addEventHandler ( "onClientGUIClick", grid, p4, false )


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-06-20, 16:23


Jurandovsky

Kurdebele






Wiek: 17
Na forum: 4980 dni
Posty: 915

Piwa: 2697

Respekt: 955,3
Respekt: 955,3Respekt: 955,3

A usun z-1 i zostaw samo z daj znac jaki wynik

Podpis
Jedyny kontakt ze mną to PW forum

Kod:


local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-06-20, 17:00


Dixers

No-Life






Wiek: 26
Na forum: 4454 dni
Posty: 549
Nick w MP: Dixers

Piwa: 412

Respekt: 56,8

Usuwa?em, dalej jest problem. Ju? nie ERROR, ale WARRING i marker si? w og?le i tak nie pojawia. A nawet jakby si? pojawia?, to na ?rodku pojazdu, zamiast przy baga?niku.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-06-20, 17:44


Jurandovsky

Kurdebele






Wiek: 17
Na forum: 4980 dni
Posty: 915

Piwa: 2697

Respekt: 955,3
Respekt: 955,3Respekt: 955,3

Bo z to jest wysoko??.
Spr?buj zrobi? to tak :


local x,y,z = getVehicleComponentPosition ( auto, "boot_dummy", "world" )
local marker = createMarker ( x, y-2, z, "cylinder", 3, 255, 0, 0, 170 )


Podpis
Jedyny kontakt ze mną to PW forum

Kod:


local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-06-20, 17:45


Dixers

No-Life






Wiek: 26
Na forum: 4454 dni
Posty: 549
Nick w MP: Dixers

Piwa: 412

Respekt: 56,8

Iksdekowski, g?upi nie jestem. Pr?bowa?em. A co to za r??nica, ?e to wysoko??. Mo?e ja chc?, aby by?o wy?ej. Robi?c tak jak pokazujesz wyskakuje db ten pierwszy tyle ?e zamiast 'z' jest napisane 'y'.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-06-20, 17:54


Jurandovsky

Kurdebele






Wiek: 17
Na forum: 4980 dni
Posty: 915

Piwa: 2697

Respekt: 955,3
Respekt: 955,3Respekt: 955,3

Probowales to zrobic z innym pojazdem? np. Premier? Sprobuj z premierem

Podpis
Jedyny kontakt ze mną to PW forum

Kod:


local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-06-20, 17:59


Dixers

No-Life






Wiek: 26
Na forum: 4454 dni
Posty: 549
Nick w MP: Dixers

Piwa: 412

Respekt: 56,8

W premierze dzia?a. S?dzisz, ?e problem le?y w tym w jakim poje?dzie ma si? pojawia??

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-06-20, 18:01


Jurandovsky

Kurdebele






Wiek: 17
Na forum: 4980 dni
Posty: 915

Piwa: 2697

Respekt: 955,3
Respekt: 955,3Respekt: 955,3

Tak, moonbeam mo?e nie mie? baga?nika.

Podpis
Jedyny kontakt ze mną to PW forum

Kod:


local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-06-20, 18:05


Dixers

No-Life






Wiek: 26
Na forum: 4454 dni
Posty: 549
Nick w MP: Dixers

Piwa: 412

Respekt: 56,8

A znaczy na moonbeamie dzia?a. A rozumiem. Czyli to wyszukuje baga?nik. Taka troch? lipa. Nie spojrza?em. Dzi?ki za pomoc. Stawiam :piwo: i R*

Postaw piwo autorowi tego posta
 

 
Tagi: markery :: przy :: aucie
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