-
Posts
1,546 -
Joined
-
Last visited
Everything posted by Dimos7
-
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
-
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
-
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)
-
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]
-
I know that i mean how to make the like low ride go that transfernder
-
for _, area in ipairs(getElementsByType('radararea')) do local x, y = getElementPosition(area); local areaWidth, areaHeight = getRadarAreaSize(area); local areaR, areaG, areaB, areaA = getRadarAreaColor(area); if (isRadarAreaFlashing(area)) then local flashTick = getTickCount() % 1500; areaR, areaG, areaB = flashTick <= 750 and 255 or areaR, flashTick <= 750 and 0 or areaG, flashTick <= 750 and 0 or areaB; end local areaX, areaY = getMapFromWorldPosition(x, y + areaHeight); local areaWidth, areaHeight = areaWidth / Bigmap.CurrentZoom * Minimap.MapUnit, areaHeight / Bigmap.CurrentZoom * Minimap.MapUnit; -- how to clip the rectangles? dxDrawRectangle(areaX, areaY, areaWidth, areaHeight, tocolor(areaR, areaG, areaB, areaA), false); end function getMapFromWorldPosition(worldX, worldY) local playerX, playerY, playerZ = getElementPosition(localPlayer); local centerX, centerY = (Bigmap.PosX + (Bigmap.Width / 2)), (Bigmap.PosY + (Bigmap.Height / 2)); local areaLeftFrame = centerX - ((playerX - worldX) / Bigmap.CurrentZoom * Minimap.MapUnit); local areaRightFrame = centerX + ((worldX - playerX) / Bigmap.CurrentZoom * Minimap.MapUnit); local areaTopFrame = centerY - ((worldY - playerY) / Bigmap.CurrentZoom * Minimap.MapUnit); local areaBottomFrame = centerY + ((playerY - worldY) / Bigmap.CurrentZoom * Minimap.MapUnit); centerX = math.max(areaLeftFrame, math.min(areaRightFrame, centerX)); centerY = math.max(areaTopFrame, math.min(areaBottomFrame, centerY)); return centerX, centerY; end
-
function hit ( pla, dim ) if getElementType ( pla ) == "player" then local vehicle = getPedOccupiedVehicle ( pla ) if vehicle or not vehicle then local account = getPlayerAccount ( pla ) if account then local accountname = getAccountName ( account ) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then else if isObjectInACLGroup ( "user." ..accountname, aclGetGroup ( "Super Moderator" ) ) then else if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Moderator" ) ) then outputChatBox ( "[WTA]Welcome Sir, "..getPlayerName(pla).."!", pla, 0, 150, 0 ) else setElementData ( pla, "inRestrictedArea", "true" ) triggerClientEvent ( pla, "destroyTrepassor", g_root, pla ) outputChatBox ( "***WTA Headquarters Restricted Area!***", pla, 255, 0, 0 ) outputChatBox ( "* "..getPlayerName(pla)..".has entered The WTA Headquarters Restricted Area.Enjoy The Fireworks Bro!", g_root, 70, 251, 45 ) end end end end end end end addEventHandler ( "onColShapeHit", g_base_col, hit )
-
Hello there i want to make car mode in transfender like gtasa single player how to do it?
-
function getPlayerFromPatrialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end function privateMessage(thePlayer, _, sendToName, ...) local message = table.concat({...}, "") if sendToName then if (getPlayerFromPatrialName(sendToName)) then toPlayer = (getPlayerFromPatrialName(sendToName)) if toPlayer ~= thePlayer then if message ~= "" then outputChatBox("#18CB5BPM to "..getPlayerName(toPlayer)..":#FFFFFF "..message, thePlayer, 255, 255, 255, true) outputChatBox("#18CB5BPM from "..getPlayerName(thePlayer)..":#FFFFFF "..message, toPlayer, 255, 255, 255, true) outputServerLog("#18CB5BPM to "..getPlayerName(toPlayer)..":#FFFFFF "..message) outputServerLog("#18CB5BPM from "..getPlayerName(thePlayer).."#FFFFFF "..message) outputChatBox("#18CB5B /reply [message]", toPlayer, 255, 255, 255, true) setElementData(thePlayer, "pmPartner", toPlayer) setElementData(toPlayer, "pmPartner", thePlayer) else outputChatBox("Use /pm [part of name] [message]", thePlayer, 255, 0, 0) return false end else outputChatBox("You cannot pm to yourself!", thePlayer, 255, 0, 0) return false end else outputChatBox("Player not found!", thePlayer, 255, 0, 0) return false end else outputChatBox("Use /pm [part of name] [message]", thePlayer, 255, 0, 0) return false end end addCommandHandler("pm", privateMessage) function privateMessageReply(thePlayer, _, ...) local message = table.concat({...}, "") local toPlayer = getElementData(thePlayer, "pmPartner") if toPlayer then if message ~= "" then outputChatBox("#18CB5BPM to "..getPlayerName(toPlayer)..":#FFFFFF "..message, thePlayer, 255, 255, 255, true) outputChatBox("#18CB5BPM from "..getPlayerName(thePlayer)..":#FFFFFF "..message, toPlayer, 255, 255, 255, true) outputServerLog("#18CB5BPM to "..getPlayerName(toPlayer)..":#FFFFFF "..message) outputServerLog("#18CB5BPM from "..getPlayerName(thePlayer)..":#FFFFFF "..message) outputChatBox("#18CB5B /reply [message]", toPlayer, 255, 255, 255, true) else outputChatBox("Use /reply [message]", thePlayer, 255, 0, 0) return false end else outputChatBox("None is pmming you!", thePlayer, 255, 0, 0) return false end end addCommandHandler("reply", privateMessageReply) Now there is another problem whan i pm to a different person say you cannot speak to yourself
-
function plate(player, cmdName, text) local acc = getPlayerAccount(player) local accn = getAccountName(acc) local occveh = getPedOccupiedVehicle(player) if occveh then if getElementData(occveh, "vehsAcc") == accn and text then -- This checks if the vehicle is the player's personal veh. If you're wondering setVehiclePlateText(occveh, text) outputChatBox("Plate text changed!", player, 0, 255, 0) else outputChatBox("This isn't your personal vehicle!", player, 255, 0, 0) end else outputChatBox("You must be in a vehicle to change the plate!", player, 255, 0, 0) end end addCommandHandler("plate", plate)
-
the group exist in acl?
-
function getPlayerFromPatrialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end function privateMessage(thePlayer, sendToName, ...) local message = table.concat({...}, "") if sendToName then if (getPlayerFromPatrialName(sendToName)) then toPlayer = (getPlayerFromPatrialName(sendToName)) if not toPlayer == thePlayer then if not message == "" then outputChatBox("#18BC5BPM to "..getPlayerName(toPlayer)..":#FFFFFF "..message, thePlayer, 255, 255, 255, true) outputChatBox("#18BC5BPM from"..getPlayerName(thePlayer)..":#FFFFFF "..message, toPlayer, 255, 255, 255, true) outputChatBox("#18BC5BPM Use /reply [message]", toPlayer, 255, 255, 255, true) setElementData(thePlayer, "pmPartner", toPlayer) setElementData(toPlayer, "pmPartner", thePlayer) else outputChatBox("Use /pm [part of name] [message]", thePlayer, 255, 0, 0) return false end else outputChatBox("You cannot pm to yourself!", thePlayer, 255, 0, 0) return false end else outputChatBox("Player not found!", thePlayer, 255, 0, 0) return false end else outputChatBox("Use /pm [part of name] [message]", thePlayer, 255, 0, 0) return false end end addCommandHandler("pm", privateMessage) function privateMessageReply(thePlayer, ...) local message table.concat({...}, "") local toPlayer = getElementData(thePlayer, "pmPartner") if toPlayer then if not message == "" then outputChatBox("#18BC5BPM to".. getPlayerName(toPlayer)..":#FFFFFF "..message, thePlayer, 255, 255, 255, true) outputChatBox("#18BC5BPM from"..getPlayerName(thePlayer)..":#FFFFFF"..message, toPlayer, 255, 255, 255, true) outputChatBox("#18BC5BPM Use /reply [message]", toPlayer, 255, 255, 255, true) else outputChatBox("Use /reply [message]", thePlayer, 255, 0, 0) return false end else outputChatBox("No partner has been found!", thePlayer, 255, 0, 0) return false end end addCommandHandler("reply", privateMessageReply) no error or warning just only appear not player found wihtout put a player
-
then add that aduty = getElementData(v, "adminduty")
-
if it its like this write not have space
-
i think it is like this db:query("SELECT * FROM users WHERE name=?", name)
-
open your mtaserver confirm and change that <!-- This parameter specifies whether or not to enable player voice chat in-game Values: 0 - disabled , 1 - enabled --> <voice>0</voice> 0 to 1
-
local images ={ {"Main/files/images/menu_bg1.jpg", 1}, {"Main/files/images/menu_bg2.jpg", 2}, {"Main/files/images/menu_bg3.jpg", 3}, {"Main/files/images/menu_bg4.jpg", 4}, {"Main/files/images/menu_bg5.jpg", 5}, {"Main/files/images/menu_bg6.jpg", 6} } local ap = 0 local apmode = true function testBackground() if apmode == true then if ap < 255 then ap = ap + 5 else ap = 255 end else if ap > 0 then ap = ap - 5 else ap = 0 end end for i = 1 , #images do dxDrawImage(s[1]*0/1440,s[2]*0/900, s[1]*1440/1440,s[2]*900/900, images[i], 0, 0, 0, tocolor(255, 255, 255, ap),false) end end
-
local root = getRootElement() local rroot = getResourceRootElement() local sx,sy = guiGetScreenSize() local chatbox = getChatboxLayout() local y = chatbox["chat_scale"][2] local lineas = chatbox["chat_lines"] local font = "default" if chatbox["chat_font"] == 1 then font = "clear" elseif chatbox["chat_font"] == 2 then font = "default-bold" elseif chatbox["chat_font"] == 3 then font = "arial" end addEvent("SpecialEmojis", true) addEventHandler("SpecialEmojis", root,function(txt) for k,v in ipairs(getElementsByType("gui-staticimage",rroot)) do local gx,gy = guiGetPosition(v,true) if string.len(txt) > 100 then guiSetPosition(v, gx,gy-0.025,true) else guiSetPosition(v, gx,gy-0.025,true) end if gy <= 0.01 then destroyElement(v) end end txt = string.gsub(txt,"#%x%x%x%x%x%x","") local len = 0 if string.len(txt) > 48 then return end if string.find(txt,"ضض") then local text = string.gsub(txt,"ضض","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"dai/3tb.png",true) end end) function convertirRelativo(x) local rx = x/sx return rx end
-
Client local root = getRootElement() local rroot = getResourceRootElement() local sx,sy = guiGetScreenSize() local chatbox = getChatboxLayout() local y = chatbox["chat_scale"][2] local lineas = chatbox["chat_lines"] local font = "default" if chatbox["chat_font"] == 1 then font = "clear" elseif chatbox["chat_font"] == 2 then font = "default-bold" elseif chatbox["chat_font"] == 3 then font = "arial" end addEvent("SpecialEmojis", true) addEventHandler("SpecialEmojis", root,function(txt) for k,v in ipairs(getElementsByType("gui-staticimage",rroot)) do local gx,gy = guiGetPosition(v,true) if string.len(txt) > 100 then guiSetPosition(v, gx,gy-0.025,true) else guiSetPosition(v, gx,gy-0.025,true) end if gy <= 0.01 then destroyElement(v) end end txt = string.gsub(txt,"#[%x][%x][%x][%x][%x][%x]","") local len = 0 if string.len(txt) > 48 then return end if string.find(txt,"ضض") then local text = string.gsub(txt,"ضض","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"dai/3tb.png",true) end end) function convertirRelativo(x) local rx = x/sx return rx end Server function dai (thePlayer ) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin")) then triggerClientEvent ( thePlayer, "SpecialEmojis", root ) end end
-
function pedLooks(theElement) local x, y, z = getElementPosition(localPlayer) local bx, by, bz = getElementPosition(theElement) local distance = getDistanceBetweenPoints3D(x, y, z, bx, by, bz) if setPedLookAt(localPlayer, theElement) and distance <= 5 then outputChatBox("You looking at "..theElement) end end
-
So want a player pick up a object when press a key and look it?