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

Wysłany: 2015-10-21, 18:58


INVWHIL3

*Padawan Lua*






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

Piwa: 472

Respekt: 50

Witam,funkcja ma za zadanie naprawi? auto i pobra? dan? op?at? zale?n? od stanu auta.

function naprawa()
local theVehicle=GetPedOccupiedVehicle (source)
local cena=takePlayerMoney(source,10)
local cena2=getElementHealth(theVehicle)
if (cena2 90then (cena 20)
fixVehicle(theVehicle)
end
end
addEvent("naprawa"true)
addEventHandler("naprawa"getRootElement(), naprawa)

Jak? tutaj gaf? strzeli?em ? >.<

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-10-21, 19:25


Novovix

xNinja powraca






Wiek: 26
Na forum: 4870 dni
Posty: 240
Nick w MP: xNinja

Piwa: 452

Respekt: 80,5

Mo?liwe, ?e tak b?dzie dzia?a?! :D


function naprawa()
local theVehicle=GetPedOccupiedVehicle (source)
local cena2=getElementHealth(theVehicle)
if (cena2 90then 
cena cena 20
takePlayerMoney(source,cena)
fixVehicle(theVehicle)
end
end
addEvent("naprawa"true)
addEventHandler("naprawa"getRootElement(), naprawa)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-10-21, 19:43


Jurandovsky

Kurdebele






Wiek: 17
Na forum: 4838 dni
Posty: 915

Piwa: 2697

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

nie ma funkcji GetPedOccupiedVehicle, jest getPedOccupiedVehicle

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-10-21, 19:45


INVWHIL3

*Padawan Lua*






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

Piwa: 472

Respekt: 50

4attempt to call global 'getPedOccupiedVehicle'(a nil value)


:(

@edit

po zmienieniu GetPedOccupiedVehicle na getPedOccupiedVehicle
sypie errorami:

4:Bad argument 'getPedOcupiedVehicle'[Expected ped at argument 1,got root]
5:Bad argument 'getElementHealth' [Expected element at argument 1,got boolean]
6:attempt to compare boolean with number


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-10-21, 22:26


Maximerr

Programmer PHP, LUA






Wiek: 25
Na forum: 4427 dni
Posty: 548

Piwa: 1051

Respekt: 365,3
Respekt: 365,3Respekt: 365,3Respekt: 365,3Respekt: 365,3

Nie testowa?em.
function naprawa()
local theVehicle=getPedOccupiedVehicle(client)
local cena2=getElementHealth(theVehicle)
if (cena2 90then 
cena cena 20
takePlayerMoney(client,cena)
fixVehicle(theVehicle)
end
end
addEvent("naprawa"true)
addEventHandler("naprawa"getRootElement(), naprawa)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-10-22, 00:12


INVWHIL3

*Padawan Lua*






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

Piwa: 472

Respekt: 50

Errorami sypa? nie sypie wcale .. ale funkcja w jaki? spos?b straci?a funkcjonalno?? i nie ma ?adnej reakcji :|

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-10-22, 06:31


Maximerr

Programmer PHP, LUA






Wiek: 25
Na forum: 4427 dni
Posty: 548

Piwa: 1051

Respekt: 365,3
Respekt: 365,3Respekt: 365,3Respekt: 365,3Respekt: 365,3

Poka? trigger po stronie Clienta.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-10-22, 17:42


INVWHIL3

*Padawan Lua*






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

Piwa: 472

Respekt: 50

function naprawa()
    
    triggerServerEvent("naprawa"getRootElement())
    end
addEventHandler("onClientGUIClick"getRootElement(), naprawa,GUIEditor.button[1])


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-10-22, 20:59


Jurandovsky

Kurdebele






Wiek: 17
Na forum: 4838 dni
Posty: 915

Piwa: 2697

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

function naprawa()

triggerServerEvent("naprawa", getRootElement())
end
addEventHandler("onClientGUIClick",GUIEditor.button[1]), naprawa)

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-10-22, 22:42


INVWHIL3

*Padawan Lua*






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

Piwa: 472

Respekt: 50

29:unexpected symbol near '.'


.. pr?bowa?em zmienia? nazw? buttona ale to nic nie daje

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-10-22, 23:20


#404







Wiek: 26
Na forum: 4771 dni
Posty: 1438

Piwa: 2512

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

Ostrzeżeń: 60%

function naprawa()
    if source ~= nazwabuttona then return end
    triggerServerEvent("naprawa"localPlayer)
    end
addEventHandler("onClientGUIClick"getRootElement(), naprawa)


Powinno dzia?a?, uzupe?nij tylko buttona.


A tu jeszcze kilka uwag do serwer'a

function naprawa()
local theVehicle=GetPedOccupiedVehicle (source)
if not theVehicle then
outputChatBox("Brak pojazdu"client)
return end
local cena2=getElementHealth(theVehicle)
if not cena2 then
outputChatBox("Nie pobrano hp auta",client)
return end
if (cena2 90then -- to sinigdy nie spe?nibo auto zaczyna sipaliprzy ok 250no chyba, ?e masz system na niewybuchaj?ce
cena cena 20
if getPlayerMoney(client) >= cena then
takePlayerMoney(source,cena)
fixVehicle(theVehicle)
else
outputChatBox("Brak kasy"client)
end
end
end
addEvent("naprawa"true)
addEventHandler("naprawa"getRootElement(), naprawa)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-10-22, 23:49


INVWHIL3

*Padawan Lua*






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

Piwa: 472

Respekt: 50

Serwer i Client poprawiony .. :)

gdy klikam na button napraw pojazd wywala ;(

attempt to call global 'GetPedOccupiedVehicle' (a nil value)


:(

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-10-22, 23:54


#404







Wiek: 26
Na forum: 4771 dni
Posty: 1438

Piwa: 2512

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

Ostrzeżeń: 60%
Ka?da funkcja w mta zaczyna si? z ma?ej literki.

Ps: by? mo?e ja skopiowa?em to ?le, bo przerabia?em kod podany na wst?pie.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-10-23, 00:08


INVWHIL3

*Padawan Lua*






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

Piwa: 472

Respekt: 50

Dzi?ki wielkie ! :) dzia?a elegancko..post wy?ej mnie zmyli? i my?la?em ?e ma by? z du?ej.A gdybym chcia? ?eby gui si? zamyka?o gdy wyjad? z markera lub klikn? na dany przycisk to jakiej funkcji musz? u?y? ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-10-23, 00:14


#404







Wiek: 26
Na forum: 4771 dni
Posty: 1438

Piwa: 2512

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

Ostrzeżeń: 60%
INVWHIL3,

Więcej informacji znajdziesz w Wikipedii MTA:

guiSetVisible


Aby si? zamkn??o po wyjsciu z markera

Więcej informacji znajdziesz w Wikipedii MTA:

onClientMarkerLeave


Tylko aby to by?o mo?liwe przy musisz u?y? 2 argumentu przy pokazywaniu myszy

Więcej informacji znajdziesz w Wikipedii MTA:

showCursor


Postaw piwo autorowi tego posta
 

 
Tagi: fixvehicle :: cena :: uszkodzenie
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » fixVehicle a cena * uszkodzenie 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