Jump to content

Script not work


Dimos7

Recommended Posts

local GUIEditor= { 
   window = { }, 
   edit = { }, 
   label = { }, 
   button = { }, 
   scrollbar = { }, 
   gridlist = { } 
} 
  
local Crafts = { 
   {"Iron", 1}, 
   {"Oil", 2}, 
   {"Explosifs", 3} 
} 
  
local Weapons = { 
   {"Brass Knuckles", 1}, 
   {"Golf Club", 2}, 
   {"Nightstick", 3}, 
   {"Knife", 4}, 
   {"Baseball Bat", 5}, 
   {"Cane", 15}, 
   {"Shovel", 6}, 
   {"Pool Cue", 7}, 
   {"Katana", 8}, 
   {"Chainsaw", 9}, 
   {"Colt 45", 22}, 
   {"Silenced", 23}, 
   {"Desert Eagle", 24}, 
   {"Shotgun", 25}, 
   {"Spawn-off", 26}, 
   {"Spaz-12", 27}, 
   {"UZI", 28}, 
   {"MP5", 29}, 
   {"TEC-9", 32}, 
   {"AK47", 30}, 
   {"M4", 31}, 
   {"Country sniper", 33}, 
   {"Sniper", 34}, 
   {"Rocket Lanuncher", 35}, 
   {"Heat-Seeking RPG", 36}, 
   {"Flamethrower", 37}, 
   {"Minigun", 38}, 
   {"Grenade", 16}, 
   {"Tear gas", 17}, 
   {"Molotov", 18}, 
   {"Satchel", 39}, 
   {"Satchel detonator", 40}, 
   {"Spraycan", 41}, 
   {"Fire Extinguisher", 42}, 
   {"Camera", 43}, 
   {"Night vision goggles", 44}, 
   {"Infrared oggles", 45}, 
   {"Parachute", 46}, 
   {"Long Dildo", 10}, 
   {"Short Dildo", 11}, 
   {"Vibrator", 12}, 
   {"Flowers", 14}, 
} 
  
function createCraftWindow() 
   GUIEditor.window [1]= guiCreateWindow(251, 224, 1230, 357, "Craft Window", false) 
   GUIEditor.gridlist[1] = guiCreateGridList(10, 33, 266, 354, false, GUIEditor.window[1]) 
   inctenrotry = guiGridListAddCoulmn(GUIEditor.girdlist[1], "Inventory", 0.60) 
   GUIEditor.gridlist[2] = guiCreateGridList(350, 33, 266, 354, false, GUIEditor.window[1]) 
   crafts= guiGridListAddCoulmn(GUIEditor.gridlist[2], "Craftable objects", 0.60) 
   GUIEditor.gridlist[3] = guiCreateGridList(697, 33, 266, 354, false, GUIEditor.window[1]) 
   weapons = guiGridListAddCoulmn(GUIEditor.gridlist[3],  "Weapons", 0.60) 
   GUIEditor.label[1] = guiCreateLabel(243, 443, 71, 18, "Amount:", false, GUIEditor.window[1]) 
   GUIEditor.edit[1] = guiCreateEdit(324, 443, 143, 24, "", false, GUIEditor.window[1]) 
   GUIEditor.button[1]= guiCreateButton(524, 434, 106, 43, "Craft", false, GUIEditor.window[1]) 
   GUIEditor.scrollbar[1] = guiCreateScrollBar(173, 4, 15, 187, false, GUIEditor.gridlist[3]) 
   guiWindowSetMovable(GUIEditor.window[1], false) 
   guiWindowSetSizable(GUIEditor.window[1], false) 
   guiSetVisible(GUIEditor.window[1], false) 
   for _, v in ipairs(Crafts) do 
       local row = guiGridListAddRow(GUIEditor.girdlist[2]) 
       guiGridListSetItemText(GUIEditor.gridlist[2], row, 1, v[1], false, false) 
       guiGridListSetItemData(GUIEditor.gridlist[2], row, 1, v[2]) 
   end 
   for _, v in ipairs(Weapons) do 
       local row = guiGridListAddRow(GUIEditor.gridlist[3]) 
       guiGridListSetItemText(GUIEditor.gridlist[3], row, 1, v[1], false, false) 
       guiGridListSetItemData(GUIEditor.gridlist[3], row, 1, v[2]) 
   end 
end 
  
addEventHandler("onClientGUIChanged", GUIEditor.edit[1], 
function() 
   if guiGetText(source) ~= string.gsub(" ", "1234567890") then 
       outputChatBox("Only numbers is accepted!", 255, 0, 0) 
   end 
end) 
  
function showCraftWindow() 
    guiSetVisible(not guiGetVisible(GUIEditor.window[1])) 
    showCursor(not isCursorShowing) 
    guiSetInputEnabled(not guiGetInputEnabled()) 
end 
bindKey("F9", "down", showCraftWindow) 
  
addEventHandler("onClientGUIClick", root, 
function(button, state) 
    if source == GUIEditor.button[1] then 
        if guiGridListGetSelectedItem(GUIEditor.gridlist[2]) == - 1 then outputChatBox("Select a craft object!", 255, 0, 0) return end 
        local craftID = guiGridListGetItemData(GUIEditor.gridlist[2], guiGridListGetSelectedItem(GUIEditor.gridlist[2]), 1) 
        local amount = guiGetText(GUIEditor.edit[1]) 
        if craftID == 1  and amount ~= "" then 
           setElementData(localPlayer, "iron", tonumber(amount)) 
           local row =guiGridListAddRow(GUIEditor.gridlist[1]) 
           guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, craftID, false, false) 
           guiGridListSetItemData(GUIEditor.gridlist[1], row, 1, craftID) 
        elseif craftID == 2 and amount ~= "" then 
            setElementData(localPlayer, "oil", tonumber(amount)) 
            local row = guiGridListAddRow(GUIEditor.gridlist[1]) 
            guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, craftID, false, false) 
            guiGridListSetItemData(GUIEditor.gridlist[1], row, 1, craftID) 
        elseif craftID == 3 and amount ~= "" then 
            setElementData(localPlayer, "explosifs", tonumber(amount)) 
            local row = guiGridListAddRow(GUIEditor.girdlist[1]) 
            guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, craftID, false, false) 
            guiGridListSetItemData(GUIEditor.gridlist[1], row, 1, craftID) 
        end 
    elseif source == guiGridListGetSelectedItem(GUIEditor.gridlist[3]) >= 1 then 
        for _, v in ipairs(getPedWeapon(localPlayer)) do 
            local row = guiGridListAddRow(GUIEditor.gridlist[1]) 
            guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, v, false, false) 
            guiGridListSetItemData(GUIEditor.gridlist[1], row, 1, v) 
        end 
        if guiGridListGetSelectedItem(GUIEditor.gridlist[3]) == -1 then outputChatBox("You need select a weapon!", 255, 0, 0) return end 
        local weaponID = guiGridListGetItemData(GUIEditor.gridlist[3], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), 1) 
        local iron = getElementData(localPlayer, "iron") 
        local oil = getElementData(localPlayer, "oil") 
        local explosifs = getElementData(localPlayer, "explosifs") 
        if iron >= 10 and oil >= 15 then 
           if weaponID == 1 or weaponID == 2 or weaponID == 3 or weaponID == 4 or weaponID == 5 or weaponID == 6 or weaponID == 7 or weaponID == 8 or weaponID == 9 or weaponID == 10 or weaponID == 11 or weaponID == 12 or weaponID == 14 or weaponID == 15 or weaponID == 40 or weaponID == 44 or weaponID == 45 or weaponID == 46 then 
               givePedWeapon(localPlayer, weaponID, 1, true) 
               iron = iron - 10 
               oil = oil - 15 
            elseif weaponID == 22 or weaponID == 23 or weaponID == 24 then 
                givePedWeapon(localPlayer, weaponID, 400, true) 
                iron = iron - 10 
                oil = oil - 15 
            elseif weaponID == 25 or weaponID == 26  or weaponID == 27 then 
               givePedWeapon(localPlayer, weaponID, 350, true) 
               iron = iron - 10 
               oil= oil - 15 
            elseif weaponID == 28 or weaponID == 29 or weaponID == 32 then 
                givePedWeapon(localPlayer, weaponID, 300, true) 
                iron = iron - 10 
                oil = oil - 15 
            elseif weaponID == 30 or weaponID == 31 then 
               givePedWeapon(localPlayer, weaponID, 200, true) 
               iron = iron - 10 
               oil = oil - 15 
            elseif weaponID == 33 or weaponID == 34 then 
                givePedWeapon(localPlayer, weaponID, 150, true) 
                iron = iron - 10 
                oil = oil - 15 
            elseif weaponID == 38 or weaponID == 41 or weaponID == 42 or weaponID == 37 then 
                givePedWeapon(localPlayer, weaponID, 250, true) 
                iron = iron - 10 
                oil = oil - 15 
            elseif weaponID == 43 then 
                givePedWeapon(localPlayer, weaponID, 100, true) 
                iron = iron - 10 
                oil = oil - 15 
           end 
        elseif iron >= 10 and oil >= 15 and explosifs >= 20 then 
            if weaponID == 16 or weaponID == 17 or weaponID == 18 or weaponID == 39 or weaponID == 35 or weaponID == 36 then 
               givePedWeapon(localPlayer, weaponID, 50, true) 
               iron = iron - 10 
               oil = oil - 15 
               explosifs = explosifs - 20 
            end 
        end 
    end 
end) 

Warning:crafpanel/c_pane.lua88l:Bad argument @ 'addEventHandler(Expected element at argument 2, got nil]

Edited by Guest
Link to comment
local GUIEditor= { 
   window = { }, 
   edit = { }, 
   label = { }, 
   button = { }, 
   scrollbar = { }, 
   gridlist = { }  
} 
  
local Crafts = { 
   {"Iron", 1}, 
   {"Oil", 2}, 
   {"Explosifs", 3} 
} 
  
local Weapons = { 
   {"Brass Knuckles", 1}, 
   {"Golf Club", 2}, 
   {"Nightstick", 3}, 
   {"Knife", 4}, 
   {"Baseball Bat", 5}, 
   {"Cane", 15}, 
   {"Shovel", 6}, 
   {"Pool Cue", 7}, 
   {"Katana", 8}, 
   {"Chainsaw", 9}, 
   {"Colt 45", 22}, 
   {"Silenced", 23}, 
   {"Desert Eagle", 24}, 
   {"Shotgun", 25}, 
   {"Spawn-off", 26}, 
   {"Spaz-12", 27}, 
   {"UZI", 28}, 
   {"MP5", 29}, 
   {"TEC-9", 32}, 
   {"AK47", 30}, 
   {"M4", 31}, 
   {"Country sniper", 33}, 
   {"Sniper", 34}, 
   {"Rocket Lanuncher", 35}, 
   {"Heat-Seeking RPG", 36}, 
   {"Flamethrower", 37}, 
   {"Minigun", 38}, 
   {"Grenade", 16}, 
   {"Tear gas", 17}, 
   {"Molotov", 18}, 
   {"Satchel", 39}, 
   {"Satchel detonator", 40}, 
   {"Spraycan", 41}, 
   {"Fire Extinguisher", 42}, 
   {"Camera", 43}, 
   {"Night vision goggles", 44}, 
   {"Infrared oggles", 45}, 
   {"Parachute", 46}, 
   {"Long Dildo", 10}, 
   {"Short Dildo", 11}, 
   {"Vibrator", 12}, 
   {"Flowers", 14},  
} 
  
function createCraftWindow() 
   GUIEditor.window [1]= guiCreateWindow(251, 224, 1230, 357, "Craft Window", false) 
   GUIEditor.gridlist[1] = guiCreateGridList(10, 33, 266, 354, false, GUIEditor.window[1]) 
   inctenrotry = guiGridListAddCoulmn(GUIEditor.girdlist[1], "Inventory", 0.60) 
   GUIEditor.gridlist[2] = guiCreateGridList(350, 33, 266, 354, false, GUIEditor.window[1]) 
   crafts= guiGridListAddCoulmn(GUIEditor.gridlist[2], "Craftable objects", 0.60) 
   GUIEditor.gridlist[3] = guiCreateGridList(697, 33, 266, 354, false, GUIEditor.window[1]) 
   weapons = guiGridListAddCoulmn(GUIEditor.gridlist[3],  "Weapons", 0.60) 
   GUIEditor.label[1] = guiCreateLabel(243, 443, 71, 18, "Amount:", false, GUIEditor.window[1]) 
   GUIEditor.edit[1] = guiCreateEdit(324, 443, 143, 24, "", false, GUIEditor.window[1]) 
   GUIEditor.button[1]= guiCreateButton(524, 434, 106, 43, "Craft", false, GUIEditor.window[1]) 
   GUIEditor.scrollbar[1] = guiCreateScrollBar(173, 4, 15, 187, false, GUIEditor.gridlist[3]) 
   guiWindowSetMovable(GUIEditor.window[1], false) 
   guiWindowSetSizable(GUIEditor.window[1], false) 
   guiSetVisible(GUIEditor.window[1], false) 
   for _, v in ipairs(Crafts) do 
       local row = guiGridListAddRow(GUIEditor.girdlist[2]) 
       guiGridListSetItemText(GUIEditor.gridlist[2], row, 1, v[1], false, false) 
       guiGridListSetItemData(GUIEditor.gridlist[2], row, 1, v[2]) 
   end 
   for _, v in ipairs(Weapons) do 
       local row = guiGridListAddRow(GUIEditor.gridlist[3]) 
       guiGridListSetItemText(GUIEditor.gridlist[3], row, 1, v[1], false, false) 
       guiGridListSetItemData(GUIEditor.gridlist[3], row, 1, v[2]) 
   end 
end 
  
addEventHandler("onClientGUIChanged", GUIEditor.edit[1],  
function() 
   if guiGetText(source) ~= string.gsub(" ", "1234567890") then 
       outputChatBox("Only numbers is accepted!", 255, 0, 0) 
   end 
end) 
  
function showCraftWindow() 
    guiSetVisible(not guiGetVisible(GUIEditor.window[1])) 
    showCursor(not isCursorShowing) 
    guiSetInputEnabled(not guiGetInputEnabled()) 
end 
bindKey("F9", "down", showCraftWindow) 
  
addEventHandler("onClientGUIClick", root, 
function(button, state) 
    if source == GUIEditor.button[1] then 
        if guiGridListGetSelectedItem(GUIEditor.gridlist[2]) == - 1 then outputChatBox("Select a craft object!", 255, 0, 0) return end 
        local craftID = guiGridListGetItemData(GUIEditor.gridlist[2], guiGridListGetSelectedItem(GUIEditor.gridlist[2]), 1) 
        local amount = guiGetText(GUIEditor.edit[1]) 
        if craftID == 1  and amount ~= "" then 
           setElementData(localPlayer, "iron", tonumber(amount)) 
           local row =guiGridListAddRow(GUIEditor.gridlist[1]) 
           guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, craftID, false, false) 
           guiGridListSetItemData(GUIEditor.gridlist[1], row, 1, craftID) 
        elseif craftID == 2 and amount ~= "" then 
            setElementData(localPlayer, "oil", tonumber(amount)) 
            local row = guiGridListAddRow(GUIEditor.gridlist[1]) 
            guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, craftID, false, false) 
            guiGridListSetItemData(GUIEditor.gridlist[1], row, 1, craftID) 
        elseif craftID == 3 and amount ~= "" then 
            setElementData(localPlayer, "explosifs", tonumber(amount)) 
            local row = guiGridListAddRow(GUIEditor.girdlist[1]) 
            guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, craftID, false, false) 
            guiGridListSetItemData(GUIEditor.gridlist[1], row, 1, craftID) 
        end 
    elseif source == guiGridListGetSelectedItem(GUIEditor.gridlist[3]) >= 1 then  
        for _, v in ipairs(getPedWeapon(localPlayer)) do 
            local row = guiGridListAddRow(GUIEditor.gridlist[1]) 
            guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, v, false, false) 
            guiGridListSetItemData(GUIEditor.gridlist[1], row, 1, v) 
        end 
        if guiGridListGetSelectedItem(GUIEditor.gridlist[3]) == -1 then outputChatBox("You need select a weapon!", 255, 0, 0) return end 
        local weaponID = guiGridListGetItemData(GUIEditor.gridlist[3], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), 1) 
        local iron = getElementData(localPlayer, "iron") 
        local oil = getElementData(localPlayer, "oil") 
        local explosifs = getElementData(localPlayer, "explosifs") 
        if iron >= 10 and oil >= 15 then 
           if weaponID == 1 or weaponID == 2 or weaponID == 3 or weaponID == 4 or weaponID == 5 or weaponID == 6 or weaponID == 7 or weaponID == 8 or weaponID == 9 or weaponID == 10 or weaponID == 11 or weaponID == 12 or weaponID == 14 or weaponID == 15 or weaponID == 40 or weaponID == 44 or weaponID == 45 or weaponID == 46 then 
               givePedWeapon(localPlayer, weaponID, 1, true) 
               iron = iron - 10 
               oil = oil - 15 
            elseif weaponID == 22 or weaponID == 23 or weaponID == 24 then 
                givePedWeapon(localPlayer, weaponID, 400, true) 
                iron = iron - 10 
                oil = oil - 15 
            elseif weaponID == 25 or weaponID == 26  or weaponID == 27 then 
               givePedWeapon(localPlayer, weaponID, 350, true) 
               iron = iron - 10 
               oil= oil - 15 
            elseif weaponID == 28 or weaponID == 29 or weaponID == 32 then 
                givePedWeapon(localPlayer, weaponID, 300, true) 
                iron = iron - 10 
                oil = oil - 15 
            elseif weaponID == 30 or weaponID == 31 then 
               givePedWeapon(localPlayer, weaponID, 200, true) 
               iron = iron - 10 
               oil = oil - 15 
            elseif weaponID == 33 or weaponID == 34 then 
                givePedWeapon(localPlayer, weaponID, 150, true) 
                iron = iron - 10 
                oil = oil - 15 
            elseif weaponID == 38 or weaponID == 41 or weaponID == 42 or weaponID == 37 then 
                givePedWeapon(localPlayer, weaponID, 250, true) 
                iron = iron - 10 
                oil = oil - 15 
            elseif weaponID == 43 then 
                givePedWeapon(localPlayer, weaponID, 100, true) 
                iron = iron - 10 
                oil = oil - 15 
           end 
        elseif iron >= 10 and oil >= 15 and explosifs >= 20 then 
            if weaponID == 16 or weaponID == 17 or weaponID == 18 or weaponID == 39 or weaponID == 35 or weaponID == 36 then 
               givePedWeapon(localPlayer, weaponID, 50, true) 
               iron = iron - 10  
               oil = oil - 15 
               explosifs = explosifs - 20 
            end 
        end 
    end 
