I need again yours help
I'm using Shop script- easy customization
Link- http://www.unrealsoftware.de/files_show.php?file=12979
it has some bugs, like when we say !shop so shop menu open but the Message appear !shop on chat.
can we edit?
Script--
More
local settings = --Settings
{
--Shop menu settings
menuTitle = "Shop", --Title of menu
menuPageNext = "Next page", --Text of next page button
menuPagePrev = "Previous page", --Text of previous page button
--Chat command settings
commandShop = "shop", --Chat command to open shop (dont include "!")
commandHelp = "shophelp", --Chat command to see shop help? (dont include "!")
helpColor = "255165000", --Color the help text got
hideCommands = 1, --Hide chat commands? (1 = yes, 0 = no)
--Point settings
startPoints = 15, --Amount of points each player got at start
killPoints = 5, --Amount per kill, the amount will be a random one between the 2 numbers
freePointsTime = 0, --How many secs between each player get free points
freePointsAmount = 0, --The amount of money they get each time
--HUD settings
pointId = 10, --The id of this hud text, if it dont shop up in server you may need to change it
pointText = "Points: ", --Text in front of the point number
pointColor = "255165000", --Color the point text got
pointPos = {10, 200}, --The x and y position of the text
--No money settings
noMoneyText = "[INFO]You dont have enough points!", --Text it will say if the player dont have enough money
noMoneyColor = 255255255 --Color of text for no money
}
local commands = {}
function ChatCommands(id, msg) --My chat command system
local cmd = string.lower(msg)
if commands[cmd] then
commands[cmd](id)
return settings.hideCommands
end
end
addhook("say", "ChatCommands")
local function AddCommand(cmd, OnSay) --Used to add a chat command
commands["!"..string.lower(cmd)] = OnSay
end
AddCommand(settings.commandHelp, function(id) --Chat command to display help
parse('msg2 '..id..' "©'..settings.helpColor.."-----------------------Shop help-----------------------")
parse('msg2 '..id..' "©'..settings.helpColor.."Kill enemies to get points (you will get "..settings.killPoints.." points")
parse('msg2 '..id..' "©'..settings.helpColor.."Type "..settings.commandShop.." to open the shop")
parse('msg2 '..id..' "©'..settings.helpColor.."Type "..settings.commandHelp.." to see this")
parse('msg2 '..id..' "©'..settings.helpColor.."--------------------------------------------------------")
end)
local playerData = {} --Table containing all player info
local function SetPoints(id, points) --Used to set point of a player
if player(id, "bot") == false then
playerData[id].points = points
parse('hudtxt2 '..id..' '..settings.pointId..' "©'..settings.pointColor..settings.pointText..playerData[id].points..'" '..settings.pointPos[1]..' '..settings.pointPos[2])
end
end
function SetupPlayer(id) --setup player info
if player(id, "bot") == false then
playerData[id] = {}
playerData[id].page = 1
SetPoints(id, settings.startPoints)
end
end
addhook("join", "SetupPlayer")
function AddPointsWhenKill(killer, victim, weapon, x, y) --When a player kills another player he will get points
if player(killer, "bot") == false then
SetPoints(killer, playerData[killer].points+settings.killPoints)
end
end
addhook("kill", "AddPointsWhenKill")
local items = {} --Table containing all item info
local function AddItem(name, price, OnBuy) --Used to add a item to the shop
table.insert(items, {name = name, price =price, OnBuy = OnBuy})
end
local function AddItemWeapon(weapon, price) --Used to add a weapon to the shop
AddItem(itemtype(weapon, "name"), price, function(id)
parse('equip '..id..' '..weapon)
parse('setweapon '..id..' '..weapon)
end)
end
--Add items here----------------------------------------------------------------------------------------------------------------------
--Page 1
AddItemWeapon(91, 150) --FN F2000
AddItemWeapon(47, 300) --RPG
AddItemWeapon(88, 400) --Portal gun
AddItemWeapon(45, 500) --Laser
AddItemWeapon(49, 500) --Grenade Launcher
AddItemWeapon(90, 450) --M134
--Page 2
AddItem("White glow", 10, function(id)
local glow = image("gfx/sprites/flare2.bmp", 0, 0, 100+id)
imagecolor(glow, 255, 255, 200)
imagescale(glow, 0.7, 0.7)
imageblend(glow, 1)
imagealpha(glow, 0.5)
end)
AddItem("Red glow", 10, function(id)
local glow = image("gfx/sprites/flare2.bmp", 0, 0, 100+id)
imagecolor(glow, 255, 0, 0)
imagescale(glow, 0.7, 0.7)
imageblend(glow, 1)
imagealpha(glow, 0.5)
end)
AddItem("Green glow", 10, function(id)
local glow = image("gfx/sprites/flare2.bmp", 0, 0, 100+id)
imagecolor(glow, 0, 255, 0)
imagescale(glow, 0.7, 0.7)
imageblend(glow, 1)
imagealpha(glow, 0.5)
end)
AddItem("Blue glow", 10, function(id)
local glow = image("gfx/sprites/flare2.bmp", 0, 0, 100+id)
imagecolor(glow, 0, 0, 255)
imagescale(glow, 0.7, 0.7)
imageblend(glow, 1)
imagealpha(glow, 0.5)
end)
AddItem("Face palm", 15, function(id)
local headcrab = image("gfx/hats/22.png<m>", 1, 0, 200+id)
end)
AddItem("Snark hat", 15, function(id)
local headcrab = image("gfx/npc/snark.bmp<m>", 1, 0, 200+id)
imagescale(headcrab, 2, 2)
end)
--Page 3
AddItemWeapon(74, 100) --Wrench
AddItemWeapon(85, 35) --Chainsaw
AddItemWeapon(54, 25) --Flare
AddItemWeapon(69, 30) --Machete
AddItemWeapon(73, 40) --Molotov Cocktail
AddItemWeapon(41, 30) --Tactical Shield
--Page 4
AddItemWeapon(79, 25) --Light Armor
AddItemWeapon(80, 70) --Armor
AddItemWeapon(81, 180) --Heavy Armor
AddItemWeapon(82, 145) --Medic Armor
AddItemWeapon(83, 150) --Super Armor
AddItemWeapon(84, 300) --Stealth Suit
--------------------------------------------------------------------------------------------------------------------------------------
local page = 1
local pages = {}
pages[page] = {}
local pageCheck = 0
for k, v in pairs(items) do --Here I am settings up the pages table so I can easly add items without worring about space in the menu
pageCheck = pageCheck+1
if pageCheck == 7 then
page = page+1
pages[page] = {}
pageCheck = 1
end
table.insert(pages[page], k) --Insert the item index into the page
end
local function GenerateButtonString(item) --I made this so I dont have to type as much over and over
if item then --If item is valid
return item.name.."|"..item.price --Return the button text
else
return "" --Return no button
end
end
local function OpenShopMenu(id) --Used to open the shop
local indexes = pages[playerData[id].page] --Gets a table of the indexes for this page
menu(id, settings.menuTitle..","..GenerateButtonString(items[indexes[1]])..","..GenerateButtonString(items[indexes[2]])..","..GenerateButtonString(items[indexes[3]])..","..GenerateButtonString(items[indexes[4]])..","..GenerateButtonString(items[indexes[5]])..","..GenerateButtonString(items[indexes[6]])..",,"..(pages[playerData[id].page+1] and settings.menuPageNext or "")..","..(pages[playerData[id].page-1] and settings.menuPagePrev or ""))
end
AddCommand(settings.commandShop, OpenShopMenu)
function ShopMenuHook(id, title, button)
if title == settings.menuTitle then --If its my shop menu
local index = pages[playerData[id].page][button] --Index of item
local price = items[index] and items[index].price or nil --Price of item
if button <= 6 then --If one of the 6 buttons is the one pressed then
if playerData[id].points >= price then --If the players money is more than the price then
items[index].OnBuy(id) --Do what the items gives
SetPoints(id, playerData[id].points-price) --Take the players money
else
msg2(id, "©"..settings.noMoneyColor..settings.noMoneyText) --Message if the player dont have enough money
end
end
if button == 8 then --If button is the "Next page" button
playerData[id].page = playerData[id].page+1 --Increment the page number for that player
OpenShopMenu(id) --And open the menu agian with the new page
elseif button == 9 then --If button is the "Prev page" button
playerData[id].page = playerData[id].page-1 --Decrement the page number for that player
OpenShopMenu(id) --And open the menu agian with the new page
end
end
end
addhook("menu", "ShopMenuHook")
function AddPointsTimer() --Used to give all players some free points
local playerList = player(0, "table") --Get all players in a table
for k, v in pairs(playerList) do
if player(v, "bot") == false then
SetPoints(v, playerData[v].points+settings.freePointsAmount) --Give all existing players some points
end
end
end
timer(settings.freePointsTime*1000, "AddPointsTimer", "", 0) --Infinite timer
{
--Shop menu settings
menuTitle = "Shop", --Title of menu
menuPageNext = "Next page", --Text of next page button
menuPagePrev = "Previous page", --Text of previous page button
--Chat command settings
commandShop = "shop", --Chat command to open shop (dont include "!")
commandHelp = "shophelp", --Chat command to see shop help? (dont include "!")
helpColor = "255165000", --Color the help text got
hideCommands = 1, --Hide chat commands? (1 = yes, 0 = no)
--Point settings
startPoints = 15, --Amount of points each player got at start
killPoints = 5, --Amount per kill, the amount will be a random one between the 2 numbers
freePointsTime = 0, --How many secs between each player get free points
freePointsAmount = 0, --The amount of money they get each time
--HUD settings
pointId = 10, --The id of this hud text, if it dont shop up in server you may need to change it
pointText = "Points: ", --Text in front of the point number
pointColor = "255165000", --Color the point text got
pointPos = {10, 200}, --The x and y position of the text
--No money settings
noMoneyText = "[INFO]You dont have enough points!", --Text it will say if the player dont have enough money
noMoneyColor = 255255255 --Color of text for no money
}
local commands = {}
function ChatCommands(id, msg) --My chat command system
local cmd = string.lower(msg)
if commands[cmd] then
commands[cmd](id)
return settings.hideCommands
end
end
addhook("say", "ChatCommands")
local function AddCommand(cmd, OnSay) --Used to add a chat command
commands["!"..string.lower(cmd)] = OnSay
end
AddCommand(settings.commandHelp, function(id) --Chat command to display help
parse('msg2 '..id..' "©'..settings.helpColor.."-----------------------Shop help-----------------------")
parse('msg2 '..id..' "©'..settings.helpColor.."Kill enemies to get points (you will get "..settings.killPoints.." points")
parse('msg2 '..id..' "©'..settings.helpColor.."Type "..settings.commandShop.." to open the shop")
parse('msg2 '..id..' "©'..settings.helpColor.."Type "..settings.commandHelp.." to see this")
parse('msg2 '..id..' "©'..settings.helpColor.."--------------------------------------------------------")
end)
local playerData = {} --Table containing all player info
local function SetPoints(id, points) --Used to set point of a player
if player(id, "bot") == false then
playerData[id].points = points
parse('hudtxt2 '..id..' '..settings.pointId..' "©'..settings.pointColor..settings.pointText..playerData[id].points..'" '..settings.pointPos[1]..' '..settings.pointPos[2])
end
end
function SetupPlayer(id) --setup player info
if player(id, "bot") == false then
playerData[id] = {}
playerData[id].page = 1
SetPoints(id, settings.startPoints)
end
end
addhook("join", "SetupPlayer")
function AddPointsWhenKill(killer, victim, weapon, x, y) --When a player kills another player he will get points
if player(killer, "bot") == false then
SetPoints(killer, playerData[killer].points+settings.killPoints)
end
end
addhook("kill", "AddPointsWhenKill")
local items = {} --Table containing all item info
local function AddItem(name, price, OnBuy) --Used to add a item to the shop
table.insert(items, {name = name, price =price, OnBuy = OnBuy})
end
local function AddItemWeapon(weapon, price) --Used to add a weapon to the shop
AddItem(itemtype(weapon, "name"), price, function(id)
parse('equip '..id..' '..weapon)
parse('setweapon '..id..' '..weapon)
end)
end
--Add items here----------------------------------------------------------------------------------------------------------------------
--Page 1
AddItemWeapon(91, 150) --FN F2000
AddItemWeapon(47, 300) --RPG
AddItemWeapon(88, 400) --Portal gun
AddItemWeapon(45, 500) --Laser
AddItemWeapon(49, 500) --Grenade Launcher
AddItemWeapon(90, 450) --M134
--Page 2
AddItem("White glow", 10, function(id)
local glow = image("gfx/sprites/flare2.bmp", 0, 0, 100+id)
imagecolor(glow, 255, 255, 200)
imagescale(glow, 0.7, 0.7)
imageblend(glow, 1)
imagealpha(glow, 0.5)
end)
AddItem("Red glow", 10, function(id)
local glow = image("gfx/sprites/flare2.bmp", 0, 0, 100+id)
imagecolor(glow, 255, 0, 0)
imagescale(glow, 0.7, 0.7)
imageblend(glow, 1)
imagealpha(glow, 0.5)
end)
AddItem("Green glow", 10, function(id)
local glow = image("gfx/sprites/flare2.bmp", 0, 0, 100+id)
imagecolor(glow, 0, 255, 0)
imagescale(glow, 0.7, 0.7)
imageblend(glow, 1)
imagealpha(glow, 0.5)
end)
AddItem("Blue glow", 10, function(id)
local glow = image("gfx/sprites/flare2.bmp", 0, 0, 100+id)
imagecolor(glow, 0, 0, 255)
imagescale(glow, 0.7, 0.7)
imageblend(glow, 1)
imagealpha(glow, 0.5)
end)
AddItem("Face palm", 15, function(id)
local headcrab = image("gfx/hats/22.png<m>", 1, 0, 200+id)
end)
AddItem("Snark hat", 15, function(id)
local headcrab = image("gfx/npc/snark.bmp<m>", 1, 0, 200+id)
imagescale(headcrab, 2, 2)
end)
--Page 3
AddItemWeapon(74, 100) --Wrench
AddItemWeapon(85, 35) --Chainsaw
AddItemWeapon(54, 25) --Flare
AddItemWeapon(69, 30) --Machete
AddItemWeapon(73, 40) --Molotov Cocktail
AddItemWeapon(41, 30) --Tactical Shield
--Page 4
AddItemWeapon(79, 25) --Light Armor
AddItemWeapon(80, 70) --Armor
AddItemWeapon(81, 180) --Heavy Armor
AddItemWeapon(82, 145) --Medic Armor
AddItemWeapon(83, 150) --Super Armor
AddItemWeapon(84, 300) --Stealth Suit
--------------------------------------------------------------------------------------------------------------------------------------
local page = 1
local pages = {}
pages[page] = {}
local pageCheck = 0
for k, v in pairs(items) do --Here I am settings up the pages table so I can easly add items without worring about space in the menu
pageCheck = pageCheck+1
if pageCheck == 7 then
page = page+1
pages[page] = {}
pageCheck = 1
end
table.insert(pages[page], k) --Insert the item index into the page
end
local function GenerateButtonString(item) --I made this so I dont have to type as much over and over
if item then --If item is valid
return item.name.."|"..item.price --Return the button text
else
return "" --Return no button
end
end
local function OpenShopMenu(id) --Used to open the shop
local indexes = pages[playerData[id].page] --Gets a table of the indexes for this page
menu(id, settings.menuTitle..","..GenerateButtonString(items[indexes[1]])..","..GenerateButtonString(items[indexes[2]])..","..GenerateButtonString(items[indexes[3]])..","..GenerateButtonString(items[indexes[4]])..","..GenerateButtonString(items[indexes[5]])..","..GenerateButtonString(items[indexes[6]])..",,"..(pages[playerData[id].page+1] and settings.menuPageNext or "")..","..(pages[playerData[id].page-1] and settings.menuPagePrev or ""))
end
AddCommand(settings.commandShop, OpenShopMenu)
function ShopMenuHook(id, title, button)
if title == settings.menuTitle then --If its my shop menu
local index = pages[playerData[id].page][button] --Index of item
local price = items[index] and items[index].price or nil --Price of item
if button <= 6 then --If one of the 6 buttons is the one pressed then
if playerData[id].points >= price then --If the players money is more than the price then
items[index].OnBuy(id) --Do what the items gives
SetPoints(id, playerData[id].points-price) --Take the players money
else
msg2(id, "©"..settings.noMoneyColor..settings.noMoneyText) --Message if the player dont have enough money
end
end
if button == 8 then --If button is the "Next page" button
playerData[id].page = playerData[id].page+1 --Increment the page number for that player
OpenShopMenu(id) --And open the menu agian with the new page
elseif button == 9 then --If button is the "Prev page" button
playerData[id].page = playerData[id].page-1 --Decrement the page number for that player
OpenShopMenu(id) --And open the menu agian with the new page
end
end
end
addhook("menu", "ShopMenuHook")
function AddPointsTimer() --Used to give all players some free points
local playerList = player(0, "table") --Get all players in a table
for k, v in pairs(playerList) do
if player(v, "bot") == false then
SetPoints(v, playerData[v].points+settings.freePointsAmount) --Give all existing players some points
end
end
end
timer(settings.freePointsTime*1000, "AddPointsTimer", "", 0) --Infinite timer
----------------------------
Please edit, and !shop message not appear
I'm not script maker
so idk about anything but i like lua scripting