Jump to content

churchill

Members
  • Posts

    129
  • Joined

  • Last visited

Everything posted by churchill

  1. by loaded I assumed he meant loaded on the server, which is was (other resources were accessing it!) but it wasn't included in my resource, which is a different thing
  2. I had a look at the battlefield resource this afternoon, but couldn't see anything different. Just had a look again tonight, and I figured it out. needed to be added to the meta.xml file in my resource.
  3. yes, that was the first thing I checked. Before I start my resource, helpmanager works fine (shows the Freeroam help), but when I run my resource, I get that error on the line above. if I haven't got the answer by tonight I'll try duplicating it in another resource to see if it is still a problem.
  4. helpTab = call(getResourceFromName("helpmanager"), "addHelpTab",getThisResource(),false) helpMsg = "Initial resource description." if (enabled == "true") then helpMsg = helpMsg .. " if feature has been enabled in config, then you can hit " .. keymap .. " to activate it" end guiCreateMemo ( 0.05, 0.05, 0.9, 0.9,helpMsg,true, helpTab) I'm getting Bad argument @ 'call' on that very first line. I thought it was because originally I'd have been trying to call it from the server side script, but then I realised it would obviously be a client side script, so I moved it. But I still get that error. Because of the error I get the memo appearing attached to nothing (because helpTab is probably nil due to the call failing) and the help window isn't activated when you hit F9, either, so it well and truly screws things up. What am I doing wrong? Do I need to add some permissions or something to a file in order to let my resource use helpmanager?
  5. have you done it yet? hurry! No worries - If you're busy I can do it myself as I'm not working for any servers yet, and it shouldn't take very long as it has pretty simple requirements. Better finish my other resource off first though
  6. Gamesnert: you have a resource that does this? With SQL storage? Export functions etc etc? Are you releasing it? so many questions, but it would save me some work and allow me to work on some other aspects of a game mode
  7. Did this get provided as a release yet? Combined with Ace Gambit's suggestion that it's stored in SQL Lite instead of XML (which I agree with) this would have made for a nice resource until DP3 came out (which will fix the setAccountData, I hope? but even then, if DP3 still stores in XML, this might be better?) I was thinking of writing something similar anyway, so if someone has already done it, that'd save me a lot of time
  8. aha! yes, that'll do it ta for that!
  9. well that's the plan - when the resource starts on the server, load the help.xml file, write a pre-defined string to the value of the node, replacing a %token% with the key defined in my config file. Seems simple enough
  10. I originally included a help.xml file in my about to be released resource, but in it I mention pressing a key that is server-owner definable in an config.xml file that is also included in the resource. So, if i want the help.xml file to display the correct key to press, do I need to make it write the help.xml file on the fly when the resource is first started on the server, or is there some other kind of fancy way of doing it? edit: all sorted - introduced to the joys of the help manager and creating help panels programatically. Much nicer, once you remember to include the helpmanager resource in your meta.xml file
  11. You didn't upset me at all! I'm new to scripting in this environment, and resources that have already been released are some of the only "working" examples of how to put MTA script packages together, e.g. they're useful learning material. Your slrfuel resource interested me as there were two fuel scripts in the resources library, so I was just comparing them to see how they worked. If I remember correctly, your version requires money to get fuel whereas the other version didn't, so in that respect it's a more realistic resource. I'm well aware that the very nature of the scripts means you can tailor them for your own use on your own server, and why you've included the extra functionality in the resource so that it can function on it's own independently, but at the same I wondered if there is a "preferred" way to develop resources, e.g. add all the scripts it needs in order to perform as a solo resource, or, have them dependent on another resource. A good example of the later idealogy would be the "race" gamemode I downloaded a little while a go - at the point of downloading it prompted me to download further resources if I didn't have them already, as they are needed by the resource in order to function. I can imagine your slrfuel resource working in a similar way, given the type of work it's doing to handle finances, and earning money for attacking people.
  12. https://community.multitheftauto.com/index.php?p= ... nts&id=190 Apologies to [uVA]bart for dissecting his work, but I thought it would be a good script upon which to further my education of LUA and MTA scripting. Having looked at the description and scripts in this resource, I realised that there were a number of things in it that would probably cause problems for various server owners, mostly down to things being hardcoded into the script to handle such things as player data, and also additional functions to handle something unrelated to the fuel management system itself. While I can understand the author's reasons for combining them, I wondered what problems it would cause for server owners, if, for example, it didn't have access to the xml files it was looking for. Secondly, I am under the impression that the separate function that handle earning money through attacking players could/should really be a separate resource? The reason I ask is that I wonder how easy it is to create resources that interop cleanly, rather than assuming that a server will have something already present on their machine or that data is stored in a particular way, and allow you to swap out resources that do a similar job for an improved one later down the line? My understanding of the resource concept is that they are similar to classes, in that they perform a particular function, and uses calls to communicate data between them. So, using this resource as an example, would it not be better to move the non-fuel related functions into it's own resource, perhaps even a third resource for the player management aspect, and a fourth resource for the bank account management, and then provide export functions in each so that they can communicate values between each other, but each performs their own functions? For example, when you hit a marker (handled by the fuel resource), it checks to see if the user has the money to pay for it. The resource that handles this check and export function to call could be set in a config file somewhere (probably a server level one rather than resource, as the resources/function names for common tasks would be needed by multiple resources, so it's easier to maintain a list in one place than have to update the config file in multiple resources when you download a new resource to replace an old one). In our example, this might be a resource called slrBank, with a function called "CheckPlayerBalance(thePlayer)". when called from the slrFuel resource, this function could return the balance of the player given back to the slrFuel resource, so that it can check whether a player can afford the fuel. How the slrBank resource stores this data would be up to this resource. All slrFuel needs to know is what resource and function to call in order to get the relevant value. Similarly, our slrPlayer resource might be set up in a way that stores player data for players in an XML file, or in SQLLite. Again we won't know how it's storing the data, we don't care, all we need to know is that we could call a function called GetPlayerData(thePlayer, "attribute") in slrPlayer, and it would return the value of that attribute. The idea being that there would be less problems with conflicting storage methods or resources that are all trying to perform the same function when server owners try to combine different resources? Sorry, this is a bit long winded, but from a best practice point of view, I would love to know the thoughts of the experienced MTA/LUA scripters (or any experienced programmers of any other language for that matter, the concepts I'm getting at will still be familiar )
  13. nah, I reckon he's just been watching pr0n or something for the last 6 months and didn't realise it had been released.
  14. 50p: looking forward to testing that tonight! I'll take your word for it that it all works as you describe Thanks a lot in advance
  15. I've had some success with _G, but not quite there yet. Interestingly, when I added an event handler I can pass _G[sFunctionName] as the function, where sFunctionName is the string name (minus the parentheses, e.g. "myFunction", rather than "myFunction()") of the function I want to call, which itself is in a different .lua file, and that works fine. As a very simple test example, in javascript you can do this: function doTest() { alert('Hello world') } eval("doTest()") but in LUA, I would have hoped that this would do something similar: function doTest() outputChatBox("Hello world") end -- one of these should work? --G["doTest()"] --or without the brackets --_G["doTest"] Can anyone see something obviously wrong with that to make it work, or is it just not possible? yes, I know I've commented out the actual line that calls the function, before anyone suggests that's why it's not working I've also not worked out if it's possible to send arguments through to that function at the same time, e.g. _G[sFunctionName .. "(1000)"] for example, as I couldn't get that to work in my working event handler version, but that's not important. A little more specifically, what I'm trying to achieve right now is do something like this: function SomeFunctionName() if (1==1) then -- would be replaced by some other conditional statements to check a scenario before proceeding. return true else return false end end if (_G["SomeFunctionName"]) then outputChatBox("it's true!") else outputChatBox("it's false!") end Willy: I've not tried your recommendation of tables yet - but that would appear to be sending the entire function in, rather than just a function name, which would probably mean storing the entire function in the xml file? I don't really want to do that!
  16. damn it - I got really excited for a minute as I thought you meant DP3 was out
  17. churchill

    ACL Question

    simple enough - it should be done like this. under the Admin group in the acl, you can add objects that they can access, e.g: I think it has to begin with "resource.", e.g. "resource.WhateverTheResourceIsCalled"?
  18. ok, I'm not sure if this is even possible, just asking the question now so that I have the answer for when I get home from work later... I want to have an xml file, where the elements in the xml file have an attribute, and the value of that attribute is the name of a function in an accompanying .lua file. E.g.: While I'm reading out of the xml file, I would want to create the button and attach an OnClientGUIClick eventhandler and specify the function to be called as the value of OnClick, from the xml file. I'm assuming there would be a problem here because addEventHandler() expects a function, rather than the string name? I think in javascript and some other languages you have the concept of eval() where it does some magic and allows you to do something like this: addEventHandler( "OnClientGUIClick", button, eval(onclickvalue)) Does anyone know of a way to do something similar in LUA?
  19. If you've ever used.. well, any of the most used languages, you're used to being able to call a function "earlier" (line-wise) in the script than you defined it. In LUA it seems like functions aren't registered until the compiler/interpreter reaches the line in which it's declared. Don't reference or call functions until after you've declared them, and you'll be fine. exactly what I was thinking, but it hadn't been mentioned anywhere. I'm sure I've used a language with a similar problem in the past, but I've not come across that problem lately
  20. also, correct me if I'm wrong - but when I tried a script like that last night (minus the comments), it complained about the addEventHandler line, but works fine if you put it below the function. I would assume this is because the function needs to be interpreted first before the handler can reference it? or am I just talking rubbish and something else was probably causing the problem?
  21. heh, depends what kind of help you're after - e.g. general scripting advice related to best practices, or half the script already written for you....
  22. no0b mistake! everyone knows an xml element or attribute can't start with a number! don't worry though, I'm sure I'll make an equally silly mistake somewhere down the line
  23. I saw it mentioned that there's a limit on the number of pickups you can create, but it didn't actually specify a number. That got me wondering what limits there are in MTA DM, such as pickups, radar blips, markers, etc, but I haven't been able to find any info on it. I doubt it's unlimited, so could anyone point me in the right direction?
  24. Well for starters I've seen: SAES (http://flight.vces.net/) Godfather (viewtopic.php?f=87&t=22852) Argonath (http://www.argonathrpg.eu/) to name but 3...are there any others worth looking at or are these the top 3?
  25. I expected that, but I wasn't expecting an RP/RPG gamemode to be available to download, that was just an aside for others who might be interested in a similar list. I'm more than happy to join someone else's server if it has the sort of features that I want, etc, but I've not really found many so far and I don't know what the best features are of each. Basically I want to join one that a) is actively improving, b) has good support, and c) has some cool scripted features that makes it stand out from the rest. I don't want to end up on some n00b testground for his lame scripting skills masquerading as an RPG server if I was gonna do that, I'd write my own n00b scripts
×
×
  • Create New...