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

Wysłany: 2015-07-30, 06:48


pomaza







Wiek: 39
Na forum: 3982 dni
Posty: 79

Piwa: 2

Respekt: 50

Witam mam kod :

Kod:

function dajPaliwo(prl,cmd,id)
if id then
id=tonumber(id)
local veh=getVehicle(id)
if veh then
local accName = getAccountName ( getPlayerAccount ( thePlayer ) )
local pojazd = getPedOccupiedVehicle( thePlayer )
if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then
if pojazd then
setElementData(pojazd, "pojazd_paliwo", 100)
end
end
end
end
end
addCommandHandler("dajpaliwo", dajPaliwo)

Chcia?em zeby jak sie wpisze /dajpaliwo 2 to daje paliwo autu o danym id ale wyskakuje w debugu:
attempt to call global 'getVehicle' (a nil value)

Mo?e kto? by wiedzia? jak to poprawi? ?

daje :piwo: !! !

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-30, 10:45


piotr172







Wiek: 26
Na forum: 4417 dni
Posty: 130

Piwa: 2329

Respekt: 105,3
Respekt: 105,3

Dodaj to do tego skryptu co masz t? komend?, uzupe?nij tylko ElemntDate id pojazdu(tutaj jest"car_id")


local function getVehicle(id)
    if id then
        id=tonumber(id)
        for _,v in ipairs(getElementsByType("vehicle"))do
            if getElementData(v,"car_id"then
                if getElementData(v,"car_id")==id then
                    return v
                end
            end
        end
    end
    return false
end


I jeszcze w kodzie na t? komend? zamiast thePlayer wpisz plr.


function dajPaliwo(plr,cmd,id)
if id then
id=tonumber(id)
local veh=getVehicle(id)
if veh then
local accName getAccountName getPlayerAccount plr ) )
local pojazd getPedOccupiedVehicle(plr )
if isObjectInACLGroup ("user."..accNameaclGetGroup "Admin" ) ) then
if pojazd then
setElementData(pojazd"pojazd_paliwo"100)
end
end
end 


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-30, 11:09


pomaza







Wiek: 39
Na forum: 3982 dni
Posty: 79

Piwa: 2

Respekt: 50

end expeced (to close 'if' at line 70) near <eof>

[ Dodano: 2015-07-30, 11:11 ]
70 to jest to : if id then

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-30, 11:31


Tostuch







Wiek: 27
Na forum: 4931 dni
Posty: 483
Nick w MP: Tost

Piwa: 137

Respekt: 110
Respekt: 110

dodaj jeszcze jeden end na ko?cu

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-30, 12:07


pomaza







Wiek: 39
Na forum: 3982 dni
Posty: 79

Piwa: 2

Respekt: 50

nie dziala

nie ma errora tylko warning bad argument setEelementData [expecend element at argument 1, go boolean

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-30, 12:13


piotr172







Wiek: 26
Na forum: 4417 dni
Posty: 130

Piwa: 2329

Respekt: 105,3
Respekt: 105,3

To jest komenda ze daje paliwo po id to po co sprawdzasz pojazd w kt?rym siedzi osoba wpisuj?ca komend??


function dajPaliwo(plr,cmd,id)
if id then
id=tonumber(id)
local veh=getVehicle(id)
if veh then
local accName getAccountName getPlayerAccount plr ) )
if isObjectInACLGroup ("user."..accNameaclGetGroup "Admin" ) ) then
setElementData(veh"pojazd_paliwo"100)
end
end
end
end

addCommandHandler("dajpaliwo"dajPaliwo)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-30, 12:22


pomaza







Wiek: 39
Na forum: 3982 dni
Posty: 79

Piwa: 2

Respekt: 50

o pomy?ka moja to byla :)

[ Dodano: 2015-07-30, 12:24 ]
dobra dzia?a piwko leci

[ Dodano: 2015-07-30, 12:29 ]
temat mo?na zamyka?

Postaw piwo autorowi tego posta
 

 
Tagi: komeda :: daj :: paliwo
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