end) 

Warning:crafpanel/c_pane.lua88l:Bad argument @ 'addEventHandler(Expected element at argument 2, got nil]

because GUIEditor.edit[1] is no set.add addEventHandler("onClientResourceStart", resourceRoot, createCraftWindow) under function createCraftWindow

Link to comment
local GUIEditor= { 
   window = { }, 
   edit = { }, 
   label = { }, 
   button = { }, 
   scrollbar = { }, 
   gridlist = { }  
} 
  
local Crafts = { 
   {"Iron", 1}, 
   {"Oil", 2}, 
   {"Explosifs", 3} 
} 
  
local Weapons = { 
   {"Brass Knuckles", 1}, 
   {"Golf Club", 2}, 
   {"Nightstick", 3}, 
   {"Knife", 4}, 
   {"Baseball Bat", 5}, 
   {"Cane", 15}, 
   {"Shovel", 6}, 
   {"Pool Cue", 7}, 
   {"Katana", 8}, 
   {"Chainsaw", 9}, 
   {"Colt 45", 22}, 
   {"Silenced", 23}, 
   {"Desert Eagle", 24}, 
   {"Shotgun", 25}, 
   {"Spawn-off", 26}, 
   {"Spaz-12", 27}, 
   {"UZI", 28}, 
   {"MP5", 29}, 
   {"TEC-9", 32}, 
   {"AK47", 30}, 
   {"M4", 31}, 
   {"Country sniper", 33}, 
   {"Sniper", 34}, 
   {"Rocket Lanuncher", 35}, 
   {"Heat-Seeking RPG", 36}, 
   {"Flamethrower", 37}, 
   {"Minigun", 38}, 
   {"Grenade", 16}, 
   {"Tear gas", 17}, 
   {"Molotov", 18}, 
   {"Satchel", 39}, 
   {"Satchel detonator", 40}, 
   {"Spraycan", 41}, 
   {"Fire Extinguisher", 42}, 
   {"Camera", 43}, 
   {"Night vision goggles", 44}, 
   {"Infrared oggles", 45}, 
   {"Parachute", 46}, 
   {"Long Dildo", 10}, 
   {"Short Dildo", 11}, 
   {"Vibrator", 12}, 
   {"Flowers", 14},  
} 
  
function createCraftWindow() 
   GUIEditor.window [1]= guiCreateWindow(251, 224, 1230, 557, "Craft Window", false) 
   GUIEditor.gridlist[1] = guiCreateGridList(10, 33, 266, 354, false, GUIEditor.window[1]) 
   inctenrotry = guiGridListAddColumn(GUIEditor.gridlist[1], "Inventory", 0.60) 
   GUIEditor.gridlist[2] = guiCreateGridList(350, 33, 266, 354, false, GUIEditor.window[1]) 
   crafts= guiGridListAddColumn(GUIEditor.gridlist[2], "Craftable objects", 0.60) 
   GUIEditor.gridlist[3] = guiCreateGridList(697, 33, 266, 354, false, GUIEditor.window[1]) 
   weapons = guiGridListAddColumn(GUIEditor.gridlist[3],  "Weapons", 0.60) 
   GUIEditor.label[1] = guiCreateLabel(243, 443, 71, 18, "Amount:", false, GUIEditor.window[1]) 
   GUIEditor.edit[1] = guiCreateEdit(324, 443, 143, 24, "", false, GUIEditor.window[1]) 
   GUIEditor.button[1]= guiCreateButton(524, 434, 106, 43, "Craft", false, GUIEditor.window[1]) 
   GUIEditor.scrollbar[1] = guiCreateScrollBar(530, 4, 15, 187, false, false, GUIEditor.window[1]) 
   guiWindowSetMovable(GUIEditor.window[1], false) 
   guiWindowSetSizable(GUIEditor.window[1], false) 
   guiSetVisible(GUIEditor.window[1], false) 
   for _, v in ipairs(Crafts) do 
       local row = guiGridListAddRow(GUIEditor.gridlist[2]) 
       guiGridListSetItemText(GUIEditor.gridlist[2], row, 1, v[1], false, false) 
       guiGridListSetItemData(GUIEditor.gridlist[2], row, 1, v[2]) 
   end 
   for _, v in ipairs(Weapons) do 
       local row = guiGridListAddRow(GUIEditor.gridlist[3]) 
       guiGridListSetItemText(GUIEditor.gridlist[3], row, 1, v[1], false, false) 
       guiGridListSetItemData(GUIEditor.gridlist[3], row, 1, v[2]) 
   end 
end 
  
addEventHandler("onClientGUIChanged", root,  
function() 
   if guiGetText(GUIEditor.edit[1]) ~= string.gsub(" ", "1234567890") then 
       outputChatBox("Only numbers is accepted!", 255, 0, 0) 
   end 
end) 
  
function showCraftWindow() 
    createCraftWindow() 
    guiSetVisible(GUIEditor.window[1], not guiGetVisible(GUIEditor.window[1])) 
    showCursor(not isCursorShowing) 
    guiSetInputEnabled(not guiGetInputEnabled()) 
end 
bindKey("F9", "down", showCraftWindow) 
  
addEventHandler("onClientGUIClick", root, 
function(button, state) 
    if source == GUIEditor.button[1] then 
        if guiGridListGetSelectedItem(GUIEditor.gridlist[2]) == - 1 then outputChatBox("Select a craft object!", 255, 0, 0) return end 
        local craftID = guiGridListGetItemData(GUIEditor.gridlist[2], guiGridListGetSelectedItem(GUIEditor.gridlist[2]), 1) 
        local amount = guiGetText(GUIEditor.edit[1]) 
        if craftID == 1  and amount ~= "" then 
           setElementData(localPlayer, "iron", tonumber(amount)) 
           local row =guiGridListAddRow(GUIEditor.gridlist[1]) 
           guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, "iron",false, false) 
           guiGridListSetItemData(GUIEditor.gridlist[1], row, 1, iron) 
        elseif craftID == 2 and amount ~= "" then 
            setElementData(localPlayer, "oil", tonumber(amount)) 
            local row = guiGridListAddRow(GUIEditor.gridlist[1]) 
            guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, "oil", false, false) 
            guiGridListSetItemData(GUIEditor.gridlist[1], row, 1, oil) 
        elseif craftID == 3 and amount ~= "" then 
            setElementData(localPlayer, "explosifs", tonumber(amount)) 
            local row = guiGridListAddRow(GUIEditor.girdlist[1]) 
            guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, "explosifs", false, false) 
            guiGridListSetItemData(GUIEditor.gridlist[1], row, 1, explosifs) 
        end 
    elseif source == guiGridListGetSelectedItem(GUIEditor.gridlist[3]) then  
        for _, v in ipairs(getPedWeapon(localPlayer)) do 
            local row = guiGridListAddRow(GUIEditor.gridlist[1]) 
            guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, v, false, false) 
            guiGridListSetItemData(GUIEditor.gridlist[1], row, 1, v) 
        end 
        if guiGridListGetSelectedItem(GUIEditor.gridlist[3]) == -1 then outputChatBox("You need select a weapon!", 255, 0, 0) return end 
        local weaponID = guiGridListGetItemData(GUIEditor.gridlist[3], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), 1) 
        local iron = getElementData(localPlayer, "iron") 
        local oil = getElementData(localPlayer, "oil") 
        local explosifs = getElementData(localPlayer, "explosifs") 
        if iron >= 10 and oil >= 15 then 
           if weaponID == 1 or weaponID == 2 or weaponID == 3 or weaponID == 4 or weaponID == 5 or weaponID == 6 or weaponID == 7 or weaponID == 8 or weaponID == 9 or weaponID == 10 or weaponID == 11 or weaponID == 12 or weaponID == 14 or weaponID == 15 or weaponID == 40 or weaponID == 44 or weaponID == 45 or weaponID == 46 then 
               givePedWeapon(localPlayer, weaponID, 1, true) 
               iron = iron - 10 
               oil = oil - 15 
            elseif weaponID == 22 or weaponID == 23 or weaponID == 24 then 
                givePedWeapon(localPlayer, weaponID, 400, true) 
                iron = iron - 10 
                oil = oil - 15 
            elseif weaponID == 25 or weaponID == 26  or weaponID == 27 then 
               givePedWeapon(localPlayer, weaponID, 350, true) 
               iron = iron - 10 
               oil= oil - 15 
            elseif weaponID == 28 or weaponID == 29 or weaponID == 32 then 
                givePedWeapon(localPlayer, weaponID, 300, true) 
                iron = iron - 10 
                oil = oil - 15 
            elseif weaponID == 30 or weaponID == 31 then 
               givePedWeapon(localPlayer, weaponID, 200, true) 
               iron = iron - 10 
               oil = oil - 15 
            elseif weaponID == 33 or weaponID == 34 then 
                givePedWeapon(localPlayer, weaponID, 150, true) 
                iron = iron - 10 
                oil = oil - 15 
            elseif weaponID == 38 or weaponID == 41 or weaponID == 42 or  weaponID == 37 then 
                givePedWeapon(localPlayer, weaponID, 250, true) 
                iron = iron - 10 
                oil = oil - 15 
            elseif weaponID == 43 then 
                givePedWeapon(localPlayer, weaponID, 100, true) 
                iron = iron - 10 
                oil = oil - 15 
           end 
        elseif iron >= 10 and oil >= 15 and explosifs >= 20 then 
            if weaponID == 16 or weaponID == 17 or weaponID == 18 or weaponID == 39 or weaponID == 35 or weaponID == 36 then 
               givePedWeapon(localPlayer, weaponID, 50, true) 
               iron = iron - 10  
               oil = oil - 15 
               explosifs = explosifs - 20 
            end 
        end 
    end 
