Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local I=0
- local D=0
- local oferta ={
- --broń
- { name="Kominiarka", name_biernik="kominiarkę", itemid=105, count=1, cost=2000},
- { name="Nóż", name_biernik="nóż", itemid=81, count=1, cost=500},
- { name="Kij baseballowy", name_biernik="kij baseballowy", itemid=31, count=1, cost=300},
- { name="Glock", name_biernik="Glocka", itemid=30, count=1, cost=3500},
- { name="Desert Eagle", name_biernik="Desert Eagle", itemid=110, count=1, cost=5000},
- { name="Uzi", name_biernik="Uzi", itemid=112, count=1, cost=15000},
- { name="Shotgun", name_biernik="Shotguna", itemid=109, count=1, cost=10000},
- --amunicja
- { name="Amunicja Glock", name_biernik="amunicję do Glocka", itemid=145, count=50, cost=500},
- { name="Amunicja Desert Eagle", name_biernik="amunicję do Desert Eagle", itemid=132, count=50, cost=500},
- { name="Amunicja Uzi", name_biernik="amunicję do Uzi", itemid=134, count=50, cost=500},
- { name="Amunicja Shotgun", name_biernik="amunicję do Shotguna", itemid=131, count=50, cost=700},
- }
- GUI_sklep = guiCreateGridList(0.7713,0.2267,0.2025,0.63,true)
- guiGridListSetSelectionMode(GUI_sklep,0)
- GUI_sklep_c_nazwa=guiGridListAddColumn(GUI_sklep,"Nazwa",0.5)
- GUI_sklep_c_ilosc=guiGridListAddColumn(GUI_sklep,"Ilość",0.2)
- GUI_sklep_c_koszt=guiGridListAddColumn(GUI_sklep,"Koszt",0.2)
- guiSetVisible(GUI_sklep,false)
- function oferta_fill()
- guiGridListClear(GUI_sklep)
- for i,v in pairs(oferta) do
- if (v.row and isElement(v.row)) then destroyElement(v.row) end
- v.row = guiGridListAddRow ( GUI_sklep )
- guiGridListSetItemText ( GUI_sklep, v.row, GUI_sklep_c_nazwa, v.name, false, false )
- guiGridListSetItemText ( GUI_sklep, v.row, GUI_sklep_c_ilosc, tostring(v.count), false, false)
- guiGridListSetItemText ( GUI_sklep, v.row, GUI_sklep_c_koszt, v.cost.."$", false, false )
- if (v.cost>getPlayerMoney()) then
- guiGridListSetItemColor(GUI_sklep, v.row, GUI_sklep_c_koszt, 255,0,0)
- else
- guiGridListSetItemColor(GUI_sklep, v.row, GUI_sklep_c_koszt, 155,255,155)
- end
- end
- for i,v in ipairs(oferta) do
- end
- end
- function oferta_wybor()
- local selectedRow, selectedCol = guiGridListGetSelectedItem( GUI_sklep );
- if (not selectedRow) then return end
- for i,v in pairs(oferta) do
- if (v.row==selectedRow) then
- if (v.cost>getPlayerMoney()) then
- outputChatBox("Nie stać Cię na to.", 255,0,0,true)
- return
- end
- -- guiSetVisible(GUI_sklep,false) -- aby nie klikli 2x
- -- exports["lss-gui"]:panel_hide()
- if (exports["lss-gui"]:eq_giveItem(v.itemid,v.count,v.subtype)) then
- triggerServerEvent("takePlayerMoney", localPlayer, v.cost)
- triggerServerEvent("broadcastCaptionedEvent", localPlayer, getPlayerName(localPlayer) .. " zakupuje " .. v.name_biernik..".", 5, 15, true)
- end
- end
- end
- return
- end
- addEventHandler( "onClientGUIDoubleClick", GUI_sklep, oferta_wybor, false );
- local lada=createColSphere(1675.27,-2113.98,13.55,2)
- setElementDimension(lada,D)
- setElementInterior(lada,I)
- local result = exports.DB2:pobierzWyniki("SELECT * FROM lss_character_co WHERE co_id=?")
- addEventHandler("onClientColShapeHit", lada, function(hitElement, matchindDimension)
- if (hitElement~=localPlayer or not matchindDimension or getElementInterior(localPlayer)~=getElementInterior(source)) then return end
- if not (result~=1 and result~=2) then outputChatBox("Nie możesz zakupić broni!") return end
- oferta_fill()
- guiSetVisible(GUI_sklep,true)
- end)
- addEventHandler("onClientColShapeLeave", lada, function(hitElement, matchindDimension)
- if (hitElement~=localPlayer or not matchindDimension or getElementInterior(localPlayer)~=getElementInterior(source)) then return end
- guiSetVisible(GUI_sklep,false)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement