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

Wysłany: 2018-02-21, 00:06


Yami

Mapper / Uczeń LUA






Wiek: 25
Na forum: 3200 dni
Posty: 379

Piwa: 97

Respekt: 235
Respekt: 235Respekt: 235

Siemka, mam taki skrypt i nie wiem jak go lekko przerobi? aby naprawia? tylko auta o danym ID, chodzi mi ?eby jak wjade w marker to tylko radiolke naprawia?o. Daje tu kod, z g?ry dzi?ki za pomoc.
 local?marker?=?createMarker(-2034.6999511719,?174.60000610352,?27.89,"cylinder",?3,?255,?0,?255)

function?naprawa(thePlayer)
if?(?isPedInVehicle?(?thePlayer?)?)?then
local?theVehicle?=?getPedOccupiedVehicle?(?thePlayer)
setElementFrozen?(theVehicle,?true)
setTimer(function()
setElementFrozen(theVehicle,?false)
end,?5000,?1)
local?money?=?getPlayerMoney(thePlayer)
if?(money?>?50)?then?
takePlayerMoney(thePlayer,?50)
local?succes?=?fixVehicle?(?theVehicle?)
if?(?succes?)?then
outputConsole?("Pojazd?naprawiony",?thePlayer?)
else
outputConsole?(?"Nieudana?pr?ba?naprawy.",?thePlayer)
end
else
outputConsole?(?"Musisz?by??w?poje?dzie!",?thePlayer?)
end
end
end
addEventHandler("onMarkerHit",?marker,?naprawa)

function?fix1(thePlayer)
local?accName?=?getAccountName?(?getPlayerAccount?(?thePlayer?)?)
if?isObjectInACLGroup?("user."..accName,?aclGetGroup?(?"Admin"?)?)?then
local?theVehicle?=?getPedOccupiedVehicle?(?thePlayer)
local?succes?=?fixVehicle?(?theVehicle?)
if?(?succes?)?then
outputConsole?("Pojazd?naprawiony",?thePlayer?)
end
end
end
addCommandHandler("fix",?fix1) 


[ Dodano: 2018-02-21, 00:07 ]
Zamiast tego ?e dana grupa ACL mo?e to robic to ?eby tylko dany pojazd mo?na by?o tam naprawic

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-02-21, 00:18


Ciastuuś

As-salamu alaykum






Wiek: 27
Na forum: 3212 dni
Posty: 800
Nick w MP: Ciastuuś

Piwa: 4304

Respekt: 640
Respekt: 640Respekt: 640

Trzymaj lepsze rozwi?zanie. Sprawdza po frakcji,

local markerNapraw = createMarker(x, y, z, 'cylinder', 1, 255, 255, 255, 255)

function naprawFrakcjaPojazd ( player )
    if player and isElement(player) and getElementData(player, "player:duty") == 'SAPD' then
            local graczPojazd = isPedInVehicle (player) and getPedOccupiedVehicle (player) or player
            if ( source == markerNapraw ) then
                fixVehicle ( graczPojazd)
                setElementFrozen ( graczPojazd, true )
                setTimer ( setElementFrozen, 1000, 1, graczPojazd, false )
                playSoundFrontEnd ( player, 46 )
                outputChatBox("Tw?j pojazd zosta? naprawiony!", player, 0, 128, 255)
            end
        end
    end
addEventHandler ('onMarkerHit', markerNapraw, naprawFrakcjaPojazd)


Podpis
As-salamu alaykum
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-02-21, 07:46


CjPomarancza

:-)






Wiek: 17
Na forum: 3324 dni
Posty: 90

Piwa: 12

Respekt: 60

Osobie wy?ej b?dzie naprawia? ka?de auto, kt?rym kieruje osoba na duty, nawet nie radiolk?.

?eby zrobi? na ID:

local marker = createMarker(-2034.6999511719, 174.60000610352, 27.89,"cylinder", 3, 255, 0, 255)

