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

Wysłany: 2017-07-16, 22:33


SamsungPLL

Programista lodówek






Wiek: 23
Na forum: 3805 dni
Posty: 123
Nick w MP: SamsungPLL

Piwa: 135

Respekt: 55,3

Witam, tak jak w temacie.

local isVehicles=nil
local isColored={
    -- Nazwa koloru, {r,g,b koloru}, cena
    {"?wiat?a Zwyk?e - Bia?e", {255,255,255}, 0},
    {"?wiat?a Czerwone", {255,0,0}, 5000},
    {"?wiat?a Niebieskie", {0,18,199}, 4000},
    {"?wiat?a ???te", {255,255,0}, 4500},
    {"?wiat?a Zielone", {0,255,0}, 4300},
    {"?wiat?a Zielone Ciemne", {0,64,0}, 4300},
    {"?wiat?a Jasno Niebieskie", {48,213,200}, 5500},
    {"?wiat?a R??owe", {255,52,225}, 3900},
    {"?wiat?a Fioletowe", {192,0,255}, 3900},
    {"?wiat?a Pomara?czowe", {255,128,0}, 4000},
    {"?wiat?a Aqua", {0,255,255}, 4500},
    {"?wiat?a Czerwone Ciemne", {128,0,0}, 5000},
}

local wn={}
wn.window=guiCreateWindow(0.180.190.640.62""true)
wn.grid=guiCreateGridList(0.030.070.620.89truewn.window)
guiGridListAddColumn(wn.grid"Kolor"0.5)
guiGridListAddColumn(wn.grid"Koszt"0.5)
wn.btn_submit=guiCreateButton(0.670.080.310.33"Zamontuj"truewn.window)
wn.btn_close=guiCreateButton(0.670.630.310.33"Zamknij"truewn.window)
guiSetVisible(wn.windowfalse)

addEventHandler("onClientMarkerHit"resourceRoot, function(el,md)
    if not md or el~=localPlayer then return end
    local cs=getElementData(source"marker:cuboid")
    if not cs then return end
    local job=getElementData(source,"marker:duty")
    local ljob=getElementData(el,"player:duty")
    if job ~= ljob then
        outputChatBox("* Nie jeste? zatrudniony jako pracownik tuningu."25500)
        return
    end
    local vehicles=getElementsWithinColShape(cs,"vehicle")
    if #vehicles < 1 then
        outputChatBox("* Na stanowisku nie znajduje si? pojazd."25500)
        return
    end
    if #vehicles > 1 then
        outputChatBox("* Na stanowisku monta?u jest zbyt du?o pojazd?w."25500)
        return
    end
    if getElementHealth(vehicles[1]) < 800 then
        outputChatBox("* Pojazd jest zbyt uszkodzony aby zamontowa? ?wiat?a."25500)
        return
    end
    isVehicles=vehicles[1]
    showCursor(true,false)
    guiGridListClear(wn.grid)
    guiSetVisible(wn.windowtrue)
    for i,v in ipairs(isColored) do
        local row=guiGridListAddRow(wn.grid)
        guiGridListSetItemText(wn.gridrow1v[1], falsefalse)
        guiGridListSetItemData(wn.gridrow1v[2], falsefalse)
        guiGridListSetItemColor(wn.gridrow1v[2][1], v[2][2], v[2][3])
        guiGridListSetItemData(wn.gridrow1v[2], falsefalse)
        guiGridListSetItemText(wn.gridrow2v[3].." PLN"falsefalse)
        guiGridListSetItemData(wn.gridrow2v[3], falsefalse)
    end
end)

addEventHandler("onClientMarkerLeave"resourceRoot, function(el,md)
    if el~=localPlayer then return end
    isVehicles=nil
    showCursor(false)
    guiSetVisible(wn.windowfalse)
end)

addEventHandler("onClientGUIClick"wn.btn_submit, function()
    if not isVehicles then return end
    selectedRow=guiGridListGetSelectedItem(wn.grid) or -1
    if selectedRow 0 then return end
    local color=guiGridListGetItemData(wn.gridselectedRow1)
    local cost=tonumber(guiGridListGetItemData(wn.gridselectedRow2))
    if not cost then return end
    if cost getPlayerMoney(localPlayerthen
        outputChatBox("* Nie posiadasz tyle got?wki."25500)
        return
    end
    triggerServerEvent("montazElementu"rootisVehicles"swiatla", {color[1], color[2], color[3]}, cost)
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-16, 22:48


Szymczu

Programista bo tak






Wiek: 27
Na forum: 3434 dni
Posty: 194
Nick w MP: Szymczu

Piwa: 36

Respekt: 120
Respekt: 120

takePlayerMoney(cost)

Dodaj na samym ko?cu przed triggerem

Postaw piwo autorowi tego posta
 

 
Tagi: tuning :: nie :: zabiera :: pieniedzy.
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