slaw
Software Developer
I'm using this command for 3 months now, and from 3 days, its always crashing after use.
global.lua:
Usage: !addon "name
Was somethink changed in sources or? But i updated sources yesterday, becouse i thinked that crashes are caused by this. Now i know its command, but i dont know why. Someone can try it on our server? I have much changes in sources, so it can be my fault.
Code:
dofile("./config.lua")
function onSay(cid, words, param)
allow = getGlobalStorageValue(getPlayerGUID(cid))
if param ~= "" then
env = assert(luasql.mysql())
--con = assert(env:connect(Database", "root", "Passwordhere", "localhost", 3306))
con = assert(env:connect(mysqlDatabase, mysqlUser, mysqlPass, mysqlHost, mysqlPort))
cur = assert(con:execute("SELECT `account_id` FROM `players` WHERE `id` = "..getPlayerGUID(cid)..";"))
row = cur:fetch({}, "a")
curr = assert(con:execute("SELECT `points` FROM `accounts` WHERE `id` = "..row.account_id..";"))
roww = curr:fetch({}, "a")
punkty = tonumber(roww.points)
if allow == -1 or allow <= 2 then
if addons[param] ~= nil then
if points >= addons[param][7] then
if allow == -1 then
allow = 1
end
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have buy addon: "..param..". Today you can buy only: "..2 - allow.." addons.")
assert(con:execute("UPDATE `accounts` SET `points` = `points` - "..addons[param][7].." WHERE `id` =
"..row.account_id..";"))
assert(con:execute("INSERT INTO `player_addons` (`player_id`, `time`, `addon`) VALUES (" ..
getPlayerGUID(cid) .. ", " .. os.time() .. ", '" .. param .. "');"))
setGlobalStorageValue(getPlayerGUID(cid), allow + 1)
doPlayerAddOutfit(cid, addons[param][1], addons[param][2])
doPlayerAddOutfit(cid, addons[param][3], addons[param][4])
--setPlayerStorageValue(cid, addons[param][5], addons[param][6])
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_GREEN)
else
doPlayerSendCancel(cid, "For this addon you need "..addons[param][7].." points")
end
else
doPlayerSendCancel(cid, "Wrong addon name.")
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have bought too much addons today. Try tommorow.")
end
con:close()
env:close()
else
doPlayerSendCancel(cid, "Wrong, you should use: !addon \"name.")
end
--end
end
global.lua:
Code:
addons =
{
citizenbp = {128, 1, 136, 1, 10001, 2, 25},
citizenhat = {128, 2, 136, 2, 10002, 2, 30},
hunterhood = {129, 1, 137, 2, 20002, 2, 90},
huntergloves = {129, 2, 137, 1, 20001, 2, 40},
knightsword = {131, 1, 139, 1, 30001, 2, 60},
knighthelmet = {131, 2, 139, 2, 30002, 2, 75}
}
Usage: !addon "name
Was somethink changed in sources or? But i updated sources yesterday, becouse i thinked that crashes are caused by this. Now i know its command, but i dont know why. Someone can try it on our server? I have much changes in sources, so it can be my fault.
Last edited: