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

Wysłany: 2020-08-18, 11:07


xyzzzikk

.gg






Wiek: 18
Na forum: 2774 dni
Posty: 175
Nick w MP: aspyk

Piwa: 6499

Respekt: 30,5

Cze??, mam skrypt na kupowanie pojazd?w, lecz pobiera mi pieni?dze a pojazdu nie respi...

S:

--[[
    Code Authorkaasis/rivor2
    Contact Infohttp://steamcommunity.com/id/rivor2
]]--

-- give item if all went success
function onClientSuccessBuysItem(target,item,currency,amount,price)
    --setElementData(target,item,getElementData(target,item)+amount)
    setElementData(target,item,givePlayerMoney(targetitem))
    --setElementData(target,currency,getElementData(target,currency)-price)
    setElementData(target,currency,takePlayerMoney(target,currency))
end
addEvent("MTAZeu:onClientSuccessBuysItem",true)
addEventHandler("MTAZeu:onClientSuccessBuysItem",getRootElement(),onClientSuccessBuysItem)

-- spawn vehicle if all went success
function onClientSuccessBuysVehicle(target,currency,price,x,y,z,rx,ry,rz,id,engine,rotor,tires,tankparts,scrap,slots,fuel)
    if takePlayerMoney(target,currency) < price then return; end
    --if takePlayerMoney(targetcurrency) < price then return; end
    local veh createVehicle(id,x,y,z,rx,ry,rz);
    local vehCol createColSphere(x,y,z,2.5);
    if (id == 528then setVehicleDamageProof(veh,true); end
    attachElements(vehCol,veh);
    setElementData(vehCol,"parent",veh);
    setElementData(veh,"parent",vehCol);
    setElementData(vehCol,"vehicle",true);
    setElementData(veh,"dayzvehicle",0);
    setElementData(vehCol,"MAX_Slots",tonumber(slots));
    setElementData(vehCol,"Engine_inVehicle",engine);
    setElementData(vehCol,"Rotor_inVehicle",rotor);
    setElementData(vehCol,"Tire_inVehicle",tires);
    setElementData(vehCol,"Parts_inVehicle",tankparts);
    --setElementData(vehCol,"Scrap_inVehicle",scrap);
    setElementData(vehCol,"needtires"tires);
    setElementData(vehCol,"needparts"tankparts);
    setElementData(vehCol,"needscrap"scrap);
    --setElementData(vehCol,"needrotor"rotor);
    setElementData(vehCol,"needengines"engine);
    setElementData(vehCol,"spawn",{id,x,y,z});
    setElementData(vehCol,"fuel",fuel);
    setElementData(target,currency,takePlayerMoney(target,currency))
end
addEvent("MTAZeu:onClientSuccessBuysVehicle",true)
addEventHandler("MTAZeu:onClientSuccessBuysVehicle",getRootElement(),onClientSuccessBuysVehicle)

addEventHandler("onPlayerLogin",root,function()
    triggerClientEvent(source,"load_shop",source);
end);


C:
--[[
    Code Authorkaasis/rivor2
    Contact Infohttp://steamcommunity.com/id/rivor2
]]--

local shop_gui = {tab = {},tabpanel = {},label = {},gridlist = {},window = {},button = {},memo = {}}

local shop = {
    ["sf_docks"] = {
        ["normal"] = {
            ["supply_dealer"] = {-2316.357,2341.581,5.816,0},
            ["vehicle_dealer"] = {-2318.751,2341.252,5.816,0},
            ["supply_dealer_marker"] = {-2316.474,2342.978,5.816},
            ["vehicle_dealer_marker"] = {-2318.938,2342.724,5.816,-2323.510,2343.452,5.816,0,0,0}, -- {marker_x,marker_y,marker_z,vehicle_spawn_x,vehicle_spawn_y,vehicle_spawn_z,rx,ry,rz}
        },
    },
    ["ls_docks"] = {
        ["normal"] = {
            ["supply_dealer"] = {2771.237,-1605.615,11.440,-90},
            ["vehicle_dealer"] = {2789.657,-1624.846,11.282,0},
            ["supply_dealer_marker"] = {2772.641,-1605.640,11.440},
            ["vehicle_dealer_marker"] = {2789.610,-1623.489,10.921,2787.918,-1619.733,11.006,0,0,80}, -- {marker_x,marker_y,marker_z,vehicle_spawn_x,vehicle_spawn_y,vehicle_spawn_z,rx,ry,rz}
        },
    },
}

local shop_items = {
    ["normal"] = {
        ["supply"] = {
            -- example: {"itemdata",amount,price};
            ["Weapons"] = {
                {"weapon11",1,50},
                {"weapon21",1,20},
                {"weapon23",1,15},
                {"weapon20",1,30},
            },
            ["Ammo"] = {
                {"mag5",20,12},
                {"mag1",15,12},
                {"mag3",30,12},
            },
            ["Food"] = {
                {"fooditem4",1,10},
                {"fooditem5",1,10},
                {"fooditem1",1,10},
            },
            ["Parts"] = {
                {"vehiclepart1",1,25},
                {"vehiclepart2",1,25},
                {"vehiclepart3",1,25},
                {"vehiclepart4",1,25},
                {"vehiclepart5",1,25}
            },
            ["Backpacks"] = {
                {"backpack4",1,15},
                {"backpack3",1,25},
                {"backpack2",1,35},
            },
            ["Toolbelts"] = {
                {"toolbelt4",1,10},
            },
            --["Convert"] = {
            --    {"zKill Bag",1,10},
            --},
        },
        ["vehicle"] = {
            ["L?dowe"] = {
                -- example: {"name",id,engine,rotor,tires,tankparts,scrap,slots,fuel,price}
                {"Patriot",528,1,0,4,1,1,50,80,500},
    
            },

            ["Powietrzne"] = {

                {"Patriot",528,1,0,4,1,1,50,80,500},
        },
    },
    },
}

local currency_item "zombieskilled";

--{[ DO NOT CHANGE THEESE ]}--
local shop_marker nil;
local shop_marker_type nil;
local shop_humanity_type nil;
local vehicle_spawn_position nillocal vehicle_spawn_position_col = {};
--{[ DO NOT CHANGE THEESE ]}--


function load_shop()
    for i,v in pairs(shop) do
        local current_shop i;
        for i,v in pairs(v) do
            if (~= "items"then
                local humanity_type i;
                for i,v in pairs(v) do
                    if (== "supply_dealer"then
                        local supplyDealer createPed(29,v[1],v[2],v[3],v[4],false)
                        setElementFrozen(supplyDealer,true)
                        setPedVoice(supplyDealer"PED_TYPE_DISABLED")
                        addEventHandler("onClientRender",root,function()
                            dxDrawTextOnElement(supplyDealer,"supply dealer",0.25,10,0,0,0,255,1.02,"sans")
                            dxDrawTextOnElement(supplyDealer,"supply dealer",0.26,10,0,200,100,255,1,"sans")
                        end)
                    elseif (== "vehicle_dealer"then
                        local vehicleDealer createPed(28,v[1],v[2],v[3],v[4],false)
                        setPedVoice(vehicleDealer"PED_TYPE_DISABLED")
                        setElementFrozen(vehicleDealer,true)
                        addEventHandler("onClientRender",root,function()
                            dxDrawTextOnElement(vehicleDealer,"vehicle dealer",0.25,10,0,0,0,255,1.02,"sans")
                            dxDrawTextOnElement(vehicleDealer,"vehicle dealer",0.26,10,0,200,100,255,1,"sans")
                        end)
                    elseif (== "supply_dealer_marker"then
                        local supplyShopMarker createMarker(v[1],v[2],v[3]-1,"cylinder",0.62,0,255,0,69)
                        addEventHandler("onClientMarkerHit",supplyShopMarker,function(player)
                            if (player == localPlayerthen
                                if (humanity_type == "hero"then
                                    if (getElementData(source,"humanity") >= 5000then
                                        guiSetVisible(shop_gui.window[1],true)
                                        showCursor(true)
                                        shop_marker current_shop;
                                        shop_marker_type "supply";
                                        shop_humanity_type humanity_type;
                                        updateShop();
                                    else
                                        outputChatBox("Dealer: You need to have atleast 5000 humanity in order to shop here.",200,55,0)
                                    end
                                elseif (humanity_type == "bandit"then
                                    if (getElementData(source,"humanity") <= -5000then
                                        guiSetVisible(shop_gui.window[1],true)
                                        showCursor(true)
                                        shop_marker current_shop;
                                        shop_marker_type "supply";
                                        shop_humanity_type humanity_type;
                                        updateShop();
                                    else
                                        outputChatBox("Dealer: You need to have atleast -5000 humanity in order to shop here.",200,55,0)
                                    end
                                elseif (humanity_type == "blackmarket" or humanity_type == "normal"then
                                    guiSetVisible(shop_gui.window[1],true)
                                    showCursor(true)
                                    shop_marker current_shop;
                                    shop_marker_type "supply";
                                    shop_humanity_type humanity_type;
                                    updateShop();
                                end
                            end
                        end)
                        addEventHandler("onClientMarkerLeave",supplyShopMarker,function(player)
                            if (player == localPlayerthen
                                if (humanity_type == "hero"then
                                    if (getElementData(source,"humanity") >= 5000then
                                        guiSetVisible(shop_gui.window[1],false)
                                        showCursor(false)
                                        if (isEventHandlerAdded("onClientGUIClick",shop_gui.gridlist[1],updateItems)) then
                                            removeEventHandler("onClientGUIClick",shop_gui.gridlist[1],updateItems)
                                        end
                                        shop_marker nil;
                                        shop_marker_type nil;
                                        shop_humanity_type nil;
                                        killErrorMessageTimer();
                                    end
                                elseif (humanity_type == "bandit"then
                                    if (getElementData(source,"humanity") <= -5000then
                                        guiSetVisible(shop_gui.window[1],false)
                                        showCursor(false)
                                        if (isEventHandlerAdded("onClientGUIClick",shop_gui.gridlist[1],updateItems)) then
                                            removeEventHandler("onClientGUIClick",shop_gui.gridlist[1],updateItems)
                                        end
                                        shop_marker nil;
                                        shop_marker_type nil;
                                        shop_humanity_type nil;
                                        killErrorMessageTimer();
                                    end
                                elseif (humanity_type == "blackmarket" or humanity_type == "normal"then
                                    guiSetVisible(shop_gui.window[1],false)
                                    showCursor(false)
                                    if (isEventHandlerAdded("onClientGUIClick",shop_gui.gridlist[1],updateItems)) then
                                        removeEventHandler("onClientGUIClick",shop_gui.gridlist[1],updateItems)
                                    end
                                    shop_marker nil;
                                    shop_marker_type nil;
                                    shop_humanity_type nil;
                                    killErrorMessageTimer();
                                end
                            end
                        end)
                    elseif (== "vehicle_dealer_marker"then
                        local vehicleShopMarker createMarker(v[1],v[2],v[3]-1,"cylinder",0.62,0,255,0,69)
                        vehicle_spawn_position_col[current_shop] = createColSphere(v[4],v[5],v[6],4.5)
                        addEventHandler("onClientMarkerHit",vehicleShopMarker,function(player)
                            if (player == localPlayerthen
                                if (humanity_type == "hero"then
                                    if (getElementData(source,"humanity") >= 5000then
                                        guiSetVisible(shop_gui.window[1],true)
                                        showCursor(true)
                                        shop_marker current_shop;
                                        shop_marker_type "vehicle";
                                        shop_humanity_type humanity_type;
                                        vehicle_spawn_position = {v[4],v[5],v[6],v[7],v[8],v[9]}
                                        updateShop();
                                    else
                                        outputChatBox("Dealer: You need to have atleast 5000 humanity in order to shop here.",200,55,0)
                                    end
                                elseif (humanity_type == "bandit"then
                                    if (getElementData(source,"humanity") <= -5000then
                                        guiSetVisible(shop_gui.window[1],true)
                                        showCursor(true)
                                        shop_marker current_shop;
                                        shop_marker_type "vehicle";
                                        shop_humanity_type humanity_type;
                                        vehicle_spawn_position = {v[4],v[5],v[6],v[7],v[8],v[9]}
                                        updateShop();
                                    else
                                        outputChatBox("Dealer: You need to have atleast -5000 humanity in order to shop here.",200,55,0)
                                    end
                                elseif (humanity_type == "blackmarket" or humanity_type == "normal"then
                                    guiSetVisible(shop_gui.window[1],true)
                                    showCursor(true)
                                    vehicle_spawn_position = {v[4],v[5],v[6],v[7],v[8],v[9]}
                                    shop_marker current_shop;
                                    shop_marker_type "vehicle";
                                    shop_humanity_type humanity_type;
                                    updateShop();
                                end
                            end
                        end)
                        addEventHandler("onClientMarkerLeave",vehicleShopMarker,function(player)
                            if (player == localPlayerthen
                                if (humanity_type == "hero"then
                                    if (getElementData(source,"humanity") >= 5000then
                                        guiSetVisible(shop_gui.window[1],false)
                                        showCursor(false)
                                        if (isEventHandlerAdded("onClientGUIClick",shop_gui.gridlist[1],updateItems)) then
                                            removeEventHandler("onClientGUIClick",shop_gui.gridlist[1],updateItems)
                                        end
                                        shop_marker nil;
                                        shop_marker_type nil;
                                        shop_humanity_type nil;
                                        vehicle_spawn_position nil;
                                        killErrorMessageTimer();
                                    end
                                elseif (humanity_type == "bandit"then
                                    if (getElementData(source,"humanity") <= 0then
                                        guiSetVisible(shop_gui.window[1],false)
                                        showCursor(false)
                                        if (isEventHandlerAdded("onClientGUIClick",shop_gui.gridlist[1],updateItems)) then
                                            removeEventHandler("onClientGUIClick",shop_gui.gridlist[1],updateItems)
                                        end
                                        shop_marker nil;
                                        shop_marker_type nil;
                                        shop_humanity_type nil;
                                        vehicle_spawn_position nil;
                                        killErrorMessageTimer();
                                    end
                                elseif (humanity_type == "blackmarket" or humanity_type == "normal"then
                                    guiSetVisible(shop_gui.window[1],false)
                                    showCursor(false)
                                    if (isEventHandlerAdded("onClientGUIClick",shop_gui.gridlist[1],updateItems)) then
                                        removeEventHandler("onClientGUIClick",shop_gui.gridlist[1],updateItems)
                                    end
                                    shop_marker nil;
                                    shop_marker_type nil;
                                    shop_humanity_type nil;
                                    vehicle_spawn_position nil;
                                    killErrorMessageTimer();
                                end
                            end
                        end)
                        if (humanity_type == "hero"then
                            createBlip(v[4],v[5],v[6],31,1,0,0,0,255,0,0)
                        elseif (humanity_type == "bandit"then
                            createBlip(v[4],v[5],v[6],32,1,0,0,0,255,0,0)
                        elseif (humanity_type == "normal"then
                            createBlip(v[4],v[5],v[6],18,1,0,0,0,255,0,0)
                        end
                    end
                end
            end
        end
    end
end
addEvent("load_shop",true);
addEventHandler("load_shop",root,load_shop);

addEventHandler("onClientResourceStart",resourceRoot,function()
    if getElementData(localPlayer,"logedin"then
        load_shop();
    end
end);

function killErrorMessageTimer()
    if isTimer(errorMessageTimerthen
        killTimer(errorMessageTimer)
        guiSetText(shop_gui.label[4],"")
        guiSetAlpha(shop_gui.label[4],1)
    end
end

function buyItem()
    if isTimer(errorMessageTimerthen
        killTimer(errorMessageTimer)
        guiSetText(shop_gui.label[4],"")
        guiSetAlpha(shop_gui.label[4],1)
        errorMessageTimer setTimer(removeErrorMessage,275,15)
    else
        function removeErrorMessage()
            if (guiGetAlpha(shop_gui.label[4]) > 0.30then
                guiSetAlpha(shop_gui.label[4],guiGetAlpha(shop_gui.label[4])-0.05)
            elseif (guiGetAlpha(shop_gui.label[4]) < 0.30then
                if isTimer(errorMessageTimerthen killTimer(errorMessageTimerend
                guiSetText(shop_gui.label[4],"")
                guiSetAlpha(shop_gui.label[4],1)
            end
        end
        errorMessageTimer setTimer(removeErrorMessage,275,15)
    end

    if (guiGridListGetSelectedItem(shop_gui.gridlist[2] ) == -1then
        guiSetText(shop_gui.label[4],"Please select an item")
        guiLabelSetColor (shop_gui.label[4],255,0,0)
    else
        if (shop_marker_type == "supply"then
            local target localPlayer;
            local item guiGridListGetItemText(shop_gui.gridlist[2], guiGridListGetSelectedItem(shop_gui.gridlist[2]),1)
            local amount,price,itemdata unpack(guiGridListGetItemData(shop_gui.gridlist[2], guiGridListGetSelectedItem(shop_gui.gridlist[2]),2))
            guiLabelSetColor(shop_gui.label[4],255,0,0)

            if (getPlayerMoney(localPlayer) >= pricethen
                guiSetText(shop_gui.label[4],"You successfully bought "..item..".")
                guiLabelSetColor (shop_gui.label[4],0,149,14,255)
                triggerServerEvent("MTAZeu:onClientSuccessBuysItem",localPlayer,target,itemdata,amount,price)
            else
                guiSetText(shop_gui.label[4],"Nie masz tyle GP!")
            end
        elseif (shop_marker_type == "vehicle"then
            local target localPlayer;
            local vehicleName guiGridListGetItemText(shop_gui.gridlist[2], guiGridListGetSelectedItem(shop_gui.gridlist[2]),1)
            local id,engine,rotor,tires,tankparts,scrap,slots,fuel,price unpack(guiGridListGetItemData(shop_gui.gridlist[2],guiGridListGetSelectedItem(shop_gui.gridlist[2]),1))
            local x,y,z,rx,ry,rz unpack(vehicle_spawn_position)
            guiLabelSetColor(shop_gui.label[4],255,0,0)
            if (getPlayerMoney(localPlayer) >= pricethen
                for i,v in ipairs(getElementsWithinColShape(vehicle_spawn_position_col[shop_marker],"vehicle")) do
                    guiSetText(shop_gui.label[4],"Vehicle spawn area is taken, clear it before buying vehicle.")
                    return
                end
                guiSetVisible(shop_gui.window[1],false)
                showCursor(false)
                outputChatBox("You successfully bought "..vehicleName..".",0,255,0)
                triggerServerEvent("MTAZeu:onClientSuccessBuysVehicle",localPlayer,target,price,x,y,z,rx,ry,rz,id,engine,rotor,tires,tankparts,scrap,slots,fuel)
            else
                guiSetText(shop_gui.label[4], "Nie masz tyle GP!")
            end
        end
    end
end

addEventHandler("onClientGUIClick",resourceRoot,function()
    if (source == shop_gui.button[1]) then
        buyItem();
    elseif (source == shop_gui.button[2]) then
        if getElementData(localPlayer"logedin"then
            if (guiGetVisible(shop_gui.window[1]) == truethen
                guiSetVisibleshop_gui.window[1], false )
                showCursor(false)
                if (isEventHandlerAdded("onClientGUIClick",shop_gui.gridlist[1],updateItems)) then
                    removeEventHandler("onClientGUIClick",shop_gui.gridlist[1],updateItems)
                end
                shop_marker nil;
                shop_marker_type nil;
                shop_humanity_type nil;
                vehicle_spawn_position nil;
                killErrorMessageTimer();
            end
        end
    end
end)

addEventHandler("onClientElementDataChange",root,function(data)
    if getElementData(localPlayer"logedin"then
        if (string.find(data,currency_item)) then
        --    guiSetText(shop_gui.label[1], " zKills: "..getPlayerMoney(localPlayercurrency_item))
        end
    end
end)

addEventHandler("onClientResourceStart",resourceRoot,function()
    local screenWscreenH guiGetScreenSize()
    shop_gui.window[1] = guiCreateWindow((screenW 481) / 2, (screenH 245) / 2551245"Shop"false)
    guiWindowSetSizable(shop_gui.window[1], false)
    guiSetVisible(shop_gui.window[1],false)
    guiSetProperty(shop_gui.window[1],"AlwaysOnTop","True");

    shop_gui.tabpanel[1] = guiCreateTabPanel(1026380231falseshop_gui.window[1])

    shop_gui.tab[1] = guiCreateTab("Buy"shop_gui.tabpanel[1])

    shop_gui.gridlist[1] = guiCreateGridList(55102176falseshop_gui.tab[1])
    guiGridListAddColumn(shop_gui.gridlist[1], "Kategoria"0.8)
    guiSetProperty(shop_gui.gridlist[1],"SortSettingEnabled","False")
    shop_gui.gridlist[2] = guiCreateGridList(1075267176falseshop_gui.tab[1])
    guiGridListAddColumn(shop_gui.gridlist[2], ""0.5)
    guiGridListAddColumn(shop_gui.gridlist[2], "Cena"0.4)
    guiSetProperty(shop_gui.gridlist[2],"SortSettingEnabled","False")

    shop_gui.gridlist[3] = guiCreateGridList(39548146188falseshop_gui.window[1])

    shop_gui.button[1] = guiCreateButton(415210032"KUP"falseshop_gui.gridlist[3])
    shop_gui.button[2] = guiCreateButton(1041523832"X"falseshop_gui.gridlist[3])
    shop_gui.label[1] = guiCreateLabel(1013113015""falseshop_gui.gridlist[3])

    shop_gui.memo[1] = guiCreateMemo(1010126118"Uwa?aj! Tutaj ka?dy mo?e cie zabi?."falseshop_gui.gridlist[3])
    guiSetProperty(shop_gui.memo[1], "Disabled""True") 
    guiSetAlpha(shop_gui.memo[1],0.7)

    shop_gui.tab[2] = guiCreateTab("Sell"shop_gui.tabpanel[1])
    guiSetEnabled(shop_gui.tab[2],false)

    shop_gui.label[4] = guiCreateLabel(1872234926""falseshop_gui.window[1])
    guiLabelSetHorizontalAlign(shop_gui.label[4], "right"false)
    guiLabelSetVerticalAlign(shop_gui.label[4], "center")

    function updateShop()
        guiGridListClear(shop_gui.gridlist[1])
        guiGridListClear(shop_gui.gridlist[2])
        if (shop_marker_type == "supply"then
            guiSetText(shop_gui.window[1],"Supply Shop")
            guiGridListSetColumnTitle(shop_gui.gridlist[2],1,"Item")

            -- loads categories
            for i,v in pairs(shop_items) do
                if (== shop_humanity_typethen
                    for i,v in pairs(v) do
                        if (== shop_marker_typethen
                            for i,v in pairs(v) do
                                local row guiGridListAddRow(shop_gui.gridlist[1])
                                guiGridListSetItemText(shop_gui.gridlist[1], row1ifalsefalse)
                            end
                        end
                    end
                end
            end

            -- loads items from player choosed category
            function updateItems()
                guiGridListClear(shop_gui.gridlist[2])
                local category guiGridListGetItemText(shop_gui.gridlist[1],guiGridListGetSelectedItem(shop_gui.gridlist[1]))
                if (category ~= ""then
                    for i,v in pairs(shop_items) do
                        if (== shop_humanity_typethen
                            for i,v in pairs(v) do
                                if (== shop_marker_typethen
                                    for i,v in ipairs(v[category]) do
                                        local row guiGridListAddRow(shop_gui.gridlist[2])
                                        guiGridListSetItemText(shop_gui.gridlist[2], row1exports.dayzepoch:getLanguageTextClient(v[1]), falsefalse)
                                        guiGridListSetItemText(shop_gui.gridlist[2], row2v[3], falsefalse)
                                        guiGridListSetItemData(shop_gui.gridlist[2], row2, {v[2],v[3],v[1]})
                                    end
                                end
                            end    
                        end
                    end
                end
            end
            addEventHandler("onClientGUIClick",shop_gui.gridlist[1],updateItems,false) 
        elseif (shop_marker_type == "vehicle"then
            guiSetText(shop_gui.window[1],"Sklep GP")
            guiGridListSetColumnTitle(shop_gui.gridlist[2],1,"Pojazd")

            -- loads categories
            for i,v in pairs(shop_items) do
                if (== shop_humanity_typethen
                    for i,v in pairs(v) do
                        if (== shop_marker_typethen
                            for i,v in pairs(v) do
                                local row guiGridListAddRow(shop_gui.gridlist[1])
                                guiGridListSetItemText(shop_gui.gridlist[1], row1ifalsefalse)
                            end
                        end
                    end
                end
            end

            -- loads items from player choosed category
            function updateItems()
                guiGridListClear(shop_gui.gridlist[2])
                local category guiGridListGetItemText(shop_gui.gridlist[1],guiGridListGetSelectedItem(shop_gui.gridlist[1]))
                if (category ~= ""then
                    for i,v in pairs(shop_items) do
                        if (== shop_humanity_typethen
                            for i,v in pairs(v) do
                                if (== shop_marker_typethen
                                    for i,v in ipairs(v[category]) do
                                        local row guiGridListAddRow(shop_gui.gridlist[2])
                                        guiGridListSetItemText(shop_gui.gridlist[2], row1v[1], falsefalse)
                                        guiGridListSetItemText(shop_gui.gridlist[2], row2v[10], falsefalse)
                                        guiGridListSetItemData(shop_gui.gridlist[2], row1, {v[2],v[3],v[4],v[5],v[6],v[7],v[8],v[9],v[10]})
                                    end
                                end
                            end    
                        end
                    end
                end
            end
            addEventHandler("onClientGUIClick",shop_gui.gridlist[1],updateItems,false) 
        end
    end
end)



-- [[ SOME USEFUL FUNCTIONS ]]



function isEventHandlerAddedsEventNamepElementAttachedTofunc )
    if typesEventName ) == 'string' and isElementpElementAttachedTo ) and typefunc ) == 'function' then
    local aAttachedFunctions getEventHandlerssEventNamepElementAttachedTo )
        if typeaAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then
            for iv in ipairsaAttachedFunctions ) do
                if == func then
                return true
                end
            end
        end
    end
    return false
end

function dxDrawTextOnElement(TheElement,text,height,distance,R,G,B,alpha,size,font,checkBuildings,checkVehicles,checkPeds,checkDummies,seeThroughStuff,ignoreSomeObjectsForCamera,ignoredElement)
                local xygetPedBonePosition(TheElement,6)
                local x2y2z2 getPedBonePosition(localPlayer,6)
                local distance distance or 20
                local height height or 1
                                local checkBuildings checkBuildings or true
                                local checkVehicles checkVehicles or false
                                local checkPeds checkPeds or false
                                local checkObjects checkObjects or true
                                local checkDummies checkDummies or true
                                local seeThroughStuff seeThroughStuff or false
                                local ignoreSomeObjectsForCamera ignoreSomeObjectsForCamera or false
                                local ignoredElement ignoredElement or nil
                if (isLineOfSightClear(xyzx2y2z2checkBuildingscheckVehiclescheckPeds checkObjects,checkDummies,seeThroughStuff,ignoreSomeObjectsForCamera,ignoredElement)) then
                    local sxsy getScreenFromWorldPosition(xyz+height)
                    if(sx) and (sythen
                        local distanceBetweenPoints getDistanceBetweenPoints3D(xyzx2y2z2)
                        if(distanceBetweenPoints distancethen
                            dxDrawText(textsx+2sy+2sxsytocolor(or 255or 255or 255alpha or 255), (size or 1), font or "arial""center""center")
            end
        end
    end
end


b??d db3:
[sr]\carshop\shop_s.lua18: attempt to compare boolean with number

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-18, 12:04


PatryKK.

Emeryt LUA






Wiek: 26
Na forum: 3060 dni
Posty: 1060
Nick w MP: PatryKK.

Piwa: 2322

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

Kt?ra to 18 linijka?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-18, 13:54


Szyszka947

ASP NET Core / Lua






Wiek: 19
Na forum: 2579 dni
Posty: 288

Piwa: 16

Respekt: 90


if takePlayerMoney(target,currency) < price then return; end

-takePlayerMoney
Returns
Returns true if the money was taken, or false if invalid parameters were passed.
Czyli por?wnujesz booleana z liczb?, jak m?wi sam b??d. Domy?lam si?, ?e w og?le nie chodzi w tym kodzie o funkcje takePlayerMoney, kt?ra zabiera pieni?dze danemu graczu. U?yj getPlayerMoney.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-18, 16:03


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4394 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Spr?buj przekszta?ci? bodaj?e to jest zmienna 'price' na tonumber(price)

[ Dodano: 2020-08-18, 16:27 ]
Chocia? nie, bo skoro pieni?dze zabiera, poka? mi t? b??dn? linijk?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-18, 22:27


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

takePlayerMoney u?yj poni?ej bez warunku sprawdzaj?cego.
U?yj getPlayerMoney ?eby sprawdzi?, czy grasz posiada dan? kwot?.


Więcej informacji znajdziesz w Wikipedii MTA:

getPlayerMoney


Postaw piwo autorowi tego posta
 

 
Tagi: kupowanie :: pojazdów
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Kupowanie pojazdów Odpowiedz do tematu

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