Jump to content

laurens

Members
  • Posts

    49
  • Joined

  • Last visited

Posts posted by laurens

  1. New question:

    In a gamemode, like race, certain maps get played. I want to get a message in a difference resource (ie. "monitor") whenever a pickup gets hit. Is this possible?

    I already tried this but it wouldn't respond when I hit a pickup:

    function pickupHit ( player )
      outputChatBox ( "You have picked up a pickup.", player ) --Display this message in the chat box
    end
    addEventHandler ( "onPickupHit", getRootElement(), pickupHit )
    

    Just to make things clear.

    Let say you're playing the map Freeroam in the gamemode Race. There are a lot of pickups there. Now I have a difference resource running (which I call "monitor") and I want to get a notice whenever a pickup gets hit by a player. Is this actually possible?

    Old question:

    How do I get the element ID of the vehicle the player drives? Just a quick question.

  2. Ok, it's been a year ago since I scripted for MTA I guess. I once did something to get the size of an element. I thought it was GetElementBoundingBox. Now I use this to get the size of the element 5422, but it just DOESN'T work. What do I miss so badly for this not to work?

    function minMaxOutput ( theElement )
    local x0, y0, z0, x1, y1, z1 = getElementBoundingBox ( theElement )
    if ( x0 ) then
    outputChatBox ( "The coords are: " .. x0 .. ", " .. y0 .. ", " .. z0 .. ", " .. x1 .. ", " .. y1 .. ", " .. z1 )
    else
    outputChatBox ( "Failed to retrieve bounding box" )
    end
    end
    minMaxOutput ( createObject ( 5422, 5540.6654, 1020.55122, 1240.545, 0, 0, 0 ))
    

    I'm probably making a huge mistake here, but can anyone tell me to get me the data I want?

    PS: The error message says i'm trying to take a global 'getElementBoundingBox' (nil value) or something like that I recall.

  3. You will get this stamp from me:

    LOST INTREST.

    Then why did you come back? You're interested, you're just being a impatient child. Grow up and learn to have patience like the rest of us. You are invaluable, since your attention span is too short to stick around long enough to do anything productive for the community. You didn't even have enough attention to pay to your own terrible spelling. Merry Christmas you mod hopper, go complain on some other mod forums that you are too impatient to wait for. UT has alot of mods, you won't be bored there.

    Be realistic man. Snickers is rather late in losing interest. There have been hundreds of people before him already. A 3 year wait is just rather long, there's no excuse for that.

  4. ah ok i just had an idea because you said that it only appears when somebody dies and than respawns.

    I would suggest using this:

    function player_Wasted ()    setTimer( spawn, 500, 1, source )endaddEventHandler ( "onPlayerWasted", getRootElement(), player_Wasted )

    instead of this:

    function player_Wasted ()    local x = randInt ( startX - 15, startX + 15 )    local y = randInt ( startY - 15, startY - 5 )    setTimer( spawnPlayer, 500, 1, source, 1485.5, 1168.5, 17 )endaddEventHandler ( "onPlayerWasted", getRootElement(), player_Wasted )

    because the coordinates you used in setTimer( spawnPlayer, 500, 1, source, 1485.5, 1168.5, 17 ) are different from the starting coordinates and the local x and local y values above this line are never used.

    Tried it and it doesn't work either :(

    There seems nothing wrong with the coding, so that's why I think it's a bug inside the MTA core.

  5. ah ok i just had an idea because you said that it only appears when somebody dies and than respawns.

    I would suggest using this:

    function player_Wasted () 
        setTimer( spawn, 500, 1, source ) 
    end 
    addEventHandler ( "onPlayerWasted", getRootElement(), player_Wasted ) 
    

    instead of this:

    function player_Wasted () 
        local x = randInt ( startX - 15, startX + 15 ) 
        local y = randInt ( startY - 15, startY - 5 ) 
        setTimer( spawnPlayer, 500, 1, source, 1485.5, 1168.5, 17 ) 
    end 
    addEventHandler ( "onPlayerWasted", getRootElement(), player_Wasted ) 
    

    because the coordinates you used in setTimer( spawnPlayer, 500, 1, source, 1485.5, 1168.5, 17 ) are different from the starting coordinates and the local x and local y values above this line are never used.

    Tried it and it doesn't work either :(

    There seems nothing wrong with the coding, so that's why I think it's a bug inside the MTA core.

  6. Hello MTA community.

    For a few months now, I'm waiting for support. I have fully playable gamemode waiting on my computer to get released. There's only one thing that stops me from releasing it for those months. A spawnbug. I am 100% sure it's a bug since I stripped down the code to the bare minimum it needs to let the bug occur. On mIRC I got promised a few times that they would help me. But I had to ask another time because they were busy. Now, after months, I'm still not helped. This bug has stopped me from creating any more gamemodes for MTA. So this is my very last and desperate attempt: does any of the MTA developers want to help me and at least watch what happens when you spawn?

    I will post a few pictures of the gamemode of mine soon. So hopefully, a few of you might get excited about it.

    3002.png 3003.png 3004.png 3005.png 3006.png

  7. Hello MTA community.

    For a few months now, I'm waiting for support. I have fully playable gamemode waiting on my computer to get released. There's only one thing that stops me from releasing it for those months. A spawnbug. I am 100% sure it's a bug since I stripped down the code to the bare minimum it needs to let the bug occur. On mIRC I got promised a few times that they would help me. But I had to ask another time because they were busy. Now, after months, I'm still not helped. This bug has stopped me from creating any more gamemodes for MTA. So this is my very last and desperate attempt: does any of the MTA developers want to help me and at least watch what happens when you spawn?

    I will post a few pictures of the gamemode of mine soon. So hopefully, a few of you might get excited about it.

    3002.png 3003.png 3004.png 3005.png 3006.png

  8. Looks like an awesome script!

    Maybe it's somehow possible to (pseudo-)synchronize the moving objects by having a timer send the position of the object every few seconds, and to make it go smooth the object should get moved by using the moveObject() function

    I can't seem to find the download link though!

  9. Looks like an awesome script!

    Maybe it's somehow possible to (pseudo-)synchronize the moving objects by having a timer send the position of the object every few seconds, and to make it go smooth the object should get moved by using the moveObject() function

    I can't seem to find the download link though!

  10. Hi.

    I've been scripting for a while and I started my first serious project. A Message Of the Day script.

    It's almost done and now I'm trying to make the script close to perfect, but while doing this I came upon a problem. First I'll explain how the script works:

    My MOTD script exists of a few files containing code, and a XML file containing all user-submitted text.

    The XML has lots of nodes and subnodes and subsubnodes (and so on). For every node a tab get's created with text in it, which can be changed using the script itself.

    But because there's so many nodes, I made a simple loop that will try to find all subnodes from top to bottom in every node and create a tab for it. So the tab are in the same order as the nodes are in the XML. Now I could imagine that an admin would like to make a new tab, and wants it to be as the second tab in the panel. This is where the problem lays: there currently is no way to move a XML node up or down inside it's parent node.

    That's why I came up with the idea for the following function:

    xmlnode xmlMoveNode ( xmlnode NodeToMove, int NewPosition, [ bool relative = false ] )
    xmlnode xmlPlaceNode ( xmlnode NodeToMove, xmlnode NewParentNode, int Position )

    An explanation about what it does isn't needed in my opinion, the above quotes should give you an idea already.

    So what's the possibility of this happening?

  11. I'm currently busy with a MOTD script with tab support. It's not really finished yet because I want to make an ingame editor.

    It could be adapted to your needs. It also has a "Do not show again" option, so once they accept it, they will never get to see it again (unless the rules get updated)

    Stay tuned.

  12. Hi. I've been browsing around on this forum and found out this topic

    It looks very usefull and te results are brilliant. But the current possible ways are rather time consuming. You have to use a excel or web-based script to get the coordinates you want and put them manually in a map.

    I was thinking about making a resource that would do the same for you, but ingame. So it would be possible to show the results in real-time, and save them if the user is happy with the result. It's not really hard to convert the scripts to lua, but I don't know if a lot of people want it. So before I give this convertion a chance, are there any people that are really waiting for this kind of tool?

  13. Hello. I'm here for your help; I'm experiencing this incredibly odd spawnbug in my gamemode.

    Whenever you die, and respawn, the chances are big you will get stuck.

    This is the stripped-down version of the gamemode, where the bug still occurs.

    Server.lua

    local resourceRoot = getResourceRootElement(getThisResource()) 
    local startX 
    local startY 
      
    function spawn ( player ) 
        local x = randInt ( startX - 15, startX + 15 ) 
        local y = randInt ( startY - 15, startY - 5 ) 
        fadeCamera ( player, true )  
        spawnPlayer ( player, x, y, 10.82 ) 
    end 
      
    function spawnAll ()  
        local players = getElementsByType ( "player" ) 
        for Key, player in ipairs( players ) do 
            spawn ( player ) 
        end 
    end 
      
    function placeObjects() 
        createObject ( 3374, 1354, 1270, 11) 
        createObject ( 3374, 1358, 1270, 11) 
        createObject ( 3374, 1362, 1270, 11) 
        createObject ( 3374, 1354, 1274, 11) 
        createMarker (       1358, 1274, 10, "cylinder", 3, 255, 0, 0, 170) 
        createObject ( 3374, 1362, 1274, 11) 
        createObject ( 3374, 1354, 1278, 11) 
        createObject ( 3374, 1358, 1278, 11) 
        createObject ( 3374, 1362, 1278, 11) 
        startX = 1358 
        startY = 1270 
        setTimer ( spawnAll, 500, 1 ) 
    end 
    addEventHandler ( "onResourceStart", resourceRoot, placeObjects ) 
      
    function player_Wasted () 
        local x = randInt ( startX - 15, startX + 15 ) 
        local y = randInt ( startY - 15, startY - 5 ) 
        setTimer( spawnPlayer, 500, 1, source, 1485.5, 1168.5, 17 ) 
    end 
    addEventHandler ( "onPlayerWasted", getRootElement(), player_Wasted ) 
      
    addCommandHandler ( "kill",  
    function ( source )  
        killPlayer ( source ) 
    end 
    ) 
    

    Client.lua

    local invloedveld = 20 
    local allObjects = {} 
    local bufferTimer 
      
    function objectBuffer() 
        allObjects = getElementsByType ( "object" ) 
        local px, py, pz = getElementPosition ( getLocalPlayer() )   
        for Key,Object in ipairs(allObjects) do 
            local ox, oy, oz = getElementPosition ( Object )     
            local relativeX = px - ox 
            local relativeY = py - oy 
            if (relativeX < invloedveld) and (relativeX > -invloedveld) and (relativeY < invloedveld) and (relativeY > -invloedveld) then 
                if ( getElementDimension ( Object ) == 1 ) then 
                    setElementDimension ( Object, 0 )    
                end 
            else 
                if ( getElementDimension ( Object ) == 0 ) then 
                    setElementDimension ( Object, 1 )    
                end 
            end 
        end 
    end 
      
    function startBuffer ( ) 
        objectBuffer() 
        setTimer ( objectBuffer, 3000, 0 ) 
    end 
      
    addEventHandler ( "onClientPlayerSpawn", getLocalPlayer(), startBuffer ) 
    

    I think I can call this a MTA bug, because I did not code it to get stuck like that.

    Does anyone know a work-around to not let this happen, but still keep the functionality of the script?

    Or best of all, can the MTA team take a look at this and tell me the technical details of what happens?

    Thanks in advance.

  14. These 2 functions mallfunction, they will always return a non-valid element pointer which can not be used by other functions.

    It's either these functions, or the functions that need the elements pointer (engineImportTXD and engineReplaceCOL)

    Hopefully these functions get fixed for the next release, because I can't make my gamemode without the custom objects.

  15. I'm fizzling around with loading custom objects, but I found a problem.

    Loading a custom .col file does not work, the .dff works fine though.

    This is my (client code):

    engineReplaceCOL ( engineLoadCOL ( "collision.col"), 3374 ) 
    engineReplaceModel ( engineLoadDFF ( "blokje.dff", 0 ), 3374 ) 
    

    And this is part of the meta.xml:

    <meta> 
        <file src="blokje.dff" /> 
        <file src="collision.col" /> 
    </meta> 
    

    It says that there's a bad COL pointer at line 1.

  16. No thanks, it's not usefull for me (yet)

    I need solid large blocks that don't move to prevend people from passing trough them. I can't tell what it is for yet, because the gamemode isn't hard to make, but it's incredible fun. And I first want to have it on my dedicated server for a while before releasing it to the public.

    But I'll be sure to remember for when I do need it.

  17. I know it's possible to have custom car models. But is it also possible to have a custom object, and if so, how?

    By the way:

    I made a gamemode but it's pretty laggy because I use millions of haybails. Can someone make me a custom object which is 5 units in length, 5 units in height and 7 units in height? Just a plain block. It will be best if they are textureless (to reduce lag) but a brick texture works too. If you decide to make it without texture, please make it brown/orange-ish, not to bright but not to dark either. It must be noticable.

    The faster I get this done, the sooner you people can enjoy my new gamemode!

  18. Thanks, that tip worked!

    I made the eventHandler like this now:

    addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()), 
            function () 
                if (source == closeButton) then 
                    changeVisibility() 
                end 
            end 
            ) 
    

    But I'm still confused about why the window is still resizable.

×
×
  • Create New...