Jump to content

churchill

Members
  • Posts

    129
  • Joined

  • Last visited

Everything posted by churchill

  1. great stuff! now finish that banking resource!
  2. from string to number: local iValue = tonumber(string) from number to string: local sValue = tostring(iValue)
  3. seems like a wasteful reason to use a timer. There's no real problem with it arriving instantly, surely? Not to mention that it probably wouldn't be instant due to server lag etc?
  4. I'm pretty sure that the GUI can improved to make it look nice with the text display. Seriously, it's the way to do it. Any other way would just pale in comparison! I may have to take the code as it is and work on it myself at this rate
  5. Don't know myself without having a good look at the documentation etc and having a play with it. Will have to wait till I get home tonight before I can look at how to do it, but it must be possible. the example looks straight forward enough: myDisplay = textCreateDisplay () -- create a display textDisplayAddObserver ( myDisplay, myPlayer ) -- make it visible to a player myTextItem = textCreateTextItem ( "Hello world!", 0.5, 0.5 ) -- create text item for the display textDisplayAddText ( myDisplay, myTextItem) so for each person on the conference call you add them as an observer, and also allow anything they type into a texbox (a new box rather than the main chat window?), gets sent to the phone chat window (so all participants see it) and is echoed to the main chat window for those who are within a particular range of the player, so that they can overhear some part of the conversation? It sounds simple enough to do...in practice maybe you'll come across some problems implementing it, but I can't tell while at work
  6. This is what you need to display phone conversations. http://development.mtasa.com/index.php? ... ateDisplay creates a new panel for the duration of the phone call. Additionally: * Conference calls - allow multiple players to be added to the phone call/text display. * Additional idea - Anyone within range of a player typing in a phone conversation window, can "overhear" their side of the conversation, as it'll be output to the main chat window with "(speaking on phone) [message here]". good for RPing
  7. Did you try the method I proposed on the previous page, taken from the sample in the wiki, using "(if #result == 0) then" to check if the result is empty? If you did try it but it didn't work, as you're only doing a basic select, did you try changing: local check = executeSQLQuery( "SELECT lastname, firstname FROM player WHERE lastname='"..lastname.."' AND firstname='"..firstname.."'" ) to: local check = executeSQLSelect("player" , "lastname,firstname", "lastname = '" .. lastname .. "' AND firstname = '" .. firstname .. "'") Which technically should create the same sql statement as above, but might be less buggy. Also note that executeSQLSelect is different in that a "false" value means the table failed to execute OR THE TABLE IS EMPTY, as opposed to the executeSQLQuery method, which returns false if the query failed, or an empty table if the result is empty. So, a simple "(if check == false) then" would mean the code only gets done if the table actually has a row. This is exactly what you're after.
  8. I've found the ExecuteSQLQuery command to be buggy, which is what you're attempting to use. Usually I've seen that if you're sticking to the basic SELECT (executeSQLSelect), INSERT, and UPDATE functions then it seems to be stable, but then they really are basic, so anything like JOINs on multiple tables (or even ORDER BYs?) go out the window. if you really need it, and know how to work with MySQL, then it's better in the long run, though if you're doing resources that you plan to release, it becomes a problem for the server owners who will then need mysql etc on their server.
  9. well as I said, in the example in the link i gave you, it shows this: local result = executeSQLQuery("SELECT money FROM players WHERE name=?", playerName) if(#result == 0) then outputConsole("No player named " .. playerName .. " is registered.", thePlayer) else outputConsole("Money amount of player " .. playerName .. " is " .. result[1].money, thePlayer) end so when you've done your result, I'm assuming the "if (#result == 0) then" means if the result has no rows, then show the first message, else, we have a result with rows. so, wrapped with the original code, it'd be more like: local result = executeSQLQuery("SELECT money FROM players WHERE name=?", playerName) if (result == false) then outputDebugString("an error occured while retrieving data") else if(#result == 0) then outputDebugString("No player named " .. playerName .. " is registered.", thePlayer) else outputDebugString("Money amount of player " .. playerName .. " is " .. result[1].money, thePlayer) end end you then need to get the value out of the result and put it in your local table/array.
  10. false only gets returned if the query couldn't execute for some reason. if it's returning a valid sql result but it's an EMPTY result then the result is still a table, just an empty one. http://development.mtasa.com/index.php? ... teSQLQuery seems to have an example on checking if the result is empty or not, so that might help you. In fact, re-reading that makes me wonder if something I tried previously could have been fixed using something I just read about on that page.
  11. ok, so do you now understand about tables, rows and how to do basic sql statements like select [column1],[column2] from where [someColumn] = [somevalue] etc, then it doesn't take much more to understand how the mta sql features work. Note that I'm talking about the built SQLLite db that comes with the server by default and can be accessed by some simplified MTA functions. Note also that the server can only be accessed from the server scripts, not client side. http://development.mtasa.com/index.php? ... _functions All of the functions in here are quite well documented, in that they show you the SQL that they are supposed to execute when you follow the syntax of the functions. So, using your example, if you had a table called customers in your MTA SQL Lite DB already, you could recreate: "SELECT CompanyName, ContactName FROM customers ORDER BY ContactName ASC" as result = executeSQLSelect ( "customers", "CompanyName,ContactName") which as SQL would become: "SELECT CompanyName, ContactName FROM Customers" Note that executeSQLSelect doesn't allow you to do ORDERING from what I can see, but if you're only using SQL Lite for basic storage you might not need to worry about the order things come back in, as you'll more than likely only ever been selecting one row, e.g. result = executeSQLSelect ( "Customers", "CompanyName,ContactName", "ContactName = '" .. somePlayersName .. "'") which becomes: "SELECT CompanyName, ContactName FROM Customers WHERE ContactName = 'whatever the value of somePlayersName was'" Makes sense? It's far easier to explain when you have an idea of WHAT you actually want to store, because then you can begin to understand how to CREATE tables (using executeSQLCreateTable), how to INSERT a row (executeSQLInsert) into those tables, how to UPDATE rows (executeSQLUpdate) on those tables and how DELETE rows (executeSQLDelete) from those tables. Creating and dropping tables while developing your resource is far easier using the SQL Lite Browser which can be found here (http://sourceforge.net/projects/sqlitebrowser/), but if you plan to release it to the public afterwards, creating tables is usually done when the resource first starts (using executeSQLCreateTable), in order to create any tables that are needed by the resource when running on someone's server. Dropping tables (executeSQLDropTable) is rarely used in the resource itself once it's released, unless it has an "uninstall" feature Mostly it's used for dropping your test tables while developing your resource. Note also, that "executeSQLQuery" while more powerful has been known to be buggy as hell. At the point you know you need to use this function, you begin to realise that moving to the MySQL module is a good idea
  12. ignore the idea of SQL in MTA to begin with - read this: http://www.w3schools.com/sql/default.asp (or start from http://www.w3schools.com/sql/sql_intro.asp) read and understand about tables (The concept of SQL tables is a bit different to LUA tables, and the basic commands of SELECT, UPDATE, INSERT and DELETE, etc. If you want to play with some example select statements, they provide you with this page to do a few basic SELECT statements of your own: http://www.w3schools.com/sql/sql_tryit.asp Just to make sure you understand, try their SQL test: http://www.w3schools.com/quiztest/quizt ... ?qtest=SQL If you get a good score on this, then you're ready to move to the next step. This really is only a basic tutorial, there are more advanced ones out there, but this will help you understand the basics of what goes on under the hood when you use the SQL Lite commands in MTA. Eventually when you understand the basic concepts, you can start learning about stuff like relational data, and learn how to link multiple tables together using JOINs, the concept of normalisation and relationships (one to many, many to many, one to one) etc. When you've got to that stage you'll probably outgrow MTA's SQLLite features and move onto using the MTA-MySQL module, but that's a lot further down the line And you can always ask me, or anyone else on here with SQL background if you get stuck or don't understand something.
  13. I think we've established that already
  14. seems a little pointless to have a full browser inside MTA, but I guess being able to make web requests inside MTA would be useful.
  15. Well I'm working on a bit of a big resource atm, so I'm afraid I can't get involved past the idea stage right now, otherwise I'd definitely take up the batton. Hopefully a good scripter out there is bored and fancies working on it. Screenshot looks nice though. From a design perspective, I think someone needs to come up with replacement icons to replace the icons in that current design, as not all of those existing buttons could be used as relevant features in MTA. If it's planned in the right way to begin with, I'm sure the work could be split between a handful of scripters to each take a function of the PDA, rather than one person having to do all of it. As long as everyone is familiar with a common approach, it wouldn't take long to get a fully working resource going. So perhaps the first thing to do would be to plan out exactly what features would be included, and what common system would link them all. E.g. work out the database structure needed to store all of this, any common functions that would be used by all individual features of the resource, and a list of export functions that other resources could use to pass data to the PDA resource, etc. Do all this before you even start scripting the features, and it should a) be nicely designed b) be quick to put together by a handful of scripters.
  16. yeah, I had the same experience. didn't really go looking about much, nobody else on the server aside from one person, who immediately started shooting at me (he was a balla, I was grove st, so I guess it was in character) and once the car was damaged that I'd found parked up outside grove st, there wasn't much else to do from what I could see. I would guess none of the businesses or houses would be cheap enough to buy without earning money first by robbing someone or healing or arrestign someone, and as nobody was on, there wasn't much else I could do, so I left.
  17. It isn't actually that difficult to set up a registration/login system to require a unique account on your server. They can pick whatever nickname they want, but their username would still be unique, when they register on your server. EDIT: but saying that, the feature list is cool. Might give that a play, though the fact that there are many bugs and uncompleted scripts makes me wonder how much of those features I can actually use right now.
  18. But that need to be separately too Because of limited Mails or traffic on a month on a couple servers yes, but that would just be a setting that you can turn on and off in a config for the resource.
  19. Well, in my RL Phone/PDA, that's exactly what happens. I guess the way to do it would be to have one static image for the outter PDA casing, then seperate images for each button such as news, phone, contacts, messages, weather, so that they can be turned on and off depending on your server requirements. So when you click the phone button, all the buttons are replaced with the images of the numerical pad so that you can type a phone number. (or type it manually on the keyboard). now I like that idea Also, with Ace_Gambit's proposed SMTP module that he announced he was working on before, if people have registered an email address on the server then it will be able to email you if you have new messages.
  20. While MySQL would be good, not every server has MySQL, and can be a pain to set up if you don't know what you're doing, so probably better to keep it within SQLLite?
  21. this is a great idea, something I wanted to do myself at some point, but with a couple of key differences. Instead of a "phone" look, how about one of those PDA type phones, like HTC make. Some of those icons would be replaced, but I can imagine it having not just SMS/messaging, but also allow the server owner to add new content to the phone. e.g. say your server has a log of events that happened on the server, you could view it like "news" from the PDA. More space for reading messages would be another bonus, and viewing weather reports on there (which is why my BetterWeather system was designed with export functions so that I could do this one day), maybe a place to write notes and save them etc. The key thing would be that other resources that have info that can be displayed on the phone, could be done so by a calling the resource and passing it stuff to display. So, imagine the above picture but with the following icons, News, Contacts, Messages, Weather, Notes, and any other icons could appear depending on what resources you set up that can send data to the PDA. And the phone number would be kept secret. It's up to the person to give their contact details to another person.
  22. are you saying that their health has dropped from 100 to 50, or that their health is between 50 and 100?
  23. I wonder if it's not worth you teaming up with one of the other numerous RP projects that are in the works? it seems like every week someone is asking for scripters to join their team. what's the point of having 10 RP servers that all do the same thing? and quite simply there aren't that many scripters to go around that many projects, and the potential spread of players across all the servers would mean that every server would just feel empty. So why not team up with others and create a better RP server that everyone will join?
  24. maybe getAccountData deletes accounts as well? e.g before you do getAccountData, check if ( not isGuestAccount ( account ) ) then again? I dunno, I ended up writing the datamanager resource as a replacement for get/set AccountData, not that I've used it myself as I moved onto sql lite and mysql.
  25. reminds me of "I want to encrypt my javascript and dhtml scripts so others don't steal my great effects and stuffs!". There's pretty much nothing that you can do using client side that others won't already know how to achieve themselves with a little tiny bit of work. I wouldn't worry about it. And they can't edit the scripts because it'll re-download them if you do.
×
×
  • Create New...