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

Wysłany: 2020-04-01, 20:19


pozdrominiek







Wiek: 26
Na forum: 2285 dni
Posty: 57



Respekt: 50

Witam,
chcia?bym u?y? funkcji getVehiclePlateText przy wchodzeniu do auta. Mam takie co?:
Kod:

addEventHandler('onVehicleStartEnter',resourceRoot,function(player,seat)
if seat ~= 0 then return end
if getVehiclePlateText(source) == 'AT 1' or getVehiclePlateText(soruce) == 'AT 2' then
if getElementData(player,'player:rank2') < 1 then
cancelEvent()
end
end
end)

Jednak otrzymuj? b??d [Expected vehicle at argument 1, got nil] nie wiem co mog? wstawi? zamiast source, wi?c zwracam si? do Was o pomoc. Z g?ry dzi?kuj? za odpowied?.

Ostatnio zmieniony przez pozdrominiek 2020-04-01, 20:48, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-04-01, 20:36


Pyrek24







Wiek: 25
Na forum: 3438 dni
Posty: 546
Nick w MP: Pyrek

Piwa: 10

Respekt: 50

Spr?buj tak

if (getVehiclePlateText(veh) == "AT 1") or (getVehiclePlateText(veh) == "AT 2")


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-04-01, 20:51


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Pyrek24, gdzie ty widzisz zdefiniowan??zmienn? 'veh'?

Zrobi?e? liter?wk? w sprawdzaniu drugiej tablicy, zmie? 'soruce' na 'source'.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-04-01, 21:06


pozdrominiek







Wiek: 26
Na forum: 2285 dni
Posty: 57



Respekt: 50

veh jest zdefiniowany jako tworzenie tego pojazdu. Zaraz dam kod, ta liter?wka nic nie zmienia, nadal to samo.
Kod:

veh = createVehicle(model,value[1],value[2],value[3],value[4],value[5],value[6])


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-04-01, 22:45


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Wklej kod po zmianach.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-04-01, 23:59


pozdrominiek







Wiek: 26
Na forum: 2285 dni
Posty: 57



Respekt: 50

function create_vehicles(table,model)
    if not table then return end

    for index,value in pairs(table) do
        vehicle createVehicle(model,value[1],value[2],value[3],value[4],value[5],value[6])
        setElementFrozen(vehicle,true)
        if model == 578 then
            setVehicleColor(vehicle255900255255255255255255)
            setElementData(vehicle,"vehicle:bak"100)
            setElementData(vehicle,"vehicle:fuel"100)
            local x,y,getElementPosition(vehicle)
            colspheres[vehicle] = createColSphere(x,y,z4)
            attachElements(colspheres[vehicle], vehicle0, -8, -0.605)
        elseif model == 524 then
            setVehicleColor(vehicle255900255255255255255255)
        elseif model == 552 then
            addVehicleUpgrade(vehicle1083)
            setVehicleColor(vehicle255900255255255255255255)
        elseif model == 525 then
            addVehicleUpgrade(vehicle1083)
            setVehicleColor(vehicle255900255255255255255255)
        elseif model == 426 then
            addVehicleUpgrade(vehicle1083)
            setVehicleColor(vehicle255900255255255255255255)
        elseif model == 554 then
            addVehicleUpgrade(vehicle1083)
            setVehicleColor(vehicle255900255255255255255255)
        elseif model == 489 then
            addVehicleUpgrade(vehicle1083)
            setVehicleColor(vehicle255900255255255255255255)
        elseif model == 500 then
            addVehicleUpgrade(vehicle1083)
            setVehicleColor(vehicle255900255255255255255255)
        elseif model == 445 then
            addVehicleUpgrade(vehicle1083)
            setVehicleColor(vehicle255900255255255255255255)
        elseif model == 551 then
            addVehicleUpgrade(vehicle1083)
            setVehicleColor(vehicle255900255255255255255255)
        elseif model == 433 then
            addVehicleUpgrade(vehicle1083)
            setVehicleColor(vehicle255900255255255255255255)
        elseif model == 486 then
            addVehicleUpgrade(vehicle1083)
            setVehicleColor(vehicle255900255255255255255255)
        elseif model == 573 then
            addVehicleUpgrade(vehicle1083)
            setVehicleColor(vehicle255900255255255255255255)
        elseif model == 431 then
            addVehicleUpgrade(vehicle1083)
            setVehicleColor(vehicle255900255255255255255255)
        elseif model == 579 then
            addVehicleUpgrade(vehicle1083)
            setVehicleColor(vehicle255900255255255255255255)
        elseif model == 560 then
            addVehicleUpgrade(vehicle1083)
            setVehicleColor(vehicle255900255255255255255255)
        elseif model == 490 then
            addVehicleUpgrade(vehicle1083)
            setVehicleColor(vehicle255900255255255255255255)
            setVehicleVariant(vehiclevalue[8], value[8])
            setVehicleHandling(vehicle,"maxVelocity"450)
            setVehicleHandling(vehicle,"engineAcceleration"10)
            setVehicleHandling(vehicle,"driveType"rwd)
            setElementData(vehicle,"vehicle:bak"100)
            setElementData(vehicle,"vehicle:fuel"100)
        elseif model == 488 then
            --addVehicleUpgrade(vehicle1083)
            setVehicleColor(vehicle0,0,0255,255255255255255)
        elseif model == 582 then
            addVehicleUpgrade(vehicle1083)
            setVehicleColor(vehicle0,0,0255,255255000)
            setVehiclePlateText(vehicle"AT    01")
        end
    end
