Jump to content

churchill

Members
  • Posts

    129
  • Joined

  • Last visited

Everything posted by churchill

  1. well spotted - not that I actually have SPs or Select statements like those - they were just examples! I'm pretty sure the SP wouldn't even get created if you use the one above as it probably has syntax errors in it somewhere.
  2. Well that's what I was hoping, I thought maybe there is another way to call it, but from what i've read, it's a symptom of using the original mysql library, rather than the improved mysqli, so I think I just have to accept it can't be done, or create my own MTA-MySQLi module - and that AIN'T gonna happen
  3. well Machinima is Animations/movies made by people using the 3d Engines/editors/scripting capabilities found in various games etc, so presumably this poster wants to put together a set of tools that will make it easier for people to create their own stories/animations/movies set in the GTA/MTA world. So he wants to put a collection together of ingame scripts/resources that can be used to easily set up and record scenes from various angles, e.g. camera mods, object/map editors to create scenes, etc, and free 3rd party tools for recording the output and editing things together.
  4. Eh... I don't understand what you're saying... =/ Anyway, I use MTA-MySQL, and it works fine. Even select works fine. You might need mysql_fetch_rows perhaps? Ok, I'll explain it another way: This works: MySQLResult mysql_query (handler, "SELECT someColumn FROM someTable WHERE someOtherColumn = " .. someValue) And this works: MySQLResult mysql_query (handler, "INSERT INTO someTable (someColumn, someOtherColumn) VALUES (" .. someValue .. "," .. someOtherValue .. ")") And this also works: MySQLResult mysql_query (handler, "call AddSomething(" .. someValue .. "," .. someOtherValue .. ")") where AddSomething is the name of a Stored Procedure on the MySQL DB server, that does goes something like: CREATE PROCEDURE AddSomething (IN someValue INT, in someOtherValue INT) BEGIN INSERT INTO someTable (someColumn, someOtherColumn) VALUES (someValue, someOtherValue); END However, this does not work: MySQLResult mysql_query (handler, "call GetSomething(" .. someValue .. ")") where GetSomething is an SP like: CREATE PROCEDURE GetSomething(IN someValue INT) BEGIN SELECT someColumn FROM someTable WHERE somOtherColumn = someValue END You get me? I would have expected mySQLResult to still contain a valid sql result, but instead you get an error. In order to understand the question, you need to understand what Stored Procedures are
  5. has anyone tried to call an SP from mta that does a SELECT statement and returns a mysql query result? it works fine with SPs that have INSERTs or UPDATEs, but it seems SELECT statements have to be inline ? I can't remember the error message it gives but it seems like a common problem with php/mysql systems as well, with the answer being to use mysqli instead of mysql, but that's probably not an option here. I've not tested whether you can return OUT parameters so perhaps that could be a solution in some cases?
  6. Kapil's KIHC resource might help with setting up house buying. Worth a look, seems like a few people have used it, but I've not tried it myself.
  7. great news on the ATMs and additional export functions 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
  8. 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.
  9. 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.
  10. nah, this one was something like an AW RPG playground or something.
  11. 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
  12. oh, is this the concrete gaming one? I recognise the psyche thing from that - but didn't really know what to do when I spawned at the airport
  13. Well, by now its out there. The business system is not 100% made and the script is in total BETA phase, but its playable and you can RolePlay in it, and that is the most important part. link! link!!!!!
  14. i agree, it seemed to be pretty good, as was another one I saw the other night... can't remember what it's called now, but if i log in to it again today I'll make sure I update the list above with them as this other one in particular has been the most advanced in terms of it's development that is "live" to the public, so at the moment it seems to be the front runner until the other servers become public
  15. there is a difference between a basic "old fashioned" RP server (which are two a penny right now) which just has the same old (admittedly important) features rehashed, such as house ownership, car ownership, etc, with rules such as "no DMing! DM and be bant!" and scripts that enforce certain limits in world that stop you doing certain things, but you then have to rely on your ability to roleplay in order to make things happen. Whereas what I'm interested in (and seeing a couple of examples of on some various servers that are starting to appear) are more indepth RPG simulations, where there are more "rules" that connect actions with reactions, and don't just rely on human creative thought to pretend it's happening. The scripting language is powerful enough to do some things that haven't yet been fully realised on some servers, such as the features that Misha and Moenski are talking about, and what some of the other servers I mentioned in this thread (viewtopic.php?f=87&t=23195) are looking at doing. It's wrong to suggest they'll just be the same as any other RP server that's already out there, they are a lot more complex than that, and while some people don't like that idea and prefer just to run around DMing, others actually find it more fun than aimless killing. That's their taste and choice of gameplay, and if someone is developing systems that cater for that then I'll join them in saying I can't wait to play them
  16. 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.
  17. 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.
  18. yep, Gamesnert is exactly right. given that you'll be mentioning database connection details and info on stored procedures, or table and column structures in your code, it's not the sort of stuff you'd want to call from the client side.
  19. cheers Ace, just tried the mta-mysql module and that appears to work fine with the same details, so I wonder why that other module isn't quite doing what it's supposed to. Someone has told me though that they've seen the server freeze when doing queries using the mta-mysql module, so I had hoped to test this using the other module to see if it was any better, but I guess it's not to bed.
  20. I'm sure someone told me this but I can't remember who. basically when i try to connect to a mysql server (localhost, running on vista), from my local MTA server, the server crashes. Note that this is using the MySQL module, and not the MTA-MySQL Module, because I couldn't find a working download link for that one. Any ideas on what's going on ? I'm trying to connect using the root user, which I've been able to do via the mysql query browser, but not from MTA. db = mysqlCreate() mysqlOpen (db, "functionToCallonCompletion", "localhost", "root", "[mypassword]", "[mySchemaName]", 3306) I even tried turning on mySql logs to see if I can get info but it doesn't appear to be connecting at all? I wonder if it's due to soem kind of firewall or vista's weird permissions that stops MTA connecting to MySQL and needs something amended to make it work? I wonder if mta-mysql would be any better, but I can't get a working link for that anywhere
  21. Having compared the two, they both do things in some ways that are better than the other, so combining them sounds like a great idea between you, [uVA]Bart, (and me supplying ideas ) I'm sure it'll produce something really good.
  22. I don't know if it's of any use but you could have a look at the code in this resource which is a replacement for the accountData system, with storage switchable between SQL and XML. The XML portion will obviously be of most interest to you. https://community.multitheftauto.com/index.html?p ... ils&id=203
  23. So, I would keep the world weather as server side, but if you enter a colshape that randomly moves across the desert region, it sets the weather on the client side to sandstorm for that user. When they leave the colshape, the weather reverts back to the server weather? Sounds straight forward enough. I'll add it to my to-do list.
  24. there's nothing that can't be fixed - you just need some patience, and some information to work things out. Seriously, login as your admin user on your server, and then type debugscript 3 in the console. you'll get a message to say your debugscript has been set accordingly and then you'll get some nice messages explaining where in your script things are going wrong. if that fails, start adding outputChatBox("someVariable=" .. someVariable) where someVariable is a variable you are using in your code. You do this to a) ensure your code reaches the expected point and b) check that your variable contains the value that you expect, or whether it's returning nil or false.
  25. they'd have to be pretty large colshapes, wouldn't they? but I guess you're right. Are sandstorms predictable, or should they be random events when in the desert?
×
×
  • Create New...