end) 

Error:craftpanel/c_panel:90:bad argument #3 to 'gsub'(string,fucntion,table exptected)

Link to comment
  
local GUIEditor= { 
   window = { }, 
   edit = { }, 
   label = { }, 
   button = { }, 
   scrollbar = { }, 
   gridlist = { } 
} 
  
local Crafts = { 
   {"Iron", 1}, 
   {"Oil", 2}, 
   {"Explosifs", 3} 
} 
  
local Weapons = { 
   {"Brass Knuckles", 1}, 
   {"Golf Club", 2}, 
   {"Nightstick", 3}, 
   {"Knife", 4}, 
   {"Baseball Bat", 5}, 
   {"Cane", 15}, 
   {"Shovel", 6}, 
   {"Pool Cue", 7}, 
   {"Katana", 8}, 
   {"Chainsaw", 9}, 
   {"Colt 45", 22}, 
   {"Silenced", 23}, 
   {"Desert Eagle", 24}, 
   {"Shotgun", 25}, 
   {"Spawn-off", 26}, 
   {"Spaz-12", 27}, 
   {"UZI", 28}, 
   {"MP5", 29}, 
   {"TEC-9", 32}, 
   {"AK47", 30}, 
   {"M4", 31}, 
   {"Country sniper", 33}, 
   {"Sniper", 34}, 
   {"Rocket Lanuncher", 35}, 
   {"Heat-Seeking RPG", 36}, 
   {"Flamethrower", 37}, 
   {"Minigun", 38}, 
   {"Grenade", 16}, 
   {"Tear gas", 17}, 
   {"Molotov", 18}, 
   {"Satchel", 39}, 
   {"Satchel detonator", 40}, 
   {"Spraycan", 41}, 
   {"Fire Extinguisher", 42}, 
   {"Camera", 43}, 
   {"Night vision goggles", 44}, 
   {"Infrared oggles", 45}, 
   {"Parachute", 46}, 
   {"Long Dildo", 10}, 
   {"Short Dildo", 11}, 
   {"Vibrator", 12}, 
   {"Flowers", 14}, 
} 
  
function createCraftWindow() 
   GUIEditor.window [1]= guiCreateWindow(251, 224, 1230, 557, "Craft Window", false) 
   GUIEditor.gridlist[1] = guiCreateGridList(10, 33, 266, 354, false, GUIEditor.window[1]) 
   inctenrotry = guiGridListAddColumn(GUIEditor.gridlist[1], "Inventory", 0.60) 
   GUIEditor.gridlist[2] = guiCreateGridList(350, 33, 266, 354, false, GUIEditor.window[1]) 
   crafts= guiGridListAddColumn(GUIEditor.gridlist[2], "Craftable objects", 0.60) 
   GUIEditor.gridlist[3] = guiCreateGridList(697, 33, 266, 354, false, GUIEditor.window[1]) 
   weapons = guiGridListAddColumn(GUIEditor.gridlist[3],  "Weapons", 0.60) 
   GUIEditor.label[1] = guiCreateLabel(243, 443, 71, 18, "Amount:", false, GUIEditor.window[1]) 
   GUIEditor.edit[1] = guiCreateEdit(324, 443, 143, 24, "", false, GUIEditor.window[1]) 
   GUIEditor.button[1]= guiCreateButton(524, 434, 106, 43, "Craft", false, GUIEditor.window[1]) 
   GUIEditor.scrollbar[1] = guiCreateScrollBar(530, 4, 15, 187, false, false, GUIEditor.window[1]) 
   guiWindowSetMovable(GUIEditor.window[1], false) 
   guiWindowSetSizable(GUIEditor.window[1], false) 
   guiSetVisible(GUIEditor.window[1], false) 
   for _, v in ipairs(Crafts) do 
       local row = guiGridListAddRow(GUIEditor.gridlist[2]) 
       guiGridListSetItemText(GUIEditor.gridlist[2], row, 1, v[1], false, false) 
       guiGridListSetItemData(GUIEditor.gridlist[2], row, 1, v[2]) 
   end 
   for _, v in ipairs(Weapons) do 
       local row = guiGridListAddRow(GUIEditor.gridlist[3]) 
       guiGridListSetItemText(GUIEditor.gridlist[3], row, 1, v[1], false, false) 
       guiGridListSetItemData(GUIEditor.gridlist[3], row, 1, v[2]) 
   end 
end 
  
addEventHandler("onClientGUIChanged", root, 
function() 
guiSetText(GUIEditor.edit[1], string.gsub(guiGetText(GUIEditor.edit[1]), "%d", "") 
end) 
  
function showCraftWindow() 
    createCraftWindow() 
    guiSetVisible(GUIEditor.window[1], not guiGetVisible(GUIEditor.window[1])) 
    showCursor(not isCursorShowing) 
    guiSetInputEnabled(not guiGetInputEnabled()) 
end 
bindKey("F9", "down", showCraftWindow) 
  
addEventHandler("onClientGUIClick", root, 
function(button, state) 
    if source == GUIEditor.button[1] then 
        if guiGridListGetSelectedItem(GUIEditor.gridlist[2]) == - 1 then outputChatBox("Select a craft object!", 255, 0, 0) return end 
        local craftID = guiGridListGetItemData(GUIEditor.gridlist[2], guiGridListGetSelectedItem(GUIEditor.gridlist[2]), 1) 
        local amount = guiGetText(GUIEditor.edit[1]) 
        if craftID == 1  and amount ~= "" then 
           setElementData(localPlayer, "iron", tonumber(amount)) 
           local row =guiGridListAddRow(GUIEditor.gridlist[1]) 
           guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, "iron",false, false) 
           guiGridListSetItemData(GUIEditor.gridlist[1], row, 1, iron) 
        elseif craftID == 2 and amount ~= "" then 
            setElementData(localPlayer, "oil", tonumber(amount)) 
            local row = guiGridListAddRow(GUIEditor.gridlist[1]) 
            guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, "oil", false, false) 
            guiGridListSetItemData(GUIEditor.gridlist[1], row, 1, oil) 
        elseif craftID == 3 and amount ~= "" then 
            setElementData(localPlayer, "explosifs", tonumber(amount)) 
            local row = guiGridListAddRow(GUIEditor.girdlist[1]) 
            guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, explosifs, false, false) 
            guiGridListSetItemData(GUIEditor.gridlist[1], row, 1, explosifs) 
        end 
    elseif source == guiGridListGetSelectedItem(GUIEditor.gridlist[3]) then 
        for _, v in ipairs(getPedWeapon(localPlayer)) do 
            local row = guiGridListAddRow(GUIEditor.gridlist[1]) 
            guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, v, false, false) 
            guiGridListSetItemData(GUIEditor.gridlist[1], row, 1, v) 
        end 
        if guiGridListGetSelectedItem(GUIEditor.gridlist[3]) == -1 then outputChatBox("You need select a weapon!", 255, 0, 0) return end 
        local weaponID = guiGridListGetItemData(GUIEditor.gridlist[3], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), 1) 
        local iron = getElementData(localPlayer, "iron") 
        local oil = getElementData(localPlayer, "oil") 
        local explosifs = getElementData(localPlayer, "explosifs") 
        if iron >= 10 and oil >= 15 then 
           if weaponID == 1 or weaponID == 2 or weaponID == 3 or weaponID == 4 or weaponID == 5 or weaponID == 6 or weaponID == 7 or weaponID == 8 or weaponID == 9 or weaponID == 10 or weaponID == 11 or weaponID == 12 or weaponID == 14 or weaponID == 15 or weaponID == 40 or weaponID == 44 or weaponID == 45 or weaponID == 46 then 
               givePedWeapon(localPlayer, weaponID, 1, true) 
               iron = iron - 10 
               oil = oil - 15 
            elseif weaponID == 22 or weaponID == 23 or weaponID == 24 then 
                givePedWeapon(localPlayer, weaponID, 400, true) 
                iron = iron - 10 
                oil = oil - 15 
            elseif weaponID == 25 or weaponID == 26  or weaponID == 27 then 
               givePedWeapon(localPlayer, weaponID, 350, true) 
               iron = iron - 10 
               oil= oil - 15 
            elseif weaponID == 28 or weaponID == 29 or weaponID == 32 then 
                givePedWeapon(localPlayer, weaponID, 300, true) 
                iron = iron - 10 
                oil = oil - 15 
            elseif weaponID == 30 or weaponID == 31 then 
               givePedWeapon(localPlayer, weaponID, 200, true) 
               iron = iron - 10 
               oil = oil - 15 
            elseif weaponID == 33 or weaponID == 34 then 
                givePedWeapon(localPlayer, weaponID, 150, true) 
                iron = iron - 10 
                oil = oil - 15 
            elseif weaponID == 38 or weaponID == 41 or weaponID == 42 or  weaponID == 37 then 
                givePedWeapon(localPlayer, weaponID, 250, true) 
                iron = iron - 10 
                oil = oil - 15 
            elseif weaponID == 43 then 
                givePedWeapon(localPlayer, weaponID, 100, true) 
                iron = iron - 10 
                oil = oil - 15 
           end 
        elseif iron >= 10 and oil >= 15 and explosifs >= 20 then 
            if weaponID == 16 or weaponID == 17 or weaponID == 18 or weaponID == 39 or weaponID == 35 or weaponID == 36 then 
               givePedWeapon(localPlayer, weaponID, 50, true) 
               iron = iron - 10 
               oil = oil - 15 
               explosifs = explosifs - 20 
            end 
        end 
    end 