function naprawa( hitElement )
if getElementType( hitElement ) ~= 'vehicle' then return end 
    local thePlayer = getVehicleController( hitElement )
    if getElementData( hitElement, "vehicle:id" ) ~= 5 then outputChatBox( "Nie mo?esz naprawi? tego pojazdu!", thePlayer, 255, 0, 0 ) return end       -- "vehicle:id" to elementdata, pod jak? jest ID, a 5 to przyk?adowe ID. Je?li ID nie r?wna si? 5, to return end.
    setElementFrozen ( hitElement, true )
        setTimer(function()
        setElementFrozen( hitElement, false)
        end, 5000, 1)
    local money = getPlayerMoney( thePlayer )
    if ( money >= 50 ) then 
    takePlayerMoney( thePlayer, 50 )
    local succes = fixVehicle ( hitElement )
    if ( succes ) then
    outputConsole ( "Pojazd naprawiony", thePlayer )
    end
    else outputChatBox( "Nie sta? Ci? na napraw?.", thePlayer, 255, 0, 0)
end
end

addEventHandler ('onMarkerHit', marker, naprawa)


A ?eby zrobi? dla auta policyjnego, to po prostu podmie? sprawdzanie elementdaty z id na elementdat? z frakcj?, np.
 if getElementData( hitElement, "vehicle:faction" ) ~= SAPD then outputChatBox("blablabla", thePlayer) return end 


Podpis
Pomogłem? Doceń mnie i postaw :piwo: :)
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-02-22, 19:44


Yami

Mapper / Uczeń LUA






Wiek: 25
Na forum: 3200 dni
Posty: 379

Piwa: 97

Respekt: 235
Respekt: 235Respekt: 235

Niestety ?aden z tych kod?w nie dzia?a
W ?adnym nie tworzy sie marker i wgl

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-02-22, 20:02


amited







Wiek: 26
Na forum: 3855 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466

local marker = createMarker(-2034.6999511719, 174.60000610352, 27.89,"cylinder", 3, 255, 0, 255)
function naprawa(el,md)
if getElementType(el)=="vehicle" then
if getElementData(el,"ID")==ID RADIOLKI then
fixVehicle(el)
end
end
end
addEventHandler("onMarkerHit", marker, naprawa)

jak masz wiecej tych radiolek to robisz sobie tablice z id i tak gdzei masz ID RADIOLKI to pobierasz id pojazdu i sprawdzasz czy jest w tablicy

Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-02-22, 20:11


Yami

Mapper / Uczeń LUA






Wiek: 25
Na forum: 3200 dni
Posty: 379

Piwa: 97

Respekt: 235
Respekt: 235Respekt: 235

Niestety jak wpisa?em ID radiolki to g??wne ID pojazdu 596 oraz jeszcze zmieni?em na ID radiolki ze skryptu i tez nic, marker te? si? nie pojawia

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-02-22, 20:17


amited







Wiek: 26
Na forum: 3855 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466

local marker = createMarker(-2034.6999511719, 174.60000610352, 27.89,"cylinder", 3, 255, 0, 255, 255)
function naprawa(el,md)
if getElementType(el)=="vehicle" then
if getElementModel(el)==596 then
fixVehicle(el)
end
end
end
addEventHandler("onMarkerHit", marker, naprawa)
tak zobacz

[ Dodano: 2018-02-22, 20:17 ]
to musi byc radiolka ls

Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Yami
Wysłany: 2018-02-22, 20:24


Yami

Mapper / Uczeń LUA






Wiek: 25
Na forum: 3200 dni
Posty: 379

Piwa: 97

Respekt: 235
Respekt: 235Respekt: 235

Dobra git dzia?a.
A da?by? rade zrobi? tak aby by? na 5 sekund zamro?ony samoch?d?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-02-22, 20:27


CjPomarancza

:-)






Wiek: 17
Na forum: 3324 dni
Posty: 90

Piwa: 12

Respekt: 60

