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

Wysłany: 2018-08-12, 17:48


bango162







Wiek: 22
Na forum: 4095 dni
Posty: 13
Nick w MP: Rupek



Respekt: 50

Mam problem z Importem pojazd?w z paczki XyzzyRP, wchodz? w blip wpisuj?, /importujpojazd 410

Ale nie dzia?a
Z g?ry dzi?ki za odpowied?

Ostatnio zmieniony przez Atroth 2018-08-21, 09:17, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-12, 22:02


PatryKK.

Emeryt LUA






Wiek: 27
Na forum: 3202 dni
Posty: 1059
Nick w MP: PatryKK.

Piwa: 2331

Respekt: 331,5
Respekt: 331,5Respekt: 331,5Respekt: 331,5

Kod skryptu? Baza wgrana?

Podpis
GG:75080675
- ✔
- ✔
- ✔
- ✔

Aktualny projekt: BRAK
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-12, 22:58


bango162







Wiek: 22
Na forum: 4095 dni
Posty: 13
Nick w MP: Rupek



Respekt: 50


local importowanePojazdy = { 496, 516, 517, 401, 410, 518, 600, 527, 436, 419, 439, 533, 549, 526,
491, 474, 445, 426, 507, 547, 585, 405, 466, 492, 566, 540, 551, 421,
529, 420, 499, 609, 498, 422, 414, 531, 456, 543, 482, 554, 418, 413,
536, 575, 567, 535, 576, 412, 402, 542, 603, 475, 495, 508, 500,
559, 561, 480, 560, 565, 558, 555, 579, 400, 404, 489, 479, 610, 611}

-- sportowe zablokowane - 411, 506, 451, 541, 415, 429, 477, 587, 602

local function pojazdImportowalny(vid)
    if (getVehicleType(vid)~="Automobile") then return false end
    for i,v in ipairs(importowanePojazdy) do
    if (v==vid) then return true end
    end
    return false
end

local function maDostep(plr)
    local c=getElementData(plr,"character")
    if not c then return false end
    if c and c.id and (tonumber(c.id)==1 or tonumber(c.id)==3578 or tonumber(c.id)==19) then return true end
    return false
end

function listaPojazdowDoImportu(full)
    local dane=exports.DB:pobierzTabeleWynikow("SELECT vid FROM lss_importpojazdow")
    local wyniki={}
    if not full then
    for i,v in ipairs(dane) do
        table.insert(wyniki, tonumber(v.vid))
    end
    return wyniki
    end
    for i,v in ipairs(dane) do
    v.vid=tonumber(v.vid)
    v.nazwa=getVehicleNameFromModel(v.vid)
    end
    return dane
    
end

local D=3
local I=2

local marker=createMarker(2424.71,-2678.00,2034.37,"cylinder",1,255,255,255,100)
setElementInterior(marker,I)
setElementDimension(marker,D)


addEventHandler("onMarkerHit", marker, function(he,md)

    if (getElementType(he)~="player") then    return    end
    if (not maDostep(he)) then return end
    
    local listapojazdow=listaPojazdowDoImportu(true)
    if (not listapojazdow or #listapojazdow<7) then
    outputChatBox("Lista zam?wie? jest pusta.", he)
    outputChatBox("(( Dodaj pojazd za pomoc? komendy /importujpojazd ))", he)
    return
    end
    outputChatBox("Lista pojazd?w do importu:", he)
    for i,v in ipairs(listapojazdow) do
    outputChatBox(string.format("%d. %d %s", i, v.vid, v.nazwa), he)
    end
    if (#listapojazdow<7) then
        outputChatBox("(( Dodaj kolejny pojazd za pomoc? komendy /importujpojazd ))", he)
    else
    outputChatBox("Lista zam?wie? jest pe?na.", he)
    end
end)

function cmd_importujpojazd(plr,cmd,vid,cena)
    if (not maDostep(plr)) then return false end
    if (not isElementWithinMarker(plr,marker)) then
    outputChatBox("Nie jeste? przy komputerze w biurze.", plr)
    return
    end
    local listapojazdow=listaPojazdowDoImportu(false)
    if (not vid or not tonumber(vid)) then
    outputChatBox("Uzyj: /importujpojazd <id pojazdu>", plr)
    return
    end
    vid=tonumber(vid)
    if (not pojazdImportowalny(vid)) then
    outputChatBox("Tego pojazdu nie mo?na zaimportowa?.", plr)
    return
    end
    local cenaPojazdu=math.floor(getModelHandling(vid).monetary*43.8);
    if (not cena or not tonumber(cena) or tonumber(cena)~=cenaPojazdu) then
    outputChatBox("Koszt importu: " .. cenaPojazdu .."$.", plr)
    outputChatBox("Aby potwierdzi? import wpisz: /importujpojazd " .. vid .. " " .. cenaPojazdu, plr)
    return
    end

    if (listapojazdow and type(listapojazdow)=="table" and #listapojazdow>=7) then
    outputChatBox("Obecnie z?o?ona jest ju? maksymalna ilo?? zam?wie? na pojazdy, poczekaj na dostaw? aktualnych.", plr)
    return
    end

    if (getPlayerMoney(plr)<cenaPojazdu) then
    outputChatBox("Nie masz wystarczaj?cej ilo?ci got?wki.", plr)
    return
    end
    takePlayerMoney(plr, cenaPojazdu)
    local query=string.format("INSERT INTO lss_importpojazdow SET vid=%d", vid)
    exports.DB:zapytanie(query)
    outputChatBox("Pojazd zosta? dodany na list? pojazd?w do importu", plr);
end

addCommandHandler("importujpojazd", cmd_importujpojazd, false,false)


Ostatnio zmieniony przez Barcioo 2018-08-13, 07:12, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Tagi: import :: pojazdów :: xyzzyrp
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Import Pojazdów XyzzyRP 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