end) 
  

Link to comment
local GUIEditor= { 
   window = { }, 
   edit = { }, 
   label = { }, 
   button = { }, 
   scrollbar = { }, 
   gridlist = { }  
} 
  
local Crafts = { 
   {"Iron", 1}, 
   {"Oil", 2}, 
   {"Explosifs", 3} 
} 
  
local Weapons = { 
   {"Brass Knuckles", 1}, 
   {"Golf Club", 2}, 
   {"Nightstick", 3}, 
   {"Knife", 4}, 
   {"Baseball Bat", 5}, 
   {"Cane", 15}, 
   {"Shovel", 6}, 
   {"Pool Cue", 7}, 
   {"Katana", 8}, 
   {"Chainsaw", 9}, 
   {"Colt 45", 22}, 
   {"Silenced", 23}, 
   {"Desert Eagle", 24}, 
   {"Shotgun", 25}, 
   {"Spawn-off", 26}, 
   {"Spaz-12", 27}, 
   {"UZI", 28}, 
   {"MP5", 29}, 
   {"TEC-9", 32}, 
   {"AK47", 30}, 
   {"M4", 31}, 
   {"Country sniper", 33}, 
   {"Sniper", 34}, 
   {"Rocket Lanuncher", 35}, 
   {"Heat-Seeking RPG", 36}, 
   {"Flamethrower", 37}, 
   {"Minigun", 38}, 
   {"Grenade", 16}, 
   {"Tear gas", 17}, 
   {"Molotov", 18}, 
   {"Satchel", 39}, 
   {"Satchel detonator", 40}, 
   {"Spraycan", 41}, 
   {"Fire Extinguisher", 42}, 
   {"Camera", 43}, 
   {"Night vision goggles", 44}, 
   {"Infrared oggles", 45}, 
   {"Parachute", 46}, 
   {"Long Dildo", 10}, 
   {"Short Dildo", 11}, 
   {"Vibrator", 12}, 
   {"Flowers", 14},  
} 
  
function createCraftWindow() 
   GUIEditor.window [1]= guiCreateWindow(251, 224, 1230, 557, "Craft Window", false) 
   GUIEditor.gridlist[1] = guiCreateGridList(10, 33, 266, 354, false, GUIEditor.window[1]) 
   inctenrotry = guiGridListAddColumn(GUIEditor.gridlist[1], "Inventory", 0.60) 
   GUIEditor.gridlist[2] = guiCreateGridList(350, 33, 266, 354, false, GUIEditor.window[1]) 
   crafts= guiGridListAddColumn(GUIEditor.gridlist[2], "Craftable objects", 0.60) 
   GUIEditor.gridlist[3] = guiCreateGridList(697, 33, 266, 354, false, GUIEditor.window[1]) 
   weapons = guiGridListAddColumn(GUIEditor.gridlist[3],  "Weapons", 0.60) 
   GUIEditor.label[1] = guiCreateLabel(243, 443, 71, 18, "Amount:", false, GUIEditor.window[1]) 
   GUIEditor.edit[1] = guiCreateEdit(324, 443, 143, 24, "", false, GUIEditor.window[1]) 
   GUIEditor.button[1]= guiCreateButton(524, 434, 106, 43, "Craft", false, GUIEditor.window[1]) 
   GUIEditor.scrollbar[1] = guiCreateScrollBar(530, 4, 15, 187, false, false, GUIEditor.window[1]) 
   guiWindowSetMovable(GUIEditor.window[1], false) 
   guiWindowSetSizable(GUIEditor.window[1], false) 
   guiSetVisible(GUIEditor.window[1], false) 
   for _, v in ipairs(Crafts) do 
       local row = guiGridListAddRow(GUIEditor.gridlist[2]) 
       guiGridListSetItemText(GUIEditor.gridlist[2], row, 1, v[1], false, false) 
       guiGridListSetItemData(GUIEditor.gridlist[2], row, 1, v[2]) 
   end 
   for _, v in ipairs(Weapons) do 
       local row = guiGridListAddRow(GUIEditor.gridlist[3]) 
       guiGridListSetItemText(GUIEditor.gridlist[3], row, 1, v[1], false, false) 
       guiGridListSetItemData(GUIEditor.gridlist[3], row, 1, v[2]) 
   end 
end 
  
addEventHandler("onClientGUIChanged", root,  
function() 
  guiSetText(GUIEditor.edit[1], string.gsub(guiGetText(GUIEditor.edit[1]), "%d", "")) 
end) 
  
function showCraftWindow() 
    createCraftWindow() 
    guiSetVisible(GUIEditor.window[1], not guiGetVisible(GUIEditor.window[1])) 
    showCursor(not isCursorShowing) 
    guiSetInputEnabled(not guiGetInputEnabled()) 
end 
bindKey("F9", "down", showCraftWindow) 
  
addEventHandler("onClientGUIClick", root, 
function(button, state) 
    if source == GUIEditor.button[1] then 
        if guiGridListGetSelectedItem(GUIEditor.gridlist[2]) == - 1 then outputChatBox("Select a craft object!", 255, 0, 0) return end 
        local craftID = guiGridListGetItemData(GUIEditor.gridlist[2], guiGridListGetSelectedItem(GUIEditor.gridlist[2]), 1) 
        local amount = guiGetText(GUIEditor.edit[1]) 
        if craftID == 1  and amount ~= "" then 
           setElementData(localPlayer, "iron", tonumber(amount)) 
           local row =guiGridListAddRow(GUIEditor.gridlist[1]) 
           guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, "iron",false, false) 
           guiGridListSetItemData(GUIEditor.gridlist[1], row, 1, iron) 
        elseif craftID == 2 and amount ~= "" then 
            setElementData(localPlayer, "oil", tonumber(amount)) 
            local row = guiGridListAddRow(GUIEditor.gridlist[1]) 
            guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, "oil", false, false) 
            guiGridListSetItemData(GUIEditor.gridlist[1], row, 1, oil) 
        elseif craftID == 3 and amount ~= "" then 
            setElementData(localPlayer, "explosifs", tonumber(amount)) 
            local row = guiGridListAddRow(GUIEditor.girdlist[1]) 
            guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, "explosifs", false, false) 
            guiGridListSetItemData(GUIEditor.gridlist[1], row, 1, explosifs) 
        end 
    elseif source == guiGridListGetSelectedItem(GUIEditor.gridlist[3]) then  
        for _, v in ipairs(getPedWeapon(localPlayer)) do 
            local row = guiGridListAddRow(GUIEditor.gridlist[1]) 
            guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, v, false, false) 
            guiGridListSetItemData(GUIEditor.gridlist[1], row, 1, v) 
        end 
        if guiGridListGetSelectedItem(GUIEditor.gridlist[3]) == -1 then outputChatBox("You need select a weapon!", 255, 0, 0) return end 
        local weaponID = guiGridListGetItemData(GUIEditor.gridlist[3], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), 1) 
        local iron = getElementData(localPlayer, "iron") 
        local oil = getElementData(localPlayer, "oil") 
        local explosifs = getElementData(localPlayer, "explosifs") 
        if iron >= 10 and oil >= 15 then 
           if weaponID == 1 or weaponID == 2 or weaponID == 3 or weaponID == 4 or weaponID == 5 or weaponID == 6 or weaponID == 7 or weaponID == 8 or weaponID == 9 or weaponID == 10 or weaponID == 11 or weaponID == 12 or weaponID == 14 or weaponID == 15 or weaponID == 40 or weaponID == 44 or weaponID == 45 or weaponID == 46 then 
               givePedWeapon(localPlayer, weaponID, 1, true) 
               iron = iron - 10 
               oil = oil - 15 
            elseif weaponID == 22 or weaponID == 23 or weaponID == 24 then 
                givePedWeapon(localPlayer, weaponID, 400, true) 
                iron = iron - 10 
                oil = oil - 15 
            elseif weaponID == 25 or weaponID == 26  or weaponID == 27 then 
               givePedWeapon(localPlayer, weaponID, 350, true) 
               iron = iron - 10 
               oil= oil - 15 
            elseif weaponID == 28 or weaponID == 29 or weaponID == 32 then 
                givePedWeapon(localPlayer, weaponID, 300, true) 
                iron = iron - 10 
                oil = oil - 15 
            elseif weaponID == 30 or weaponID == 31 then 
               givePedWeapon(localPlayer, weaponID, 200, true) 
               iron = iron - 10 
               oil = oil - 15 
            elseif weaponID == 33 or weaponID == 34 then 
                givePedWeapon(localPlayer, weaponID, 150, true) 
                iron = iron - 10 
                oil = oil - 15 
            elseif weaponID == 38 or weaponID == 41 or weaponID == 42 or  weaponID == 37 then 
                givePedWeapon(localPlayer, weaponID, 250, true) 
                iron = iron - 10 
                oil = oil - 15 
            elseif weaponID == 43 then 
                givePedWeapon(localPlayer, weaponID, 100, true) 
                iron = iron - 10 
                oil = oil - 15 
           end 
        elseif iron >= 10 and oil >= 15 and explosifs >= 20 then 
            if weaponID == 16 or weaponID == 17 or weaponID == 18 or weaponID == 39 or weaponID == 35 or weaponID == 36 then 
               givePedWeapon(localPlayer, weaponID, 50, true) 
               iron = iron - 10  
               oil = oil - 15 
               explosifs = explosifs - 20 
            end 
        end 
    end 