Nie wiem, co? ty robi?, ?e niby Ci ten skrypt nie dzia?a?. Sprawdza?em go, marker jest na doherty.

W przypadku mojego kodu:

setElementFrozen(hitElement, 1) 

setTimer(function() 
     setElementFrozen(hitElement, 0) 
end, 5 * 1000, 1) 


Podpis
Pomogłem? Doceń mnie i postaw :piwo: :)
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-02-22, 20:27


amited







Wiek: 26
Na forum: 3855 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466

local marker = createMarker(-2034.6999511719, 174.60000610352, 27.89,"cylinder", 3, 255, 0, 255, 255)
function naprawa(el,md)
if getElementType(el)=="vehicle" then
if getElementModel(el)==596 then
setElementFrozen (el, true )
setTimer(function()
setElementFrozen(el, false)
fixVehicle(el)
end, 5000, 1)
end
end
end
addEventHandler("onMarkerHit", marker, naprawa)

Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-02-22, 20:36


Yami

Mapper / Uczeń LUA






Wiek: 25
Na forum: 3200 dni
Posty: 379

Piwa: 97

Respekt: 235
Respekt: 235Respekt: 235

Przepraszam ?e a? tyle wymagam od ciebie, a da rad? ?eby jak wjade w marker ?eby na chacie co? pisa?o, bo sam spr?bowa?em ale mi nie pyk?o xD

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-02-22, 20:49


amited







Wiek: 26
Na forum: 3855 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466

local marker = createMarker(-2034.6999511719, 174.60000610352, 27.89,"cylinder", 3, 255, 0, 255, 255)
function naprawa(el,md)
if getElementType(el)=="vehicle" then
if getElementModel(el)==596 then
p=getVehicleController(el)
outputChatBox("Twoj pojazd zostanie zaraz naprawiony.",p)
setElementFrozen (el, true )
setTimer(function()
setElementFrozen(el, false)
fixVehicle(el)
end, 5000, 1)
end
end
end
addEventHandler("onMarkerHit", marker, naprawa)

Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-02-22, 20:58


Yami

Mapper / Uczeń LUA






Wiek: 25
Na forum: 3200 dni
Posty: 379

Piwa: 97

Respekt: 235
Respekt: 235Respekt: 235

A ?eby doda? kolejne auta? Po przecinku czy od nowej linijki tak jak tamto?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-02-22, 20:59


amited







Wiek: 26
Na forum: 3855 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466

if getElementModel(el)==596 or getElementModel(el)==595 then
itd

Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-02-22, 21:40


Yami

Mapper / Uczeń LUA






Wiek: 25
Na forum: 3200 dni
Posty: 379

Piwa: 97

Respekt: 235
Respekt: 235Respekt: 235

O ostatni? rzecz chcia?bym si? spyta?, gdzie doda? aby zabiera?o hajs?

[ Dodano: 2018-02-22, 21:45 ]
Bo ja zrobi?em tak ale mi nie dzia?a, nie zabiera hajsu:

local marker = createMarker(1628.27, -1511.42, 13.60-0.9,"cylinder", 5, 255, 0, 255, 255) 
function naprawa(el,md) 
if getElementType(el)=="vehicle" then 
if getElementModel(el)==596 or getElementModel(el)==597 or getElementModel(el)==523 or getElementModel(el)==525 or getElementModel(el)==528 or getElementModel(el)==431 or getElementModel(el)==438 or getElementModel(el)==420 or getElementModel(el)==416 then 
p=getVehicleController(el) 
outputChatBox("Trwa naprawianie pojazdu! Poczekaj 5 sekund",p,255,0,0)  
setElementFrozen (el, true ) 
setTimer(function() 
setElementFrozen(el, false) 
fixVehicle(el) 
end, 5000, 1) 
local money = getPlayerMoney(p)
if (money > 10) then      
end 
end 
end 
end
addEventHandler("onMarkerHit", marker, naprawa) 


Postaw piwo autorowi tego posta
 

 
Tagi: naprawa :: danego :: pojazdu
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