Jump to content

dqlepy

Members
  • Posts

    11
  • Joined

  • Last visited

Posts posted by dqlepy

  1. 4 minutes ago, Addlibs said:

    Reference site also mentions that this function is client-only, with the big red "Client-side function" text on the top-right of the page. This means you cannot use this function in a server-side script. "global.lua" is, I assume, both client and server: the server's debug log is telling you that this function is not defined (i.e. is a nil value).

    okay yea, you replied to my issue, as I was typing.. basically, I realised my mistake, made it main.lua, fixed up the meta.xml, and now, it works with vehicles, but.. it spawns the same vehicle, and the ID's are always the same, plus you cannot enter the vehicle, or damage it..

    spacer.png

    spacer.png

    the cars do not respond to anything, like trying to enter it, damage, nothing, plus it spawns one model only, I'd like to be able to make multiple ID's of singular SA Models, like one ID, lets say, " 401 " and make it so lets say random_IDs = 401, with 401 being bravura, so you can set .txd and .dff to random_IDs, and it changes random_IDs each car to each .txd and .dff files, with 401 being unaffected but, random_IDs being the same SA model as 401.. I hope you get my point.. like make bravura x5, each having their own ID " F.I. 1996, 1997, 1998, 1999, 2000 " and being able to set .dff, .txd to each of them..

  2. local vehicles = {}
    function createAllocatedVehicle( thePlayer, command, objectModel )
        local x, y, z = getElementPosition(thePlayer)
        local id = engineRequestModel("vehicle", 400)
        vehicles[id] = createVehicle(id, x+0.5, y, z+0.5)
        outputChatBox("New vehicle with ID "..id.." created.")
    end
    addCommandHandler("cav", createAllocatedVehicle, false, false)
    
    function skinAllocatedVehicles()
        local txd, dff;
        for id,vehicle in pairs(vehicles) do
            if fileExists("vehicles/" .. id .. ".txd") and fileExists("vehicles/" .. id .. ".dff") then
                txd = engineLoadTXD("vehicles/" .. id .. ".txd")
                engineImportTXD(txd, id)
                dff = engineLoadDFF("vehicles/" .. id .. ".dff")
                engineImportDFF(dff, id)
                outputChatBox("Model ID "..id.." changed correctly.")
            else
                outputChatBox("Model ID "..id.." couldn't change. REASON: vehicles/".. id ..".txd or vehicles/".. id ..".dff does not exist.")
            end
        end
    end
    addCommandHandler("sav", skinAllocatedVehicles, false, false)
    
    function onStop()
        for id,vehicle in pairs(vehicles) do
            engineFreeModel(id)
        end
    end
    addEventHandler("onClientResourceStop", resourceRoot, onStop)

    ERROR: createVehicle\global.lua:4: attempt to call global 'engineRequestModel' (a nil value)

    every time I input cav in chat ( create allocated vehicle ) it spurts out an ERROR, the one above..

    https://wiki.multitheftauto.com/wiki/EngineRequestModel

    reference site, used to make this script, at the top it says " After release 1.5.8 r20716 this function supports "vehicle" and "object" too. " so I tried to recreate it with vehicles, because that's what I need, but it didn't really work out.. Any help appreciated..

  3. Hello,

    I am willing to add multiple mods ( .txd .dff ) for example on a ((BMX SA Model : 481)) and I was wondering, how I could accomplish that, because I know that it is possible, another Latvian server had it, but it is currently inactive, and I am trying to make a project of my own, for me and my friends, so we can have fun on our own, so if anyone could help me get that done, I would be highly grateful.. I heard something about shaders, maybe that’s what they had done, if so, could someone explain, walk me through it, on how I could do that? My discord, just in case.. dqlepy#9090

    Thanks in advance, for any useful help..

  4. 50 minutes ago, AngelAlpha said:
    function updateDX( )
        local health = getElementHealth(localPlayer)
        local armour = getPedArmor(localPlayer)
        local hunger = getElementData(localPlayer, configs['Elements']['Fome']) or 0
        local thirst = getElementData(localPlayer, configs['Elements']['Sede']) or 0
        local stress = getElementData(localPlayer, configs['Elements']['Stress']) or 100
        local radio = getElementData(localPlayer, "ae.frequencia") or 0
    
        local x,y,z = getElementPosition(localPlayer)
        local street = getZoneName ( x, y, z, true )
        local direction = getZoneName ( x, y, z, false )
    
        local time = getRealTime()
        local hours = string.format("%02d:%02d", time.hour, time.minute)
        local minutes = time.minute
    
        if getPedOccupiedVehicle(localPlayer) then
    
            fuel = getElementData(getPedOccupiedVehicle(getLocalPlayer()), configs['Elements']['fuel']) or 0
            speed = ( function( x, y, z ) return math.floor( math.sqrt( x*x + y*y + z*z ) * 155 ) end )( getElementVelocity( getPedOccupiedVehicle(localPlayer) ) ) 
    
    end
    
        SendNUIMessage(browser, { vehicle = vehicle, talking = talking, health = health, armour = armour, thirst = thirst, hunger = hunger, street = street, radio = radio, time = hours, minutes = minutes, direction = direction, voice = voice, speed = speed, fuel = fuel })
    end

     

    Thank you very much, this did everything, fixed everything, now everything works extremely well, and as it's supposed to!

  5. 2 hours ago, AngelAlpha said:
    local time = getRealTime()
    local timeString = string.format("%02d:%02d", time.hour, time.minute)
    
    -- OR
    
    local timeString = os.date ("%H:%M")

    os.date function

    with the code like this..

        local time = getRealTime()
        local hours = time.hour
        local minutes = time.minute
        local timeString = string.format("%02d:%02d", time.hour, time.minute)

    it just says F.I. " 18 "

        local time = getRealTime()
        local hours = ""..time.hour..":"..time.minute
        local minutes = time.minute
        local timeString = string.format("%02d:%02d", time.hour, time.minute)

    but with the code like this, it says F.I. " 18:4 "

    local timeString = os.date ("%H:%M")

    this did also not work.. ^^^

  6.     local time = getRealTime()
        local hours = ""..time.hour..":"..time.minute
        local minutes = time.minute;

    ^^^  - This is an active real-time clock that sits in a box on the top right of the screen, that has zone names depending on player position..

    F.I. - Time = 05:17 // in-game = 5:17

    I need the 0 in front of the time, but only for the first 9 hours..

    I tried this code, but then the whole script doesn't work, and says " undefined " everywhere, I also tried editing, and I can get it to say for instance " 23 " and not the ":" or minutes.

        local time = getRealTime()
        local hours = time.hour
        local minutes = time.minute
    -- checks if hours < 10, sets 0 to front
        if (hours < 10) then
            hours = "0"..time.hour
        end
        if (minutes < 10) then
            minutes = "0"..time.minute
        end

    Full function code, if that helps, with what I need fixed..

    function updateDX( )
        local health = getElementHealth(localPlayer)
        local armour = getPedArmor(localPlayer)
        local hunger = getElementData(localPlayer, configs['Elements']['Fome']) or 0
        local thirst = getElementData(localPlayer, configs['Elements']['Sede']) or 0
        local stress = getElementData(localPlayer, configs['Elements']['Stress']) or 100
        local radio = getElementData(localPlayer, "ae.frequencia") or 0
    
        local x,y,z = getElementPosition(localPlayer)
        local street = getZoneName ( x, y, z, true )
        local direction = getZoneName ( x, y, z, false )
    
        local time = getRealTime()
        local hours = ""..time.hour..":"..time.minute
        local minutes = time.minute
    
        if getPedOccupiedVehicle(localPlayer) then
    
            fuel = getElementData(getPedOccupiedVehicle(getLocalPlayer()), configs['Elements']['fuel']) or 0
            speed = ( function( x, y, z ) return math.floor( math.sqrt( x*x + y*y + z*z ) * 155 ) end )( getElementVelocity( getPedOccupiedVehicle(localPlayer) ) ) 
    
    end
    
        SendNUIMessage(browser, { vehicle = vehicle, talking = talking, health = health, armour = armour, thirst = thirst, hunger = hunger, street = street, radio = radio, time = hours, minutes = minutes, direction = direction, voice = voice, speed = speed, fuel = fuel })
    end

     

  7. 2 hours ago, Tekken said:

    Why can't you place the rectangle down there? Also use math.floor to get a integer out of a float:

    math.floor(97.2371) = 97

    I dont really understand how coordinates work, it took me like 2 hours just to get the " 100% " health window down there, and after that it took me another 40 minutes for the name...  + I dont know how to set the color to change on health for instance for when you are at like 15% health for it to be very redish dark orange..

  8. Hello,

    I am currently working on my roleplay server project, and I am trying to make a very simple resource, a HUD health / name resource, here is what I am trying to exactly replicate :

    https://imgur.com/a/9FxoPEl

    (( this is all there is, health and name in bottom left corner ))

    https://imgur.com/a/c9BZr9l

    (( this is what I currently have made ))

    I have gotten the health and name down there, but I cannot place the dxDrawRectangle there, and when you get damaged it doesn't update, and if you update the resource the health shows for instance.. " 97.23712956% " not.. " 97% "

    I need help replicating that resource..

     

×
×
  • Create New...