end) 

now not accepting number not error or warnings

Link to comment
local GUIEditor= { 
   window = { }, 
   edit = { }, 
   label = { }, 
   button = { }, 
   scrollbar = { }, 
   gridlist = { }  
} 
  
local Crafts = { 
   {"Iron", 1}, 
   {"Oil", 2}, 
   {"Explosifs", 3} 
} 
  
local Weapons = { 
   {"Brass Knuckles", 1}, 
   {"Golf Club", 2}, 
   {"Nightstick", 3}, 
   {"Knife", 4}, 
   {"Baseball Bat", 5}, 
   {"Cane", 15}, 
   {"Shovel", 6}, 
   {"Pool Cue", 7}, 
   {"Katana", 8}, 
   {"Chainsaw", 9}, 
   {"Colt 45", 22}, 
   {"Silenced", 23}, 
   {"Desert Eagle", 24}, 
   {"Shotgun", 25}, 
   {"Spawn-off", 26}, 
   {"Spaz-12", 27}, 
   {"UZI", 28}, 
   {"MP5", 29}, 
   {"TEC-9", 32}, 
   {"AK47", 30}, 
   {"M4", 31}, 
   {"Country sniper", 33}, 
   {"Sniper", 34}, 
   {"Rocket Lanuncher", 35}, 
   {"Heat-Seeking RPG", 36}, 
   {"Flamethrower", 37}, 
   {"Minigun", 38}, 
   {"Grenade", 16}, 
   {"Tear gas", 17}, 
   {"Molotov", 18}, 
   {"Satchel", 39}, 
   {"Satchel detonator", 40}, 
   {"Spraycan", 41}, 
   {"Fire Extinguisher", 42}, 
   {"Camera", 43}, 
   {"Night vision goggles", 44}, 
   {"Infrared oggles", 45}, 
   {"Parachute", 46}, 
   {"Long Dildo", 10}, 
   {"Short Dildo", 11}, 
   {"Vibrator", 12}, 
   {"Flowers", 14},  
} 
  
function createCraftWindow() 
   GUIEditor.window [1]= guiCreateWindow(251, 224, 1230, 557, "Craft Window", false) 
   GUIEditor.gridlist[1] = guiCreateGridList(10, 33, 266, 354, false, GUIEditor.window[1]) 
   inctenrotry = guiGridListAddColumn(GUIEditor.gridlist[1], "Inventory", 0.60) 
   GUIEditor.gridlist[2] = guiCreateGridList(350, 33, 266, 354, false, GUIEditor.window[1]) 
   crafts= guiGridListAddColumn(GUIEditor.gridlist[2], "Craftable objects", 0.60) 
   GUIEditor.gridlist[3] = guiCreateGridList(697, 33, 266, 354, false, GUIEditor.window[1]) 
   weapons = guiGridListAddColumn(GUIEditor.gridlist[3],  "Weapons", 0.60) 
   GUIEditor.label[1] = guiCreateLabel(243, 443, 71, 18, "Amount:", false, GUIEditor.window[1]) 
   GUIEditor.edit[1] = guiCreateEdit(324, 443, 143, 24, "", false, GUIEditor.window[1]) 
   GUIEditor.button[1]= guiCreateButton(524, 434, 106, 43, "Craft", false, GUIEditor.window[1]) 
   GUIEditor.scrollbar[1] = guiCreateScrollBar(530, 4, 15, 187, false, false, GUIEditor.window[1]) 
   guiWindowSetMovable(GUIEditor.window[1], false) 
   guiWindowSetSizable(GUIEditor.window[1], false) 
   guiSetVisible(GUIEditor.window[1], false) 
   for _, v in ipairs(Crafts) do 
       local row = guiGridListAddRow(GUIEditor.gridlist[2]) 
       guiGridListSetItemText(GUIEditor.gridlist[2], row, 1, v[1], false, false) 
       guiGridListSetItemData(GUIEditor.gridlist[2], row, 1, v[2]) 
   end 
   for _, v in ipairs(Weapons) do 
       local row = guiGridListAddRow(GUIEditor.gridlist[3]) 
       guiGridListSetItemText(GUIEditor.gridlist[3], row, 1, v[1], false, false) 
       guiGridListSetItemData(GUIEditor.gridlist[3], row, 1, v[2]) 
   end 
end 
  
addEventHandler("onClientGUIChanged", root,  
function() 
  guiSetText(GUIEditor.edit[1], string.gsub(guiGetText(GUIEditor.edit[1]), "%d", "")) 
end) 
  
function showCraftWindow() 
    createCraftWindow() 
    guiSetVisible(GUIEditor.window[1], not guiGetVisible(GUIEditor.window[1])) 
    showCursor(not isCursorShowing) 
    guiSetInputEnabled(not guiGetInputEnabled()) 
end 
bindKey("F9", "down", showCraftWindow) 
  
addEventHandler("onClientGUIClick", root, 
function(button, state) 
    if source == GUIEditor.button[1] then 
        if guiGridListGetSelectedItem(GUIEditor.gridlist[2]) == - 1 then outputChatBox("Select a craft object!", 255, 0, 0) return end 
        local craftID = guiGridListGetItemData(GUIEditor.gridlist[2], guiGridListGetSelectedItem(GUIEditor.gridlist[2]), 1) 
        local amount = guiGetText(GUIEditor.edit[1]) 
        if craftID == 1  and amount ~= "" then 
           setElementData(localPlayer, "iron", tonumber(amount)) 
           local row =guiGridListAddRow(GUIEditor.gridlist[1]) 
           guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, "iron",false, false) 
           guiGridListSetItemData(GUIEditor.gridlist[1], row, 1, iron) 
        elseif craftID == 2 and amount ~= "" then 
            setElementData(localPlayer, "oil", tonumber(amount)) 
            local row = guiGridListAddRow(GUIEditor.gridlist[1]) 
            guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, "oil", false, false) 
            guiGridListSetItemData(GUIEditor.gridlist[1], row, 1, oil) 
        elseif craftID == 3 and amount ~= "" then 
            setElementData(localPlayer, "explosifs", tonumber(amount)) 
            local row = guiGridListAddRow(GUIEditor.girdlist[1]) 
            guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, "explosifs", false, false) 
            guiGridListSetItemData(GUIEditor.gridlist[1], row, 1, explosifs) 
        end 
    elseif source == guiGridListGetSelectedItem(GUIEditor.gridlist[3]) then  
        for _, v in ipairs(getPedWeapon(localPlayer)) do 
            local row = guiGridListAddRow(GUIEditor.gridlist[1]) 
            guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, v, false, false) 
            guiGridListSetItemData(GUIEditor.gridlist[1], row, 1, v) 
        end 
        if guiGridListGetSelectedItem(GUIEditor.gridlist[3]) == -1 then outputChatBox("You need select a weapon!", 255, 0, 0) return end 
        local weaponID = guiGridListGetItemData(GUIEditor.gridlist[3], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), 1) 
        local iron = getElementData(localPlayer, "iron") 
        local oil = getElementData(localPlayer, "oil") 
        local explosifs = getElementData(localPlayer, "explosifs") 
        if iron >= 10 and oil >= 15 then 
           if weaponID == 1 or weaponID == 2 or weaponID == 3 or weaponID == 4 or weaponID == 5 or weaponID == 6 or weaponID == 7 or weaponID == 8 or weaponID == 9 or weaponID == 10 or weaponID == 11 or weaponID == 12 or weaponID == 14 or weaponID == 15 or weaponID == 40 or weaponID == 44 or weaponID == 45 or weaponID == 46 then 
               givePedWeapon(localPlayer, weaponID, 1, true) 
               iron = iron - 10 
               oil = oil - 15 
            elseif weaponID == 22 or weaponID == 23 or weaponID == 24 then 
                givePedWeapon(localPlayer, weaponID, 400, true) 
                iron = iron - 10 
                oil = oil - 15 
            elseif weaponID == 25 or weaponID == 26  or weaponID == 27 then 
               givePedWeapon(localPlayer, weaponID, 350, true) 
               iron = iron - 10 
               oil= oil - 15 
            elseif weaponID == 28 or weaponID == 29 or weaponID == 32 then 
                givePedWeapon(localPlayer, weaponID, 300, true) 
                iron = iron - 10 
                oil = oil - 15 
            elseif weaponID == 30 or weaponID == 31 then 
               givePedWeapon(localPlayer, weaponID, 200, true) 
               iron = iron - 10 
               oil = oil - 15 
            elseif weaponID == 33 or weaponID == 34 then 
                givePedWeapon(localPlayer, weaponID, 150, true) 
                iron = iron - 10 
                oil = oil - 15 
            elseif weaponID == 38 or weaponID == 41 or weaponID == 42 or  weaponID == 37 then 
                givePedWeapon(localPlayer, weaponID, 250, true) 
                iron = iron - 10 
                oil = oil - 15 
            elseif weaponID == 43 then 
                givePedWeapon(localPlayer, weaponID, 100, true) 
                iron = iron - 10 
                oil = oil - 15 
           end 
        elseif iron >= 10 and oil >= 15 and explosifs >= 20 then 
            if weaponID == 16 or weaponID == 17 or weaponID == 18 or weaponID == 39 or weaponID == 35 or weaponID == 36 then 
               givePedWeapon(localPlayer, weaponID, 50, true) 
               iron = iron - 10  
               oil = oil - 15 
               explosifs = explosifs - 20 
            end 
        end 
    end 
