50p Posted May 27, 2008 Author Share Posted May 27, 2008 Do you know how did you make it happen? I've tried many times and hasn't happened to me. What did you step by step? Did you just connect to the server and tried to log in? Was the resource running at the time you joined the servere or did you login as an admin, started bank resource and then tried to log in? I can't figure it out. Link to comment
Guest Posted May 27, 2008 Share Posted May 27, 2008 ok it happens wether loging in as admin or user. the resource has been started at boot of server. the error os there from first login on. I did delete the directory and reinstall it. im going to see if that fixes it. but after I notice the error if I restart the resource al users currently logged in are put in the database which aparently gets recreated when the resource restarts. cause it says creating DB. after that any user that joins causes the same error but the ones on during the restart are fine... Ok here is the deal everytime you make an update aparently the entire thing must be deleted when you add the new version? thats what caused the bug. cause now its gone. what I did was copy over the old version. so the bug was totally my fault but now we know why so I fixed it without knowing it by wiping out the bank and unzipping it again. Link to comment
50p Posted May 27, 2008 Author Share Posted May 27, 2008 ok it happens wether loging in as admin or user. the resource has been started at boot of server. the error os there from first login on. I did delete the directory and reinstall it. im going to see if that fixes it. but after I notice the error if I restart the resource al users currently logged in are put in the database which aparently gets recreated when the resource restarts. cause it says creating DB. after that any user that joins causes the same error but the ones on during the restart are fine... Ok here is the deal everytime you make an update aparently the entire thing must be deleted when you add the new version? thats what caused the bug. cause now its gone. what I did was copy over the old version. so the bug was totally my fault but now we know why so I fixed it without knowing it by wiping out the bank and unzipping it again. Ok, I know there were some problems with a few first versions. So if it works I'm glad that some people can fix problems themselves. And again please post any bugs you find or give some ideas on the future versions. Link to comment
Evilman926 Posted May 29, 2008 Share Posted May 29, 2008 Works Great Thank For This Sweet Script Link to comment
DakiLLa Posted June 10, 2008 Share Posted June 10, 2008 Error on 164 line when i stay at the my created bank-marker without interior elseif marker == banksInfo[ k ].entrance.marker then --attempt to index field 'entrance' (a nil value)-- Link to comment
Scarface Posted September 1, 2008 Share Posted September 1, 2008 ERROR: Database query failed: no such table: bank_accounts (SELECT username FROM bank_accounts WHERE username = 'scarface' LIMIT 1) ERROR: Database query failed: no such table: bank_accounts (SELECT balance FROM bank_accounts WHERE username = 'scarface' LIMIT 1) ERROR: Database query failed: no such table: bank_accounts (INSERT INTO bank_accounts VALUES ( 'scarface', '0' )) i get this all the time what am i suppost to do? Link to comment
Gamesnert Posted September 1, 2008 Share Posted September 1, 2008 ERROR: Database query failed: no such table: bank_accounts (SELECT username FROM bank_accounts WHERE username = 'scarface' LIMIT 1)ERROR: Database query failed: no such table: bank_accounts (SELECT balance FROM bank_accounts WHERE username = 'scarface' LIMIT 1) ERROR: Database query failed: no such table: bank_accounts (INSERT INTO bank_accounts VALUES ( 'scarface', '0' )) i get this all the time what am i suppost to do? Line 14 in "bank.script.server.lua", there it's created at resource start. So it's pretty weird. If it doesn't work at all, I'm afraid you'll have to make your own system with MySQL. (since the SQL part may be broken...) If that'd be the case, I have a few links for you: MTA MySQL Module download+instructions MTA MySQL commands MySQL tutorial And yes it finally works for me. Forgot to include the module line... Anyway, really easy, and quite fast. Also works a bit better. PM me if you have some trouble with it. Link to comment
churchill Posted September 1, 2008 Share Posted September 1, 2008 I ran this resource just the other day and it worked fine for me. sounds like for some reason the tables haven't been created when the resource starts. if anyone knows why that might happen then that might solve the problem. you could confirm they don't exist by getting the SQLLite browser and viewing the registry.db to see if the tables exist. Link to comment
Gamesnert Posted September 1, 2008 Share Posted September 1, 2008 I ran this resource just the other day and it worked fine for me. sounds like for some reason the tables haven't been created when the resource starts. if anyone knows why that might happen then that might solve the problem. you could confirm they don't exist by getting the SQLLite browser and viewing the registry.db to see if the tables exist. Hmmm... And can you create it if not with that application? That should fix it I guess. Link to comment
Scarface Posted September 2, 2008 Share Posted September 2, 2008 i need an updated mirror for the mysql download cause its not working Link to comment
churchill Posted September 2, 2008 Share Posted September 2, 2008 i need an updated mirror for the mysql download cause its not working there's an attachment in this thread viewtopic.php?f=91&t=23490, but unless you have a real need to switch to mysql, you're probably better off just doing what gamesnert suggested and creating the table structures yourself using the sqllite browser, otherwise you're going to need to make a lot of changes to make this banking system work with mysql. Not to mention having to download and host a MySQL db server(or get a webhost with mysql) and getting that all configured. Link to comment
Gamesnert Posted September 2, 2008 Share Posted September 2, 2008 i need an updated mirror for the mysql download cause its not working there's an attachment in this thread viewtopic.php?f=91&t=23490, but unless you have a real need to switch to mysql, you're probably better off just doing what gamesnert suggested and creating the table structures yourself using the sqllite browser, otherwise you're going to need to make a lot of changes to make this banking system work with mysql. Not to mention having to download and host a MySQL db server(or get a webhost with mysql) and getting that all configured. For that you just need to download EasyPHP. Just too easy! Link to comment
churchill Posted September 2, 2008 Share Posted September 2, 2008 i need an updated mirror for the mysql download cause its not working there's an attachment in this thread viewtopic.php?f=91&t=23490, but unless you have a real need to switch to mysql, you're probably better off just doing what gamesnert suggested and creating the table structures yourself using the sqllite browser, otherwise you're going to need to make a lot of changes to make this banking system work with mysql. Not to mention having to download and host a MySQL db server(or get a webhost with mysql) and getting that all configured. For that you just need to download EasyPHP. Just too easy! But do they really need all that just to do MySQL stuff locally? the MySQL for windows package that you can get from the mysql site does all you would need as it has a windows based sql query browser, etc. Unless they plan to take advantage of PHP and do web based interfaces for the server, I don't see the point in getting EasyPHP. and I still maintain, unless Scarface knows what they're doing, switching from SqlLite to MySQL is going to be more trouble than it's worth just to get this resource working Link to comment
Gamesnert Posted September 2, 2008 Share Posted September 2, 2008 But do they really need all that just to do MySQL stuff locally? the MySQL for windows package that you can get from the mysql site does all you would need as it has a windows based sql query browser, etc. Unless they plan to take advantage of PHP and do web based interfaces for the server, I don't see the point in getting EasyPHP. and I still maintain, unless Scarface knows what they're doing, switching from SqlLite to MySQL is going to be more trouble than it's worth just to get this resource working Ehm... I don't know if MTAMySQL works on external things... =/ And I indeed think that just adding a table might be a lot faster. But this was a secondary option, if he would REALLY want this to work and that didn't work. Link to comment
50p Posted September 2, 2008 Author Share Posted September 2, 2008 There will be an update soon which will include: - exported functions: getBankID getBankPosition getBankMarkers getBankMarker getBankEntranceMarker getBankExitMarker getBankName setBankName countBanks getBankAccountBalance setBankAccountBalance getPlayersInBank getPlayerBank isPlayerInBank - simple example resource which shows how to use exported functions (just in case if somebody doesn't know how to use them) If you have ideas on new functions just post them here and I'll think of implementing them. Link to comment
Scarface Posted September 2, 2008 Share Posted September 2, 2008 seriously i cant understand a thing what you guys are talking about, i guess i will take me a while how to figure out on how to make this work Link to comment
Gamesnert Posted September 2, 2008 Share Posted September 2, 2008 There will be an update soon which will include:- exported functions: getBankID getBankPosition getBankMarkers getBankMarker getBankEntranceMarker getBankExitMarker getBankName setBankName countBanks getBankAccountBalance setBankAccountBalance getPlayersInBank getPlayerBank isPlayerInBank - simple example resource which shows how to use exported functions (just in case if somebody doesn't know how to use them) If you have ideas on new functions just post them here and I'll think of implementing them. Cool! Anyway: seriously i cant understand a thing what you guys are talking about, i guess i will take me a while how to figure out on how to make this work Churchill said something about a SQLite browser. With that, it seems that you can CREATE a table. So if the table doesn't exist, you can create it with the browser: I ran this resource just the other day and it worked fine for me. sounds like for some reason the tables haven't been created when the resource starts. if anyone knows why that might happen then that might solve the problem. you could confirm they don't exist by getting the SQLLite browser and viewing the registry.db to see if the tables exist. So look for an SQLite browser, search for an "registry.db" file somewhere in the MTA San Andreas directory, and open it. Then, create table "bank_accounts". That SHOULD work. Link to comment
churchill Posted September 2, 2008 Share Posted September 2, 2008 There will be an update soon which will include:- exported functions: getBankID getBankPosition getBankMarkers getBankMarker getBankEntranceMarker getBankExitMarker getBankName setBankName countBanks getBankAccountBalance setBankAccountBalance getPlayersInBank getPlayerBank isPlayerInBank - simple example resource which shows how to use exported functions (just in case if somebody doesn't know how to use them) If you have ideas on new functions just post them here and I'll think of implementing them. Aha! your silence had me worried! glad you posted this! I was about to start work on my own version tonight but you may have saved me the trouble. To re-iterate what I'd suggested previously, would be nice to have withdrawAmount(playerid, amount) and depositAmount(playerid, amount) functions, so that the longer winded setBankAccountBalance(playerid, amount) = getBankAccountBalance(playerid, amount) +/- someAmount, becomes simply withdraw/depositAmount(playerid, amount). Let the internal workings of the banking system do the work Another fine addition would be to include cash machines if possible, that you can place near train stations, airports, or certain stores. (I can just imagine people RPing as Bums/beggars and sitting near ATMs waiting for people to show up). I guess these would be withdrawal only. The other thing I'm looking for (and was about to work on tonight) was the other feature I suggested (though I've revised it a little since then) so that you can customise which db and which tables/columns the data is stored to, rather than hardcoding table/column references. I've come up with some rather lengthy pseudo code to achieve all that, but probably not worth me posting in here, but if you fancy discussing it I can always show you what I've come up with. Link to comment
Scarface Posted September 2, 2008 Share Posted September 2, 2008 There will be an update soon which will include:- exported functions: getBankID getBankPosition getBankMarkers getBankMarker getBankEntranceMarker getBankExitMarker getBankName setBankName countBanks getBankAccountBalance setBankAccountBalance getPlayersInBank getPlayerBank isPlayerInBank - simple example resource which shows how to use exported functions (just in case if somebody doesn't know how to use them) If you have ideas on new functions just post them here and I'll think of implementing them. Aha! your silence had me worried! glad you posted this! I was about to start work on my own version tonight but you may have saved me the trouble. To re-iterate what I'd suggested previously, would be nice to have withdrawAmount(playerid, amount) and depositAmount(playerid, amount) functions, so that the longer winded setBankAccountBalance(playerid, amount) = getBankAccountBalance(playerid, amount) +/- someAmount, becomes simply withdraw/depositAmount(playerid, amount). Let the internal workings of the banking system do the work Another fine addition would be to include cash machines if possible, that you can place near train stations, airports, or certain stores. (I can just imagine people RPing as Bums/beggars and sitting near ATMs waiting for people to show up). I guess these would be withdrawal only. The other thing I'm looking for (and was about to work on tonight) was the other feature I suggested (though I've revised it a little since then) so that you can customise which db and which tables/columns the data is stored to, rather than hardcoding table/column references. I've come up with some rather lengthy pseudo code to achieve all that, but probably not worth me posting in here, but if you fancy discussing it I can always show you what I've come up with. about the atm thing they have done it on SAES, well obviously they had professional help from the members of the mta team on theirs ok gamesnert i found the sqlite3.dll so know what, what do i use to open it? Link to comment
churchill Posted September 2, 2008 Share Posted September 2, 2008 nah, ignore that sqllite3.dll SQL Lite Browser is here (assuming you have windows) http://sourceforge.net/project/download ... p&18279089 download that, run it, and then open the registry.db file in your mods/deathmatch folder, I think it is? you can then browse the DB. Link to comment
Scarface Posted September 2, 2008 Share Posted September 2, 2008 nah, ignore that sqllite3.dllSQL Lite Browser is here (assuming you have windows) http://sourceforge.net/project/download ... p&18279089 download that, run it, and then open the registry.db file in your mods/deathmatch folder, I think it is? you can then browse the DB. ok its done, i opened registry.db, now what? Link to comment
50p Posted September 3, 2008 Author Share Posted September 3, 2008 To re-iterate what I'd suggested previously, would be nice to have withdrawAmount(playerid, amount) and depositAmount(playerid, amount) functions, so that the longer winded setBankAccountBalance(playerid, amount) = getBankAccountBalance(playerid, amount) +/- someAmount, becomes simply withdraw/depositAmount(playerid, amount). Let the internal workings of the banking system do the work I'll surelly add them. Another fine addition would be to include cash machines if possible, that you can place near train stations, airports, or certain stores. (I can just imagine people RPing as Bums/beggars and sitting near ATMs waiting for people to show up). I guess these would be withdrawal only. I've added ATM thingy to the bank locations file, so you can specify if you want it to be ATM or a bank. Take a look here: http://y50p.50g.com/images/mtasa/mta-screen0051.jpg The other thing I'm looking for (and was about to work on tonight) was the other feature I suggested (though I've revised it a little since then) so that you can customise which db and which tables/columns the data is stored to, rather than hardcoding table/column references. I've come up with some rather lengthy pseudo code to achieve all that, but probably not worth me posting in here, but if you fancy discussing it I can always show you what I've come up with. I'll think about it... but I don't use MySQL (as a few of you discussed here) and I don't choose db. Anyway, I'll think of an additional parameter for those functions that set/get bank balance. scareface1994, nah, ignore that sqllite3.dllSQL Lite Browser is here (assuming you have windows) http://sourceforge.net/project/download ... p&18279089 download that, run it, and then open the registry.db file in your mods/deathmatch folder, I think it is? you can then browse the DB. ok its done, i opened registry.db, now what? So look for an SQLite browser, search for an "registry.db" file somewhere in the MTA San Andreas directory, and open it. Then, create table "bank_accounts". Open that file (registry.db) and create a table, name it "bank_accounts" (if somehow it's not there) and add 2 fields (columns), name them: username (type of field: TEXT) and balance (type of field: NUMERIC) Link to comment
churchill Posted September 3, 2008 Share Posted September 3, 2008 great news on the ATMs and additional export functions The other thing I'm looking for (and was about to work on tonight) was the other feature I suggested (though I've revised it a little since then) so that you can customise which db and which tables/columns the data is stored to, rather than hardcoding table/column references. I've come up with some rather lengthy pseudo code to achieve all that, but probably not worth me posting in here, but if you fancy discussing it I can always show you what I've come up with. I'll think about it... but I don't use MySQL (as a few of you discussed here) and I don't choose db. Anyway, I'll think of an additional parameter for those functions that set/get bank balance. This is probably going to be a larger re-write than you would ever consider doing, but this is basically some notes and pseudo code I wrote over lunch at work, for what would have been a banking system I was going to write, before you posted about the update. This was primarily for my own use with my own resources and mysql table structures, but was going to be written in a way that anyone else could use it, either on it's own, or with other resources, or table structures. It's a bit of a mess, as it's just notes rather than actual code, but it might help plan things? XML CONFIG FILE ALONG THE LINES OF: <settings> <!-- <setting name="MySQLConnectionString" value="a mysql connection string" /> --> <setting name="bankingTable" value="players" /> <setting name="bankingColumn" value="balance" /> <setting name="bankingIDColumn" value="username" /> <!-- <setting name="remoteplayerIDFunction" value="resourcename.functioname" /> --> </settings> CLIENT SIDE CODE MIGHT LOOK SOMETHING LIKE THIS: on client side marker hit if playerid is nil if <playerIDfunction> is empty then playerid = getAccountName(getClientAccount(getLocalPlayer())) -- default to using the player account username OpenBankingPanel(playerid) else --call the resource.function specified, which calls an export function in a remote resource and then triggers client event setPlayerIDfromRemoteResource end else OpenBankingPanel(playerid) end end function setPlayerIDfromRemoteResource(remoteplayerid) playerid = remoteplayerid OpenBankingPanel(playerid) end add an event for ("receiveRemotePlayerID", setPlayerIDfromRemoteResource) SERVER CODE MIGHT LOOK LIKE THIS: on (server) resource start if <mysqlconnectionString> is empty then MySQLMode = false else -- verify the mysql connection string is valid, if not show error to server owner and stop the resource. -- else MySQLMode = true end if <balancetable> is empty then _table = "players" else _table = <balancetable> end if if <balancecolumn> is empty then _column = "money" else _column = <balancecolumn> end if if <wherecolumn> is empty then _wherecolumn = "username" else _wherecolumn = <wherecolumn> end -- call function to check table exists if table doesn't exist then create a table named _table with 2 columns, _column and _wherecolumn else -- call function to check column exists if _column doesn't exist then if (not MySQLMode) then -- could be buggy, if this has errors then we would need to display an error to the -- server owner, to add the column manually, or change the balance table to something new to -- create a new table specifically for banking, e.g. <balancetable>ChurchillsBankSystem</balancetable> -- and then restart the resource. use ExecuteSQLQuery to add _column to _table else use MySQL squery to add _column to _table end end if _wherecolumn doesn't exist then if in SQLLite mode then use ExecuteSQLQuery to add _wherecolumn to _table else use MySQL squery to add _wherecolumn to _table end end end -- assuming that we've closed any mysql connections if things didn't error upon adding/updating tables/columns, we should now -- have confirmed that we have a sql structure that can store and retrieve bank balances based on a given player id, so the resource -- is ready to be called by other resources. Note that the banking locations code is done client side, but there's no point that working -- unless this resource was able to initialise itself successfully. end -- EXPORT FUNCTIONS -- exported functions can be called from external resources by sending through a unique player ID string. -- when done, trigger a server event back to the remote resource that returns whether the query was successful or not? -- alternatively, the client side banking system for use by the bank location GUIs, will be able to pass a unique "playerid" string, from the variable -- we got, either from the account username by default, or a specified remote resource's own getPlayerID export function. function setBalance(playerid, amount) if (MySQLMode) then --do mysql code: if row exists in the table for player id then --"UPDATE " .. _balancetable .. " SET " .. _balancecolumn .. " = " .. amount .. " WHERE " .. _wherecolumn .. " = '" .. playerid .. "'" else do an INSERT query. --"UPDATE " .. _balancetable .. " SET " .. _balancecolumn .. " = " .. amount .. " WHERE " .. _wherecolumn .. " = '" .. playerid .. "'" else end end -- WRAPPER AND HELPER FUNCTIONS THAT KEEP THINGS TIDY, SUCH AS DOING DB CHECKS, OPENING DB CONNECTIONS, ETC Link to comment
Scarface Posted September 3, 2008 Share Posted September 3, 2008 Another fine addition would be to include cash machines if possible, that you can place near train stations, airports, or certain stores. (I can just imagine people RPing as Bums/beggars and sitting near ATMs waiting for people to show up). I guess these would be withdrawal only. I've added ATM thingy to the bank locations file, so you can specify if you want it to be ATM or a bank. Take a look here: http://y50p.50g.com/images/mtasa/mta-screen0051.jpg Great! so when will we be able to use it? Link to comment
Scarface Posted September 3, 2008 Share Posted September 3, 2008 Open that file (registry.db) and create a table, name it "bank_accounts" (if somehow it's not there) and add 2 fields (columns), name them: username (type of field: TEXT) and balance (type of field: NUMERIC) well atleast the table problem is gone but now this ERROR: ...deathmatch/resourcecache/bank/bank.script.server.lua:165: attempt to index field 'entrance' (a nil value) ERROR: ...deathmatch/resourcecache/bank/bank.script.server.lua:165: attempt to index field 'entrance' (a nil value) ERROR: ...deathmatch/resourcecache/bank/bank.script.server.lua:165: attempt to index field 'entrance' (a nil value) ERROR: ...deathmatch/resourcecache/bank/bank.script.server.lua:165: attempt to index field 'entrance' (a nil value) ERROR: ...deathmatch/resourcecache/bank/bank.script.server.lua:165: attempt to index field 'entrance' (a nil value) ERROR: ...deathmatch/resourcecache/bank/bank.script.server.lua:165: attempt to index field 'entrance' (a nil value) ERROR: ...deathmatch/resourcecache/bank/bank.script.server.lua:165: attempt to index field 'entrance' (a nil value) and it doseent save my cash in the bank so every time i enter its 0$ Link to comment
Recommended Posts