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

Wysłany: 2015-09-29, 17:18


INVWHIL3

*Padawan Lua*






Wiek: 27
Na forum: 3968 dni
Posty: 41
Nick w MP: LEURCEDICIUS

Piwa: 472

Respekt: 50

Kod:

addEventHandler "onElementClicked"root,
    function ( mouseButton )
        local elementType getElementType source )
        if ( elementType == "vehicle" then
            if ( mouseButton == "left" then -- niszczenie
                destroyElement source )
            elseif ( mouseButton == "right" then -- naprawa
                fixVehicle source )
            end
        elseif ( elementType == "player" then
            local car getPedOccupiedVehicle source )
            if ( mouseButton == "left" then -- niszczenie
                destroyElement car )
            elseif ( mouseButton == "right" then -- naprawa
                fixVehicle car )
            end
        end
    end
)


Konsola wywala:
Kod:


WARNING:13: Bad argument @ 'destroyElement' [Expected element at argument 1, got boolean]
WARNING:15: Bad argument @ 'fixVehicle' [Expected element at argument 1, got boolean]


Fix/destroy :p dzia?a tylko w panelu (p) po szybkim klikni?ciu myszk? podczas jego otwierania ..
Chodzi o destroy lub fix za pomoc? broni ;p (lewy,prawy przycisk)

ps:ten kawa?ek kodu jest dopisywany do skryptu getspeedtool od nBanan, [PRT]MasterGamer

edit: skrypt jest po stronie servera

Nast?pnym razem u?ywaj znacznik?w od Lua i Code.//DestroY

Ostatnio zmieniony przez #404 2015-09-30, 13:52, w całości zmieniany 2 razy  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-09-30, 13:54


Fanciak

BOT






Wiek: 25
Na forum: 4446 dni
Posty: 728
Nick w MP: Fanciak

Piwa: 1572

Respekt: 500
Respekt: 500

addEventHandler "onElementClicked"root, 
function ( mouseButton local car getPedOccupiedVehicle (getLocalPlayer())
local elementType getElementType source ) 
if ( elementType == "vehicle" then 
if ( mouseButton == "left" then -- niszczenie 
destroyElement (car) 
elseif ( mouseButton == "right" then -- naprawa 
fixVehicle(car)
setElementHealth(car1000)
end 
elseif ( elementType == "player" then 
end 
end 
end



Po co sie powtarza funkcja do naprawiania? Teraz powinno dzialac.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-09-30, 14:18


#404







Wiek: 26
Na forum: 4772 dni
Posty: 1438

Piwa: 2512

Respekt: 833,5
Respekt: 833,5Respekt: 833,5

Ostrzeżeń: 60%
INVWHIL3, onElementClicked odnosi si? do klikni?cia poprzez kursor (showCursor itp), by? mo?e to jest twoim problemem.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-09-30, 16:24


INVWHIL3

*Padawan Lua*






Wiek: 27
Na forum: 3968 dni
Posty: 41
Nick w MP: LEURCEDICIUS

Piwa: 472

Respekt: 50

Kod:

funkcja.lua:12: 'end' expected (to close 'if' at line 5) near '<eof>'

Teraz wywala to ^ ..

Ostatnio zmieniony przez INVWHIL3 2015-09-30, 16:39, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-09-30, 16:27


Fanciak

BOT






Wiek: 25
Na forum: 4446 dni
Posty: 728
Nick w MP: Fanciak

Piwa: 1572

Respekt: 500
Respekt: 500

Teraz

addEventHandler "onElementClicked"root, 
function ( mouseButton local car getPedOccupiedVehicle (getLocalPlayer())
local elementType getElementType source ) 
if ( elementType == "vehicle" then 
if ( mouseButton == "left" then -- niszczenie 
destroyElement (car) 
elseif ( mouseButton == "right" then -- naprawa 
fixVehicle(car)
setElementHealth(car1000)
end 
elseif ( elementType == "player" then 
end 
end 
end
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-09-30, 16:30


INVWHIL3

*Padawan Lua*






Wiek: 27
Na forum: 3968 dni
Posty: 41
Nick w MP: LEURCEDICIUS

Piwa: 472

Respekt: 50

Kod:

\funkcja.lua:15: ')' expected (to close '(' at line 1) near 'end'

to ^
Jaki ja jestem problematyczny XD

Ostatnio zmieniony przez INVWHIL3 2015-09-30, 16:39, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-09-30, 16:33


Fanciak

BOT






Wiek: 25
Na forum: 4446 dni
Posty: 728
Nick w MP: Fanciak

Piwa: 1572

Respekt: 500
Respekt: 500

addEventHandler "onElementClicked"root, 
function ( mouseButton local car getPedOccupiedVehicle (getLocalPlayer())
local elementType getElementType source ) 
if ( elementType == "vehicle" then 
if ( mouseButton == "left" then -- niszczenie 
destroyElement (car) 
elseif ( mouseButton == "right" then -- naprawa 
fixVehicle(car)
setElementHealth(car1000)
end 
elseif ( elementType == "player" then 
end 
end 
end
end


Sprobuj teraz, a jak nie to tak:


addEventHandler "onElementClicked"root, 
function ( mouseButton local car getPedOccupiedVehicle (getLocalPlayer())
local elementType getElementType source ) 
if ( elementType == "vehicle" then 
if ( mouseButton == "left" then -- niszczenie 
destroyElement (car) 
elseif ( mouseButton == "right" then -- naprawa 
fixVehicle(car)
setElementHealth(car1000)
end 
elseif ( elementType == "player" then 
end 
end 


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-09-30, 16:38


INVWHIL3

*Padawan Lua*






Wiek: 27
Na forum: 3968 dni
Posty: 41
Nick w MP: LEURCEDICIUS

Piwa: 472

Respekt: 50

Pierwszy te same errory :p
a w drugim
Kod:

\funkcja.lua:3: attempt to call global 'getLocalPlayer' (a nil value)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-09-30, 16:41


Fanciak

BOT






Wiek: 25
Na forum: 4446 dni
Posty: 728
Nick w MP: Fanciak

Piwa: 1572

Respekt: 500
Respekt: 500

Zobacz:


addEventHandler "onElementClicked"root, 
function ( mouseButton local car getPedOccupiedVehicle (getLocalPlayer(source))
local elementType getElementType source ) 
if ( elementType == "vehicle" then 
if ( mouseButton == "left" then -- niszczenie 
destroyElement (car) 
elseif ( mouseButton == "right" then -- naprawa 
fixVehicle(car)
setElementHealth(car1000)
end 
elseif ( elementType == "player" then 
end 
end 


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-09-30, 16:47


INVWHIL3

*Padawan Lua*






Wiek: 27
Na forum: 3968 dni
Posty: 41
Nick w MP: LEURCEDICIUS

Piwa: 472

Respekt: 50

Ten sam error.. a by?aby mo?liwo?? dajmy na to ?eby strzelenie w samoch?d zapisywa?o jako? jego warto?? ( mam pod serwerem system aut z baz? sql ) i za pomoc? komendy /fix idpojazdu lub /destroy idpojazdu naprawia?o lub niszczy?o wybrany pojazd ? z g?ry dzi?kuje za pomoc :)



[ Dodano: 2015-09-30, 18:37 ]
Fanciak wielkie dzi?ki za pomoc :)
DestroY twoje wskaz?wki by?y bardzo pomocne ^^

Problem zosta? rozwi?zany

Postaw piwo autorowi tego posta
 

 
Tagi: destroy :: fix
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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