Jump to content

Dev

Members
  • Posts

    127
  • Joined

  • Last visited

Posts posted by Dev

  1. Hey there, so I'm basically trying to replace a texture with a .png file I downloaded, I know it's possible as I've seen a number of servers doing it, but I have no clue what to do, the texture I want to replace is a wall and I know dxCreateTexture and dxCreateShader play a part in this, but no idea how to get this going.

    Some guidance please?

  2. Hey there,

    I'm trying to use removeWorldModel server side to remove a desk ( ID: 2198 ) placed in interior 0 & dimension 200. The script is working fine, but it's not removing the object at all. There's no error in /debugscript 3 and I'm running the script in map editor.

    Server Side:

      
    addEventHandler ( 'onResourceStart', resourceRoot, 
        function ( ) 
             
            outputChatBox ( 'Resource working!', getRandomPlayer( ), 0, 255, 0 ) -- Outputs fine. 
            removeWorldModel ( 2198, 20.00, 234.169921875, 122.7529296875, 1003.21875, 0 ) 
        end 
    ) 
      
    

    Meta:

      
    <meta> 
        <min_mta_version server="1.2.0-9.03618" client="1.2.0-9.03618" /> 
         
        <script src='server.lua' type='server'/> 
    </meta> 
      
    

  3. Eh, I need to ask something, how are you getting the results on your browser without using the php echo function? I'm trying to do the same thing, get a return from a .lua file with http as true in the meta export, but nothing seems to be returned to the .php page.

  4. Why are you storing fuel as a string? store it as an integer, and then use the 'tostring' to output it in your directX drawing.

    setTimer( 
        function( ) 
            for i, v in ipairs ( getElementsByType("vehicle") ) do 
                if ( tonumber( getElementData(v, "fuel") ) == 0 ) then 
                    setElementData( v, "fuel", 50, true) 
                    -- outputChatBox( v ) 'v' is a vehicle element, you can't output it to chatbox.. 
                end 
            end 
        end, 500, 0 
    ) 
    

     local fuel = getElementData( getPedOccupiedVehicle(localPlayer), "fuel" ) 
    dxDrawBorderedText("Fuel: ".. tostring( fuel ) .."%", screenWidth*0.750, screenHeight*0.9, screenWidth, screenHeight, tocolor(255, 255, 255), scale, "arial", "left", "center") 
    

  5. We won't give you ready-made scripts here, research on the wiki abit and try to produce your own code, then come here if you need assistance. And yes, you will have to use the onClientPlayerTarget event.

  6. Try this.

      
    addCommandHandler('trailer',  
        function( thePlayer ) 
            if ( thePlayer ) then 
                 
                local x, y, z = getElementPosition( thePlayer ) 
                 
                local truck = createVehicle( 515, 0, 0, 3 ) 
                if ( truck ) then 
                     
                    setElementPosition( truck, x + 5, y, z ) 
                     
                    local trailer = createVehicle( 435, 0, 0, 3 ) 
                    if ( trailer ) then 
                         
                        setElementFrozen( trailer, true ) 
                         
                        local success = attachTrailerToVehicle( truck, trailer) 
                        if ( success ) then 
                             
                            setElementFrozen( trailer, false ) 
                            outputChatBox('Trailer attached to the Truck.', thePlayer ) 
                        end 
                    end 
                end 
            end 
        end 
    )    
                 
      
    

×
×
  • Create New...