Jump to content

tma

Members
  • Posts

    173
  • Joined

  • Last visited

Everything posted by tma

  1. I have to go out shortly - maybe tomorrow. If you;re OK with it, post it somewhere I can download and stick the link in this thread. You're missing the check I make : ... if res == getThisResource() then ... I could do it as you suggest though but I do one or two things in the mod I'm writing when/if other resources start so that's why I'm using "root".
  2. Cheers for that - I had a list with meaningless names. I wrote a quick script to turn it into XML. I also fixed the one missing world (? in the file) and added the Liberty City locations. You can get it here if it's easier to use in XML format. Note : There's no rotation in other than zero and the "id" attribute is my own (for identification).
  3. It won't work - but it'll at least show some text if you remove the two ampersands. As I said before, I've no idea why it's then chopping the text off - I have a help file longer that doesn't. To add : have you tried coding the help in as opposed to an XML file ? Thinking about it, I don't use the help managers auto-load of a "help.xml" file but do it in code instead like : helpTab = call(getResourceFromName("helpmanager"), "addHelpTab", getThisResource(), true) guiCreateMemo ( 0.05, 0.05, 0.9, 0.9,"lots of boring text that nobody ever reads",true, helpTab) Maybe the reader for the XML help is bugged but the manual method isn't ?
  4. A free roam can be as simple as this : 1. Create a new resource folder in your MTA DM game folder (mines D:\MTA San Andreas\server\mods\deathmatch\resources) 2. Create "meta.xml" and put this in it : "Dumb Freeroam" description="Dumb Freeroam" author="TMA" type="gamemode" version="0.1" /> "scoreboard" /> "helpmanager" /> 3. Create "dumb_server.lua" and put this in : addEventHandler('onPlayerJoin',getRootElement(), function() joinHandler(source) end ) addEventHandler('onPlayerWasted',getRootElement(), function() setTimer(joinHandler,5000,1,source) end ) addEventHandler("onResourceStart",getRootElement(), function(res) if res == getThisResource() then for _,player in pairs(getElementsByType("player")) do joinHandler(player) end end end ) function joinHandler(player) fadeCamera(player,true) spawnPlayer(player,math.random(10) * 3,math.random(10) * 3,5) end 4. Refresh / start the resource (the folder name you specified) and that's it - instant freeroam. Admittedly there's nothing in it but then there's no real feature code. What there is are the basics you need to handle : a. onPlayerJoin() : fired when someone connects. I've just called joinHandler() to fade up their camera (so it's not black to them) and spawn them in the middle of the world. b. onPlayerWasted() : fired when a player dies. Simply re-call the joinHandler() in 5 seconds using a timer. The delay allows the floaty camera above your dead body. c. onResourceStart() : fired when resources start. I check it's "mine" (the res == getThisResource()) and if so, again call the joinHandler() function for each player connected. You don't even need to trap this event - I'm only doing so that when the game mode is started and people are connected, the mode does something with them. You don't need to do this - you could just leave them where they are in the world. Edit : scrap that. You DO need this function (in some fashion) for the cases where someone may be dead on mode switch - if you didn't call joinHandler() on mode start for a dead player, they'd never spawn with just the other two event handlers. This is to show you that you don't need much to create a working game mode - what you add is up to you. You can write more code or just start using more 3rd party resources for more features.
  5. It's the two ampersands that stop it showing - take them out and it truncates the text.
  6. If you're using addVehicleUpgrade() for example, it works both client and server side. I imagine if you issue it client-side, your car will be upgraded for you to see but no-one else. Try changing your code so that the calls to addVehicleUpgrade() etc. are made server-side which will sync the vehicle mod across all clients.
  7. Have you looked at one of the simpler game modes to see what they do ? Hay/Fallout are good examples and should get you started.
  8. You know that doesn't encourage people ? Anyhow, you've got a weird issue. The two "&" (ampersands) in the document are screwing it up ... partially. If you take them out it works (for me), but cuts off after a chunk of text (1000 char limit ?). I don't know why it does that - the help file I have in my gamemode is way longer than yours (matron).
  9. You don't have to send the update constantly to avoid the sticky chat icon. I've done a chat icon display thing and it works fine as I suggested - only send the state to the server when it's changed - Mr.Hankey's code is what you're after. I have this running on a timer in the client : function tuOverlayChatCheck() -- Only inform the server if we're changing chat state (reduce bandwidth) local chatState = isChatBoxInputActive() or isConsoleActive() if chatState ~= gChatting then gChatting = chatState triggerServerEvent("tuOverlayChatUpdate",gMe,chatState) end end Remember that 99% of the data pulses sent by the original code is redundant - there is no state change for the client chat for the vast majority of the time.
  10. It could be because of this : function chatCheckPulse() if( isChatBoxInputActive() ) then triggerServerEvent("playerChatting", getLocalPlayer()) else triggerServerEvent("playerNotChatting", getLocalPlayer()) end setTimer( chatCheckPulse, 500, 1) end Twice a second all players send data to the server to inform it of their chat status. This is wrong - it really needs to only send data when a change of chat state happens. Edit : it's odd that it increases your bandwidth useage so much but I may be wrong. Either way, that code does not need to send the state twice a second.
  11. tma

    PRS/PGS by Scooby

    He wants your code ?
  12. Because the players position isn't necessarily the camera's position. Hence, what you see isn't always what you're near.
  13. I'm having trouble comprehending what you're not getting here. There's no "script" because it's a two liner. You're right, it's a PITA to type hex in a chat string so find another solution. How about a simple string substitution like : ... message = string.gsub(message,"@1","#FF0000") ... So "@1" becomes "#FF0000" (red) or similar.
  14. Could you point me in the right direction ? =) I thought I was ? AFAIK, part of what you wanted was to convert numerics to strings (for the coloured text). If so, string.format() is an easy way of doing this.
  15. outputDebugString(string.format("%02x",69)) Doesn't take much to convert numbers to hex if that's what you're wanting to script.
  16. It's not that - your code is the same in that respect. I don't think it matters where the cancelEvent() occurs in the "if" block. The problem probably lies in : function setData() players = getElementsByType("player") setElementData(players, "colR", 0) setElementData(players, "colG", 0) setElementData(players, "colB", 0) end I think this needs to be a loop - I don't think you can set data for all players at once.
  17. tma

    HELP!!

    In your client code somewhere (onClientResourceStart() is OK), have something like : helpTab = call(getResourceFromName("helpmanager"), "addHelpTab", getThisResource(), true) guiCreateMemo ( 0.05, 0.05, 0.9, 0.9,"YOUR HELP TEXT GOES HERE",true, helpTab)
  18. You just need that line in some client-executed code - where is up to you.
  19. It's client-only like : setPlayerCanBeKnockedOffBike(getLocalPlayer(),false)
  20. The example above handles attached objects - if you not using attached object this will suffice : addEventHandler("onVehicleExplode",getRootElement(), function() destroyElement(source) end ) Have you also set the vehicle respawn info when you make the vehicle ? Look at toggleVehicleRespawn().
  21. Well this is your first real-world coding lesson then : don't claim other peoples code as your own if you're only modifying it - especially with such a minor mod as you've made. You'll only put others off releasing code and in the long run (short in this case), you'll be found out.
  22. tma

    math.sin + math.cos

    It's basic trig - how to rotate a point round any other. In the ramp examples the origin is set to the vehicle/player and the remote object becomes the "point" to be rotated.
  23. So when's it coming out of beta ?
  24. Has anyone got this working ? I've tried everything but I can't make this nick change event fire e.g. no text from this is ever displayed : function nickChange(oldnick,newnick) outputDebugString("NICK CHANGE!") end addEventHandler("onClientChangeNick", getRootElement(), nickChange )
  25. Having looked at his code (tdma_core.lua), he's doing as I suggested above but every second. So the code now becomes : function setWorldClock() setTime(12,0) end setTimer(setWorldClock,1000,0) All server side. Given the timer's on a second interval and client ping, doesn't this flip the time display slightly ? e.g. in this case betweem 12.00 and 12.01 ? (I've never tried TDM)
×
×
  • Create New...