Jump to content

BluntZ

Members
  • Posts

    220
  • Joined

  • Last visited

Everything posted by BluntZ

  1. Ask the owner of the gamemode, if did he use ALTER to add / modify a new column to the database. Owner is retired of MTA... Any one else can help me ?
  2. How it can be missed dude ... I downloaded the whole gamemod from community
  3. Database.slua size is 8 KB
  4. I did but still getting database error May you post the error you're getting? It is giving same database query error and I cant register / login / spawn / create group
  5. I did but still getting database error
  6. It will create a file automatically. Still not working guys ... Error : http://prntscr.com/bfduoq db = dbConnect( "sqlite", "file.db" ) Still not working ...
  7. It will create a file automatically. Still not working guys ... Error : http://prntscr.com/bfduoq
  8. Hello guys how to convert this into SQLITE or how to make this GTI database work ? ----------------------------------------->> -- Grand Theft International (gti) -- Author: JT Pennington (JTPenn) -- Date: 01 Dec 2013 -- Resource: gtiaccounts/database.slua -- Version: 2.6 ----------------------------------------->> setGameType("gti:RPG:CnR v2.0") setMapName("gti:RPG:CnR") -- Database Functions ---------------------->> local SERVER_PORT = 22114 -- Only Save Data on Main Server local ipairs = ipairs local type = type local tonumber = tonumber local db = dbConnect("mysql", "dbname=gti;host=88.198.53.218", "gti", " ") dbExec(db, "CREATE TABLE IF NOT EXISTS `accountdata`(`id` INT NOT NULL AUTO_INCREMENT, `name` TEXT, PRIMARY KEY(id))") dbExec(db, "CREATE TABLE IF NOT EXISTS `inventory`(`id` INT NOT NULL AUTO_INCREMENT, `name` TEXT, PRIMARY KEY(id))") local database_online -- Is Database Online? local accountData = {} -- Account Data Cache local inventory_online = {} -- Is Database Online? local inventory = {} -- Account Data Cache addEvent("onDatabaseLoad") -- Triggers when the database is ready addEvent("onAccountDelete") -- Triggers when an account is deleted -- Cache Account Data Database ------------------------------->> addEventHandler("onResourceStart", resourceRoot, function() dbQuery(cacheDatabase, {}, db, "SELECT * FROM `accountdata`") end) function cacheDatabase(qh) local result = dbPoll(qh, 0) accountData["Console"] = {} for i,row in ipairs(result) do accountData[row.name] = {} for column,value in pairs(row) do if (column ~= "name" or column ~= "id") then if (not accountData["Console"][column]) then accountData["Console"][column] = true end if (value == "true") then value = true end if (value == "false") then value = false end accountData[row.name][column] = value end end end database_online = true triggerEvent("onDatabaseLoad", resourceRoot, "accountdata") end -- Cache Inventory Database ---------------------------->> addEventHandler("onResourceStart", resourceRoot, function() for i,player in ipairs(getElementsByType("player")) do local account = getPlayerAccount(player) if (not isGuestAccount(account)) then local account = getAccountName(account) dbQuery(cacheDatabaseByPlayer, {player}, db, "SELECT * FROM `inventory` WHERE `name`=?", account) end end end) addEventHandler("onPlayerLogin", root, function(_, account) if (isGuestAccount(account)) then return false end local account = getAccountName(account) dbQuery(cacheDatabaseByPlayer, {source}, db, "SELECT * FROM `inventory` WHERE `name`=?", account) end) function cacheDatabaseByPlayer(qh, player) if (not inventory["Console"]) then inventory["Console"] = {} end local result = dbPoll(qh, 0) local row = result[1] if (not row) then inventory_online[getAccountName(getPlayerAccount(player))] = true return end inventory[row.name] = {} for column,value in pairs(row) do if (column ~= "name" or column ~= "id") then if (not inventory["Console"][column]) then inventory["Console"][column] = true end if (value == "true") then value = true end if (value == "false") then value = false end inventory[row.name][column] = value end end inventory_online[row.name] = true triggerEvent("onDatabaseLoad", player, "inventory") end addEventHandler("onPlayerQuit", root, function() local account = getPlayerAccount(source) if (isGuestAccount(account)) then return end local account = getAccountName(account) if (inventory[account]) then inventory[account] = nil inventory_online[account] = nil end end) -- Account Exports ------------------->> function SAD(account, key, value) if (not database_online) then return false end if (not account or not key) then return false end if (isGuestAccount(account) or type(key) ~= "string") then return false end local account = getAccountName(account) if (not accountData[account]) then accountData[account] = {} if (getServerPort() == SERVER_PORT) then dbExec(db, "INSERT INTO `accountdata`(name) VALUES(?)", account) end end if (accountData["Console"] and accountData["Console"][key] == nil) then accountData["Console"][key] = true if (getServerPort() == SERVER_PORT) then dbExec(db, "ALTER TABLE `accountdata` ADD `??` text", key) end end accountData[account][key] = value if (getServerPort() == SERVER_PORT) then if (value ~= nil) then dbExec(db, "UPDATE `accountdata` SET `??`=? WHERE name=?", key, tostring(value), account) else dbExec(db, "UPDATE `accountdata` SET `??`=NULL WHERE name=?", key, account) end end return true end function GAD(account, key) if (not database_online) then return nil end if (not account or not key) then return nil end if (isGuestAccount(account) or type(key) ~= "string") then return nil end local account = getAccountName(account) if (accountData[account] == nil) then return nil end if (accountData[account][key] == nil) then return nil end return tonumber(accountData[account][key]) or accountData[account][key] end addEvent("onAccountDelete") addEventHandler("onAccountDelete", root, function(account) dbExec(db, "DELETE FROM `accountdata` WHERE name=?", account) accountData[account] = nil end) -- Inventory Exports --------------------->> function invSet(account, key, value) if (not account or not key) then return false end if (isGuestAccount(account) or type(key) ~= "string") then return false end local account = getAccountName(account) if (not inventory_online[account]) then return false end if (not inventory[account]) then inventory[account] = {} if (getServerPort() == SERVER_PORT) then dbExec(db, "INSERT INTO `inventory`(name) VALUES(?)", account) end end if (inventory["Console"] and inventory["Console"][key] == nil) then inventory["Console"][key] = true if (getServerPort() == SERVER_PORT) then dbExec(db, "ALTER TABLE `inventory` ADD `??` text", key) end end inventory[account][key] = value if (getServerPort() == SERVER_PORT) then if (value ~= nil) then dbExec(db, "UPDATE `inventory` SET `??`=? WHERE name=?", key, tostring(value), account) else dbExec(db, "UPDATE `inventory` SET `??`=NULL WHERE name=?", key, account) end end return true end function invGet(account, key) if (not account or not key) then return nil end if (isGuestAccount(account) or type(key) ~= "string") then return nil end local account = getAccountName(account) if (not inventory_online[account]) then return nil end if (inventory[account] == nil) then return nil end if (inventory[account][key] == nil) then return nil end return tonumber(inventory[account][key]) or inventory[account][key] end addEvent("onAccountDelete") addEventHandler("onAccountDelete", root, function(account) dbExec(db, "DELETE FROM `accountdata` WHERE name=?", account) inventory[account] = nil end) -- Account Deletion -------------------->> function deleteAccount(account, admin) if (not account or isGuestAccount(account) or not admin or not isElement(admin)) then return end triggerEvent("onAccountDelete", resourceRoot, getAccountName(account)) if (wasEventCancelled()) then return end exports.gtilogs:outputAdminLog("ACCOUNTS: Account '"..getAccountName(account).."' has been deleted by "..getPlayerName(admin)..".", admin) removeAccount(account) return true end waiting for your answers
  9. Everything looks fine in code ... Mods are loading or not ?
  10. Post your Meta.xml and SMODS.XML
  11. You are using moddownloader made by Mad ?
  12. They are not compiled. Vehicles App in Phone droid is not working .. ANy help ??
  13. Still getting this error Please someone help http://prntscr.com/a8nix2
  14. still getting error ----------------------------------------->> -- Grand Theft International (GTi) -- Author: JT Pennington (JTPenn) -- Date: 29 Aug 2014 -- Resource: GTIbank/database.slua -- Version: 1.0 ----------------------------------------->> local ipairs = ipairs local type = type local tonumber = tonumber local SERVER_PORT = 22003 -- Only Save Data on Dev Server local db = dbConnect("sqlite", "database.db") dbExec(db, "CREATE TABLE IF NOT EXISTS `banking`(`id` INT PRIMARY KEY AUTOINCREMENT)") local database_online -- Is banking Database Online? local banking = {} -- 'banking' Database Cache addEvent("onDatabaseLoad", true) -- Triggers when gti database is ready addEvent("onLogDatabaseLoad", true) -- Triggers when log database is ready -- Database Cache ------------------>> addEventHandler("onResourceStart", resourceRoot, function() dbQuery(cacheDatabase, db, "SELECT * FROM `banking`") end) function cacheDatabase(qh) local result = dbPoll(qh, 0) banking["Console"] = {} for i,row in ipairs(result) do banking[row.name] = {} for column,value in pairs(row) do if (column ~= "id" or column ~= "name") then banking["Console"][column] = true if (value == "true") then value = true end if (value == "false") then value = false end banking[row.name][column] = value end end end database_online = true triggerEvent("onDatabaseLoad", resourceRoot, "banking") end -- Banking Data Exports ------------------------>> function setBankData(account, key, value) if (not database_online) then return false end if (not account or not key) then return false end if (isGuestAccount(account) or type(key) ~= "string") then return false end local account = getAccountName(account) if (type(banking[account]) ~= "table") then banking[account] = {} if (getServerPort() == SERVER_PORT) then dbExec(db, "INSERT INTO `banking`(name) VALUES(?)", account) end end if (banking["Console"][key] == nil) then if (getServerPort() == SERVER_PORT) then dbExec(db, "ALTER TABLE `banking` ADD `??` text", key) end banking["Console"][key] = true end banking[account][key] = value if (getServerPort() == SERVER_PORT) then if (value ~= nil) then dbExec(db, "UPDATE `banking` SET `??`=? WHERE name=?", key, tostring(value), account) else dbExec(db, "UPDATE `banking` SET `??`=NULL WHERE name=?", key, account) end end return true end function getBankData(account, key) if (not database_online) then return end if (not account or not key) then return end if (isGuestAccount(account) or type(key) ~= "string") then return end local account = getAccountName(account) if (banking[account] == nil) then return end if (banking[account][key] == nil or banking[account][key] == "nil") then return end if (key == "pin" or key == "acc_number") then return banking[account][key] end return tonumber(banking[account][key]) or banking[account][key] end addEvent("onAccountDelete") addEventHandler("onAccountDelete", root, function(account) dbExec(db, "DELETE FROM `banking` WHERE name=?", account) banking[account] = nil end) -- Transaction Log ------------------->> local dbLogs = dbConnect("sqlite", "transaction.db") function addLogToDatabase(category, timestamp, text, cash, balance, player, account) dbExec(dbLogs, "CREATE TABLE IF NOT EXISTS `log_"..category.."`(id INT NOT NULL AUTO_INCREMENT, timestamp INT, text TEXT, cash INT, balance INT, player TEXT, account TEXT, ip TEXT, serial TEXT, PRIMARY KEY(id))") local serial, ip if (isElement(player)) then serial = getPlayerSerial(player) ip = getPlayerIP(player) player = getPlayerName(player) end dbExec(dbLogs, "INSERT INTO `log_"..category.."`(timestamp, text, cash, balance, player, account, ip, serial) VALUES(?, ?, ?, ?, ?, ?, ?, ?)", timestamp, text, cash, balance, player, account, ip, serial) return true end function getAccountLogs(player, account, data_table, recovery) if (not player or not account or not data_table) then return false end if (data_table ~= "bank" and data_table ~= "cash" and data_table ~= "groupbank") then return false end if ( recovery ) then dbQuery(recoveryCallback, {player, data_table}, dbLogs, "SELECT * FROM `log_"..data_table.."` WHERE `account`=? ORDER BY `timestamp` DESC LIMIT 500", account) else dbQuery(returnDatabase, {player, data_table}, dbLogs, "SELECT * FROM `log_"..data_table.."` WHERE `account`=? ORDER BY `timestamp` DESC LIMIT 250", account) end end function returnDatabase(qh, player, data_table) local result = dbPoll(qh, 0) triggerEvent("onLogDatabaseLoad", player, data_table, result) end addEvent("onAccountDelete") addEventHandler("onAccountDelete", root, function(account) dbExec(dbLogs, "DELETE FROM `log_bank` WHERE account=?", account) dbExec(dbLogs, "DELETE FROM `log_cash` WHERE account=?", account) end) function getDatabaseLogs() return dbLogs end Errors Screenshot
  15. yeah when i run that resource then i find error that column 'name' is missing
  16. I did but there is bug in code that "There is no such column 'name' clause etc
  17. ----------------------------------------->> -- Grand Theft International (GTi) -- Author: JT Pennington (JTPenn) -- Date: 29 Aug 2014 -- Resource: GTIbank/database.slua -- Version: 1.0 ----------------------------------------->> local ipairs = ipairs local type = type local tonumber = tonumber local SERVER_PORT = 22003 -- Only Save Data on Dev Server local db = dbConnect("mysql", "dbname=gti;host=127.0.0.1", "GTI", "") dbExec(db, "CREATE TABLE IF NOT EXISTS `banking`(`id` INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id))") local database_online -- Is banking Database Online? local banking = {} -- 'banking' Database Cache addEvent("onDatabaseLoad", true) -- Triggers when gti database is ready addEvent("onLogDatabaseLoad", true) -- Triggers when log database is ready -- Database Cache ------------------>> addEventHandler("onResourceStart", resourceRoot, function() dbQuery(cacheDatabase, db, "SELECT * FROM `banking`") end) function cacheDatabase(qh) local result = dbPoll(qh, 0) banking["Console"] = {} for i,row in ipairs(result) do banking[row.name] = {} for column,value in pairs(row) do if (column ~= "id" or column ~= "name") then banking["Console"][column] = true if (value == "true") then value = true end if (value == "false") then value = false end banking[row.name][column] = value end end end database_online = true triggerEvent("onDatabaseLoad", resourceRoot, "banking") end -- Banking Data Exports ------------------------>> function setBankData(account, key, value) if (not database_online) then return false end if (not account or not key) then return false end if (isGuestAccount(account) or type(key) ~= "string") then return false end local account = getAccountName(account) if (type(banking[account]) ~= "table") then banking[account] = {} if (getServerPort() == SERVER_PORT) then dbExec(db, "INSERT INTO `banking`(name) VALUES(?)", account) end end if (banking["Console"][key] == nil) then if (getServerPort() == SERVER_PORT) then dbExec(db, "ALTER TABLE `banking` ADD `??` text", key) end banking["Console"][key] = true end banking[account][key] = value if (getServerPort() == SERVER_PORT) then if (value ~= nil) then dbExec(db, "UPDATE `banking` SET `??`=? WHERE name=?", key, tostring(value), account) else dbExec(db, "UPDATE `banking` SET `??`=NULL WHERE name=?", key, account) end end return true end function getBankData(account, key) if (not database_online) then return end if (not account or not key) then return end if (isGuestAccount(account) or type(key) ~= "string") then return end local account = getAccountName(account) if (banking[account] == nil) then return end if (banking[account][key] == nil or banking[account][key] == "nil") then return end if (key == "pin" or key == "acc_number") then return banking[account][key] end return tonumber(banking[account][key]) or banking[account][key] end addEvent("onAccountDelete") addEventHandler("onAccountDelete", root, function(account) dbExec(db, "DELETE FROM `banking` WHERE name=?", account) banking[account] = nil end) -- Transaction Log ------------------->> local dbLogs = dbConnect("mysql", "dbname=gti_logs;host=127.0.0.1", "GTILogs", "") function addLogToDatabase(category, timestamp, text, cash, balance, player, account) dbExec(dbLogs, "CREATE TABLE IF NOT EXISTS `log_"..category.."`(id INT NOT NULL AUTO_INCREMENT, timestamp INT, text TEXT, cash INT, balance INT, player TEXT, account TEXT, ip TEXT, serial TEXT, PRIMARY KEY(id))") local serial, ip if (isElement(player)) then serial = getPlayerSerial(player) ip = getPlayerIP(player) player = getPlayerName(player) end dbExec(dbLogs, "INSERT INTO `log_"..category.."`(timestamp, text, cash, balance, player, account, ip, serial) VALUES(?, ?, ?, ?, ?, ?, ?, ?)", timestamp, text, cash, balance, player, account, ip, serial) return true end function getAccountLogs(player, account, data_table, recovery) if (not player or not account or not data_table) then return false end if (data_table ~= "bank" and data_table ~= "cash" and data_table ~= "groupbank") then return false end if ( recovery ) then dbQuery(recoveryCallback, {player, data_table}, dbLogs, "SELECT * FROM `log_"..data_table.."` WHERE `account`=? ORDER BY `timestamp` DESC LIMIT 500", account) else dbQuery(returnDatabase, {player, data_table}, dbLogs, "SELECT * FROM `log_"..data_table.."` WHERE `account`=? ORDER BY `timestamp` DESC LIMIT 250", account) end end function returnDatabase(qh, player, data_table) local result = dbPoll(qh, 0) triggerEvent("onLogDatabaseLoad", player, data_table, result) end addEvent("onAccountDelete") addEventHandler("onAccountDelete", root, function(account) dbExec(dbLogs, "DELETE FROM `log_bank` WHERE account=?", account) dbExec(dbLogs, "DELETE FROM `log_cash` WHERE account=?", account) end) function getDatabaseLogs() return dbLogs end I need help to convert it into SQLITE ... Kindly help , Thanks
  18. Vehicles App in Phone droid is not working .. ANy help ??
  19. Yeh that's what i was saying but tomas said to download it from gtirpg website
  20. What is difference between github scripts and gtirpg.net scripts ?
  21. 1. Add 'resource.*' in an ACL with full rights (Admin, as default) 2. start 'runcode' & type "srun for _, n in ipairs({"Admin1","Admin2", "Admin3", "Admin4", "Admin5", "Dev1", "Dev2, "Dev3", "Dev4", "Dev5", "Event1", "SAHA"}) do aclGroupAddACL(aclCreateGroup(n), aclCreate(n)) end" in console. 3. start 'startup' 4. Enjoy Note: If you want it to work with SQLite you must delete that 'NOT NULL AUTO_INCREMENT' sentence from every database.slua file otherwise it'll spam your debug. Thanks I did same but most of things are not working like Phone droid / Login system / Event system / files missing in PhoneSettingsApp ....
×
×
  • Create New...