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

Wysłany: 2015-08-03, 14:30


HypE







Wiek: 28
Na forum: 4099 dni
Posty: 21
Nick w MP: HypE



Respekt: 50

Witam.
Jak zrobi? ?eby gracz kt?ry nie posiada 50 $ nie m?g? naprawi? pojazdu ?
z g?ry dzi?kuje za pomoc.


naprawa = createMarker(1635.32824707, -1133.6793212, 23.90625, 'cylinder', 2.0, 255, 0, 0, 150)

function napraw (thePlayer)
if isPedInVehicle ( thePlayer ) then
local car = getPedOccupiedVehicle ( thePlayer )
fixVehicle(car)
takePlayerMoney(thePlayer, 50)
outputChatBox("Naprawiles auto! wydales 50 GP", thePlayer, 0, 170, 255, true)
else
outputChatBox ("nie jestes w aucie!", thePlayer, 0, 170, 255, true)
end
end
addEventHandler("onMarkerHit", naprawa, napraw)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-03, 14:44


Jurandovsky

Kurdebele






Wiek: 17
Na forum: 4979 dni
Posty: 915

Piwa: 2697

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


naprawa = createMarker(1635.32824707, -1133.6793212, 23.90625, 'cylinder', 2.0, 255, 0, 0, 150)

function napraw (thePlayer)
if isPedInVehicle ( thePlayer ) then
local car = getPedOccupiedVehicle ( thePlayer )
if getPlayerMoney(thePlayer) >= 50 then
fixVehicle(car)
takePlayerMoney(thePlayer, 50)
outputChatBox("Naprawiles auto! wydales 50 GP", thePlayer, 0, 170, 255, true)
else
outputChatBox ("nie jestes w aucie!", thePlayer, 0, 170, 255, true)
end
end
end
addEventHandler("onMarkerHit", naprawa, napraw)


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-08-03, 14:54


HypE







Wiek: 28
Na forum: 4099 dni
Posty: 21
Nick w MP: HypE



Respekt: 50

Jak zrobi? kod w takim ?? ?tym tle ? xD
i mam pytanie czy da rade jako? zrobi? ?e zabiera nam kwot? od uszkodze? pojazdu ?
chodzi mi o to ?? gdy pojazd ma np 400hp to zabiera 100$ a jak ma 200hp to zabiera 150 $

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-03, 15:03


Jurandovsky

Kurdebele






Wiek: 17
Na forum: 4979 dni
Posty: 915

Piwa: 2697

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

getElementHealth chyba, nie jestem pewien.


A z??te t?o kodu to :

.[.lua.]. oczywiscie bez kropek
.[./lua.].



ta dam


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-08-03, 15:35


HypE







Wiek: 28
Na forum: 4099 dni
Posty: 21
Nick w MP: HypE



Respekt: 50

a w jakim miejscu wstawi? ten warunek ?e je?li pojazd ma tyle... hp to zabiera tyle $$ ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-08-03, 16:01


Jurandovsky

Kurdebele






Wiek: 17
Na forum: 4979 dni
Posty: 915

Piwa: 2697

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


naprawa = createMarker(1635.32824707, -1133.6793212, 23.90625, 'cylinder', 2.0, 255, 0, 0, 150)


function napraw (thePlayer)
if isPedInVehicle ( thePlayer ) then
car = getPedOccupiedVehicle ( thePlayer )
health = getElementHealth(car)
if health > 800 and health < 1000 then
if getPlayerMoney(thePlayer) >= 200 then
fixVehicle(car)
takePlayerMoney(thePlayer, 200)
outputChatBox("Naprawiles auto! wydales 200 GP", thePlayer, 0, 170, 255, true)
end
elseif health > 400 and health < 800 then
if getPlayerMoney(thePlayer) >= 500 then
fixVehicle(car)
takePlayerMoney(thePlayer, 500)
outputChatBox("Naprawiles auto! wydales 500 GP", thePlayer, 0, 170, 255, true)
end
elseif health > 100 and health < 400 then
if getPlayerMoney(thePlayer) >= 800 then
fixVehicle(car)
takePlayerMoney(thePlayer, 800)
outputChatBox("Naprawiles auto! wydales 800 GP", thePlayer, 0, 170, 255, true)
end
end
end
end
end
addEventHandler("onMarkerHit", naprawa, napraw)


troche ma?o wydajne ale c??

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-08-03, 21:16


Tostuch







Wiek: 28
Na forum: 5072 dni
Posty: 483
Nick w MP: Tost

Piwa: 137

Respekt: 110
Respekt: 110

Chcia?bym zaznaczy? ?e pojazd maj?c 250% hp zaczyna si? pali?. Ze swojej strony polecam Ci jakie? obliczanie danej kwoty jak?? formu??.

Postaw piwo autorowi tego posta
 

 
Tagi: naprawa :: auta
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