end

addEventHandler('onVehicleStartEnter',resourceRoot,function(player,seat)
    if seat ~= 0 then return end
    if getElementData(player,'player:biznes') ~= 'ArctisTimes' then 
        cancelEvent()
    elseif getVehiclePlateText(veh) == 'AT 1' or getVehiclePlateText(veh) == 'AT 2' or getVehiclePlateText(veh) == 'AT 3' or getVehiclePlateText(veh) == 'AT 5' or getVehiclePlateText(veh) == 'AT 5' or getVehiclePlateText(veh) == 'AT 6' then 
        if getElementData(player,'player:rank2') < 1 then
            cancelEvent()
        end
    elseif getVehiclePlateText(veh) == 'AT 7' or getVehiclePlateText(veh) == 'AT 8' or getVehiclePlateText(veh) == 'AT 10' or getVehiclePlateText(veh) == 'AT 11' then 
        if getElementData(player,'player:rank2') < 2 then
            cancelEvent()
        end
    elseif getVehiclePlateText(veh) == 'AT 9' then 
        if getElementData(player,'player:rank2') < 97 then
            cancelEvent()
        end
    end
end)


Wklejam ju? ca?y kod opr?cz respiena i definiowania pozycji pojazd?w, chyba jest to zb?dne. Wiem, ?e rejestracje si? r??ni?, jednak nie zmienia nic to w tym przypadku.

Komentarz Wilq dodany 2020-04-02, 15:42W celu udostępnienia kodu LUA użyj tagów [.lua] oraz [./lua]
Ostatnio zmieniony przez Wilq 2020-04-02, 15:41, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-04-02, 15:45


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Nie u?ywaj zmiennej, kt?r? definiujesz pojazd w innej sytuacji.

Spr?buj:

addEventHandler('onVehicleStartEnter'resourceRoot, function(player,seat)
    if seat ~= 0 then return end
    if getElementData(player,'player:biznes') ~= 'ArctisTimes' then 
        cancelEvent()
        return
    end
    if getVehiclePlateText(source) == 'AT 1' or getVehiclePlateText(source) == 'AT 2' or getVehiclePlateText(source) == 'AT 3' or getVehiclePlateText(source) == 'AT 5' or getVehiclePlateText(source) == 'AT 5' or getVehiclePlateText(source) == 'AT 6' then 
        if getElementData(player,'player:rank2') < 1 then
            cancelEvent()
        end
    elseif getVehiclePlateText(source) == 'AT 7' or getVehiclePlateText(source) == 'AT 8' or getVehiclePlateText(source) == 'AT 10' or getVehiclePlateText(source) == 'AT 11' then 
        if getElementData(player,'player:rank2') < 2 then
            cancelEvent()
        end
    elseif getVehiclePlateText(source) == 'AT 9' then 
        if getElementData(player,'player:rank2') < 97 then
            cancelEvent()
        end
    end
end)


Jeste? pewny, ?e masz element dat? 'player:biznes' ustawion? na "ArctisTimer" oraz odpowiednie element daty 'player:rank2'?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-04-03, 12:33


pozdrominiek







Wiek: 26
Na forum: 2285 dni
Posty: 57



Respekt: 50

to nie dzia?a?o, zrobi?em to inaczej

Postaw piwo autorowi tego posta
 

 
Tagi: tablice :: rejestracyjne
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