end) 

now not accepting number not error or warnings

check

  
local GUIEditor= { 
   window = { }, 
   edit = { }, 
   label = { }, 
   button = { }, 
   scrollbar = { }, 
   gridlist = { } 
} 
  
local Crafts = { 
   {"Iron", 1}, 
   {"Oil", 2}, 
   {"Explosifs", 3} 
} 
  
local Weapons = { 
   {"Brass Knuckles", 1}, 
   {"Golf Club", 2}, 
   {"Nightstick", 3}, 
   {"Knife", 4}, 
   {"Baseball Bat", 5}, 
   {"Cane", 15}, 
   {"Shovel", 6}, 
   {"Pool Cue", 7}, 
   {"Katana", 8}, 
   {"Chainsaw", 9}, 
   {"Colt 45", 22}, 
   {"Silenced", 23}, 
   {"Desert Eagle", 24}, 
   {"Shotgun", 25}, 
   {"Spawn-off", 26}, 
   {"Spaz-12", 27}, 
   {"UZI", 28}, 
   {"MP5", 29}, 
   {"TEC-9", 32}, 
   {"AK47", 30}, 
   {"M4", 31}, 
   {"Country sniper", 33}, 
   {"Sniper", 34}, 
   {"Rocket Lanuncher", 35}, 
   {"Heat-Seeking RPG", 36}, 
   {"Flamethrower", 37}, 
   {"Minigun", 38}, 
   {"Grenade", 16}, 
   {"Tear gas", 17}, 
   {"Molotov", 18}, 
   {"Satchel", 39}, 
   {"Satchel detonator", 40}, 
   {"Spraycan", 41}, 
   {"Fire Extinguisher", 42}, 
   {"Camera", 43}, 
   {"Night vision goggles", 44}, 
   {"Infrared oggles", 45}, 
   {"Parachute", 46}, 
   {"Long Dildo", 10}, 
   {"Short Dildo", 11}, 
   {"Vibrator", 12}, 
   {"Flowers", 14}, 
} 
  
function createCraftWindow() 
   GUIEditor.window [1]= guiCreateWindow(251, 224, 1230, 557, "Craft Window", false) 
   GUIEditor.gridlist[1] = guiCreateGridList(10, 33, 266, 354, false, GUIEditor.window[1]) 
   inctenrotry = guiGridListAddColumn(GUIEditor.gridlist[1], "Inventory", 0.60) 
   GUIEditor.gridlist[2] = guiCreateGridList(350, 33, 266, 354, false, GUIEditor.window[1]) 
   crafts= guiGridListAddColumn(GUIEditor.gridlist[2], "Craftable objects", 0.60) 
   GUIEditor.gridlist[3] = guiCreateGridList(697, 33, 266, 354, false, GUIEditor.window[1]) 
   weapons = guiGridListAddColumn(GUIEditor.gridlist[3],  "Weapons", 0.60) 
   GUIEditor.label[1] = guiCreateLabel(243, 443, 71, 18, "Amount:", false, GUIEditor.window[1]) 
   GUIEditor.edit[1] = guiCreateEdit(324, 443, 143, 24, "", false, GUIEditor.window[1]) 
   GUIEditor.button[1]= guiCreateButton(524, 434, 106, 43, "Craft", false, GUIEditor.window[1]) 
   GUIEditor.scrollbar[1] = guiCreateScrollBar(530, 4, 15, 187, false, false, GUIEditor.window[1]) 
   guiWindowSetMovable(GUIEditor.window[1], false) 
   guiWindowSetSizable(GUIEditor.window[1], false) 
   guiSetVisible(GUIEditor.window[1], false) 
   for _, v in ipairs(Crafts) do 
       local row = guiGridListAddRow(GUIEditor.gridlist[2]) 
       guiGridListSetItemText(GUIEditor.gridlist[2], row, 1, v[1], false, false) 
       guiGridListSetItemData(GUIEditor.gridlist[2], row, 1, v[2]) 
   end 
   for _, v in ipairs(Weapons) do 
       local row = guiGridListAddRow(GUIEditor.gridlist[3]) 
       guiGridListSetItemText(GUIEditor.gridlist[3], row, 1, v[1], false, false) 
       guiGridListSetItemData(GUIEditor.gridlist[3], row, 1, v[2]) 
   end 
end 
  
addEventHandler("onClientGUIChanged", root, 
function() 
  guiSetText(GUIEditor.edit[1], string.gsub(guiGetText(GUIEditor.edit[1]), "%W", "")) 
end) 
  
function showCraftWindow() 
    createCraftWindow() 
    guiSetVisible(GUIEditor.window[1], not guiGetVisible(GUIEditor.window[1])) 
    showCursor(not isCursorShowing) 
    guiSetInputEnabled(not guiGetInputEnabled()) 
end 
bindKey("F9", "down", showCraftWindow) 
  
addEventHandler("onClientGUIClick", root, 
function(button, state) 
    if source == GUIEditor.button[1] then 
        if guiGridListGetSelectedItem(GUIEditor.gridlist[2]) == - 1 then outputChatBox("Select a craft object!", 255, 0, 0) return end 
        local craftID = guiGridListGetItemData(GUIEditor.gridlist[2], guiGridListGetSelectedItem(GUIEditor.gridlist[2]), 1) 
        local amount = guiGetText(GUIEditor.edit[1]) 
        if craftID == 1  and amount ~= "" then 
           setElementData(localPlayer, "iron", tonumber(amount)) 
           local row =guiGridListAddRow(GUIEditor.gridlist[1]) 
           guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, "iron",false, false) 
           guiGridListSetItemData(GUIEditor.gridlist[1], row, 1, iron) 
        elseif craftID == 2 and amount ~= "" then 
            setElementData(localPlayer, "oil", tonumber(amount)) 
            local row = guiGridListAddRow(GUIEditor.gridlist[1]) 
            guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, "oil", false, false) 
            guiGridListSetItemData(GUIEditor.gridlist[1], row, 1, oil) 
        elseif craftID == 3 and amount ~= "" then 
            setElementData(localPlayer, "explosifs", tonumber(amount)) 
            local row = guiGridListAddRow(GUIEditor.girdlist[1]) 
            guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, "explosifs", false, false) 
            guiGridListSetItemData(GUIEditor.gridlist[1], row, 1, explosifs) 
        end 
    elseif source == guiGridListGetSelectedItem(GUIEditor.gridlist[3]) then 
        for _, v in ipairs(getPedWeapon(localPlayer)) do 
            local row = guiGridListAddRow(GUIEditor.gridlist[1]) 
            guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, v, false, false) 
            guiGridListSetItemData(GUIEditor.gridlist[1], row, 1, v) 
        end 
        if guiGridListGetSelectedItem(GUIEditor.gridlist[3]) == -1 then outputChatBox("You need select a weapon!", 255, 0, 0) return end 
        local weaponID = guiGridListGetItemData(GUIEditor.gridlist[3], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), 1) 
        local iron = getElementData(localPlayer, "iron") 
        local oil = getElementData(localPlayer, "oil") 
        local explosifs = getElementData(localPlayer, "explosifs") 
        if iron >= 10 and oil >= 15 then 
           if weaponID == 1 or weaponID == 2 or weaponID == 3 or weaponID == 4 or weaponID == 5 or weaponID == 6 or weaponID == 7 or weaponID == 8 or weaponID == 9 or weaponID == 10 or weaponID == 11 or weaponID == 12 or weaponID == 14 or weaponID == 15 or weaponID == 40 or weaponID == 44 or weaponID == 45 or weaponID == 46 then 
               givePedWeapon(localPlayer, weaponID, 1, true) 
               iron = iron - 10 
               oil = oil - 15 
            elseif weaponID == 22 or weaponID == 23 or weaponID == 24 then 
                givePedWeapon(localPlayer, weaponID, 400, true) 
                iron = iron - 10 
                oil = oil - 15 
            elseif weaponID == 25 or weaponID == 26  or weaponID == 27 then 
               givePedWeapon(localPlayer, weaponID, 350, true) 
               iron = iron - 10 
               oil= oil - 15 
            elseif weaponID == 28 or weaponID == 29 or weaponID == 32 then 
                givePedWeapon(localPlayer, weaponID, 300, true) 
                iron = iron - 10 
                oil = oil - 15 
            elseif weaponID == 30 or weaponID == 31 then 
               givePedWeapon(localPlayer, weaponID, 200, true) 
               iron = iron - 10 
               oil = oil - 15 
            elseif weaponID == 33 or weaponID == 34 then 
                givePedWeapon(localPlayer, weaponID, 150, true) 
                iron = iron - 10 
                oil = oil - 15 
            elseif weaponID == 38 or weaponID == 41 or weaponID == 42 or  weaponID == 37 then 
                givePedWeapon(localPlayer, weaponID, 250, true) 
                iron = iron - 10 
                oil = oil - 15 
            elseif weaponID == 43 then 
                givePedWeapon(localPlayer, weaponID, 100, true) 
                iron = iron - 10 
                oil = oil - 15 
           end 
        elseif iron >= 10 and oil >= 15 and explosifs >= 20 then 
            if weaponID == 16 or weaponID == 17 or weaponID == 18 or weaponID == 39 or weaponID == 35 or weaponID == 36 then 
               givePedWeapon(localPlayer, weaponID, 50, true) 
               iron = iron - 10 
               oil = oil - 15 
               explosifs = explosifs - 20 
            end 
        end 
    end 
end) 
  

Link to comment
local GUIEditor= { 
   window = { }, 
   edit = { }, 
   label = { }, 
   button = { }, 
   scrollbar = { }, 
   gridlist = { }  
} 
  
local Crafts = { 
   {"Iron", 1}, 
   {"Oil", 2}, 
   {"Explosifs", 3} 
} 
  
local Weapons = { 
   {"Brass Knuckles", 1}, 
   {"Golf Club", 2}, 
   {"Nightstick", 3}, 
   {"Knife", 4}, 
   {"Baseball Bat", 5}, 
   {"Cane", 15}, 
   {"Shovel", 6}, 
   {"Pool Cue", 7}, 
   {"Katana", 8}, 
   {"Chainsaw", 9}, 
   {"Colt 45", 22}, 
   {"Silenced", 23}, 
   {"Desert Eagle", 24}, 
   {"Shotgun", 25}, 
   {"Spawn-off", 26}, 
   {"Spaz-12", 27}, 
   {"UZI", 28}, 
   {"MP5", 29}, 
   {"TEC-9", 32}, 
   {"AK47", 30}, 
   {"M4", 31}, 
   {"Country sniper", 33}, 
   {"Sniper", 34}, 
   {"Rocket Lanuncher", 35}, 
   {"Heat-Seeking RPG", 36}, 
   {"Flamethrower", 37}, 
   {"Minigun", 38}, 
   {"Grenade", 16}, 
   {"Tear gas", 17}, 
   {"Molotov", 18}, 
   {"Satchel", 39}, 
   {"Satchel detonator", 40}, 
   {"Spraycan", 41}, 
   {"Fire Extinguisher", 42}, 
   {"Camera", 43}, 
   {"Night vision goggles", 44}, 
   {"Infrared oggles", 45}, 
   {"Parachute", 46}, 
   {"Long Dildo", 10}, 
   {"Short Dildo", 11}, 
   {"Vibrator", 12}, 
   {"Flowers", 14},  
} 
  
function createCraftWindow() 
   GUIEditor.window [1]= guiCreateWindow(251, 224, 1230, 557, "Craft Window", false) 
   GUIEditor.gridlist[1] = guiCreateGridList(10, 33, 266, 354, false, GUIEditor.window[1]) 
   inctenrotry = guiGridListAddColumn(GUIEditor.gridlist[1], "Inventory", 0.60) 
   GUIEditor.gridlist[2] = guiCreateGridList(350, 33, 266, 354, false, GUIEditor.window[1]) 
   crafts= guiGridListAddColumn(GUIEditor.gridlist[2], "Craftable objects", 0.60) 
   GUIEditor.gridlist[3] = guiCreateGridList(697, 33, 266, 354, false, GUIEditor.window[1]) 
   weapons = guiGridListAddColumn(GUIEditor.gridlist[3],  "Weapons", 0.60) 
   GUIEditor.label[1] = guiCreateLabel(243, 443, 71, 18, "Amount:", false, GUIEditor.window[1]) 
   GUIEditor.edit[1] = guiCreateEdit(324, 443, 143, 24, "", false, GUIEditor.window[1]) 
   GUIEditor.button[1]= guiCreateButton(524, 434, 106, 43, "Craft", false, GUIEditor.window[1]) 
   GUIEditor.scrollbar[1] = guiCreateScrollBar(530, 4, 15, 187, false, false, GUIEditor.window[1]) 
   guiWindowSetMovable(GUIEditor.window[1], false) 
   guiWindowSetSizable(GUIEditor.window[1], false) 
   guiSetVisible(GUIEditor.window[1], false) 
   for _, v in ipairs(Crafts) do 
       local row = guiGridListAddRow(GUIEditor.gridlist[2]) 
       guiGridListSetItemText(GUIEditor.gridlist[2], row, 1, v[1], false, false) 
       guiGridListSetItemData(GUIEditor.gridlist[2], row, 1, v[2]) 
   end 
   for _, v in ipairs(Weapons) do 
       local row = guiGridListAddRow(GUIEditor.gridlist[3]) 
       guiGridListSetItemText(GUIEditor.gridlist[3], row, 1, v[1], false, false) 
       guiGridListSetItemData(GUIEditor.gridlist[3], row, 1, v[2]) 
   end 
end 
  
addEventHandler("onClientGUIChanged", root,  
function() 
  guiSetText(GUIEditor.edit[1], string.gsub(guiGetText(GUIEditor.edit[1]), "%W", "")) 
end) 
  
function showCraftWindow() 
    createCraftWindow() 
    guiSetVisible(GUIEditor.window[1], not guiGetVisible(GUIEditor.window[1])) 
    showCursor(not isCursorShowing) 
    guiSetInputEnabled(not guiGetInputEnabled()) 
end 
bindKey("F9", "down", showCraftWindow) 
  
addEventHandler("onClientGUIClick", root, 
function(button, state) 
    if source == GUIEditor.button[1] then 
        if guiGridListGetSelectedItem(GUIEditor.gridlist[2]) == - 1 then outputChatBox("Select a craft object!", 255, 0, 0) return end 
        local craftID = guiGridListGetItemData(GUIEditor.gridlist[2], guiGridListGetSelectedItem(GUIEditor.gridlist[2]), 1) 
        local amount = guiGetText(GUIEditor.edit[1]) 
        if craftID == 1  and amount ~= "" then 
           setElementData(localPlayer, "iron", tonumber(amount)) 
           local row =guiGridListAddRow(GUIEditor.gridlist[1]) 
           guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, "iron",false, false) 
           guiGridListSetItemData(GUIEditor.gridlist[1], row, 1, iron) 
        elseif craftID == 2 and amount ~= "" then 
            setElementData(localPlayer, "oil", tonumber(amount)) 
            local row = guiGridListAddRow(GUIEditor.gridlist[1]) 
            guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, "oil", false, false) 
            guiGridListSetItemData(GUIEditor.gridlist[1], row, 1, oil) 
        elseif craftID == 3 and amount ~= "" then 
            setElementData(localPlayer, "explosifs", tonumber(amount)) 
            local row = guiGridListAddRow(GUIEditor.girdlist[1]) 
            guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, "explosifs", false, false) 
            guiGridListSetItemData(GUIEditor.gridlist[1], row, 1, explosifs) 
        end 
        if guiGridListGetSelectedItem(GUIEditor.gridlist[3]) == -1 then outputChatBox("You need select a weapon!", 255, 0, 0) return end 
        local weaponID = guiGridListGetItemData(GUIEditor.gridlist[3], guiGridListGetSelectedItem(GUIEditor.gridlist[3]), 1) 
        local iron = getElementData(localPlayer, "iron") 
        local oil = getElementData(localPlayer, "oil") 
        local explosifs = getElementData(localPlayer, "explosifs") 
        if iron >= 10 and oil >= 15 then 
           if weaponID == 1 or weaponID == 2 or weaponID == 3 or weaponID == 4 or weaponID == 5 or weaponID == 6 or weaponID == 7 or weaponID == 8 or weaponID == 9 or weaponID == 10 or weaponID == 11 or weaponID == 12 or weaponID == 14 or weaponID == 15 or weaponID == 40 or weaponID == 44 or weaponID == 45 or weaponID == 46 then 
               givePedWeapon(localPlayer, weaponID, 1, true) 
               iron = iron - 10 
               oil = oil - 15 
            elseif weaponID == 22 or weaponID == 23 or weaponID == 24 then 
                givePedWeapon(localPlayer, weaponID, 400, true) 
                iron = iron - 10 
                oil = oil - 15 
            elseif weaponID == 25 or weaponID == 26  or weaponID == 27 then 
               givePedWeapon(localPlayer, weaponID, 350, true) 
               iron = iron - 10 
               oil= oil - 15 
            elseif weaponID == 28 or weaponID == 29 or weaponID == 32 then 
                givePedWeapon(localPlayer, weaponID, 300, true) 
                iron = iron - 10 
                oil = oil - 15 
            elseif weaponID == 30 or weaponID == 31 then 
               givePedWeapon(localPlayer, weaponID, 200, true) 
               iron = iron - 10 
               oil = oil - 15 
            elseif weaponID == 33 or weaponID == 34 then 
                givePedWeapon(localPlayer, weaponID, 150, true) 
                iron = iron - 10 
                oil = oil - 15 
            elseif weaponID == 38 or weaponID == 41 or weaponID == 42 or  weaponID == 37 then 
                givePedWeapon(localPlayer, weaponID, 250, true) 
                iron = iron - 10 
                oil = oil - 15 
            elseif weaponID == 43 then 
                givePedWeapon(localPlayer, weaponID, 100, true) 
                iron = iron - 10 
                oil = oil - 15 
           end 
        elseif iron >= 10 and oil >= 15 and explosifs >= 20 then 
            if weaponID == 16 or weaponID == 17 or weaponID == 18 or weaponID == 39 or weaponID == 35 or weaponID == 36 then 
               givePedWeapon(localPlayer, weaponID, 50, true) 
               iron = iron - 10  
               oil = oil - 15 
               explosifs = explosifs - 20 
            end 
        else 
           outputChatBox("You don't have enough material (required 10 iron, 15 oil and 20 explosifs", 255, 0 ,0) 
        end 
    end 
end) 

not giving the weapon even have the material and not error or warnigns also the window no hide remain open

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...