Jump to content

lolek123

Members
  • Posts

    17
  • Joined

  • Last visited

Posts posted by lolek123

  1. addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), 
    function() 
        txd = engineLoadTXD ( "data/Velociraptor/velociraptor.txd" ) 
        engineImportTXD ( txd, 1 ) 
        dff = engineLoadDFF ( "data/Velociraptor/velociraptor.dff" ) 
        engineReplaceModel ( dff, 1 ) 
        txd2 = engineLoadTXD ( "data/Tyrannosaurus/tyrannosaurus.txd" ) 
        engineImportTXD ( txd2, 2 ) 
        dff2 = engineLoadDFF ( "data/Tyrannosaurus/tyrannosaurus.dff" ) 
        engineReplaceModel ( dff2, 2 ) 
    end) 
      
      
    addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), 
    function() 
        ped1 = createPed ( 1, 2471, -1655, 14, 90 ) 
        ped2 = createPed ( 2, 2471, -1658, 14, 90 ) 
        ped3 = createPed ( 1, 2471, -1661, 14, 90 ) 
        ped4 = createPed ( 1, 2471, -1664, 14, 90 ) 
        ped5 = createPed ( 1, 2471, -1667, 14, 90 ) 
        setPedAnimation( ped1, "FAT", "FatSprint") 
        setPedAnimation( ped2, "FAT", "FatWalk", 0, true, true ) 
    end) 
      
    addEventHandler( "onClientRender", , smooth ) 
    function smooth () 
        root = getRootElement() 
        local x, y, z = getElementPosition( ped2 ) 
        setElementPostion( ped2, x + 10, y, z ) 
    end 
    

    Help would be appreciated, thank you. :D

  2. Yo,

    I replaced a ped with a much bigger one. A dinosaur :D

    Now I want to set him an animation. I'm trying to make him walk. My problem is that he takes big steps, but it seems like he's not moving at all. Is there any way that I could speed him up, so I will synchronize the animation with his actual steps?

    Thanks.

  3. addEventHandler( 'onClientResourceStart', resourceRoot, 
        function( pRes ) 
            for i,v in ipairs( getElementsByType( 'object' ) ) do 
                if( getElementModel( v ) == 2916 ) then 
                    local iX, iY, iZ = getElementPosition( v ) 
                    local iInt = getElementInterior( v ) 
                    local iDim = getElementDimension( v ) 
                    myMarker = createMarker( iX, iY, iZ, 'cylinder', 2.0, 255, 0, 0, 125 ) 
                    setElementInterior( myMarker, iInt ) 
                    setElementDimension( myMarker, iDim ) 
                end 
            end 
        end 
    ) 
      
    addCommandHandler( 'train', 
        function( c ) 
            local p = localPlayer 
            if( isElementWithinMarker( p, myMarker ) ) then 
                local iX, iY, iZ = getPedBonePosition( p, 25 ) 
                object = createObject ( 2916, iX, iY, iZ ) 
                attachElements( object, p, iX, iY, iZ ) 
            else 
                outputChatBox( 'Nope.', p ) 
            end 
        end 
    ) 
    

    And if I wanted it to pick up the object that is there on the map, instead of creating a new one, would that be doable?

  4. Client Side:

    function training(localPlayer, command) 
        if (isElementWithinMarker(localPlayer, myMarker) == true) then 
            local x,y,z = getPedBonePosition(localPlayer, 25) 
            attachElements( object(2916), localPlayer, x,y,z) 
        elseif (isElementWithinMarker(localPlayer, myMarker) == false) then 
            outputChatBox("nope", localPlayer) 
        end 
    end 
    addCommandHandler("train", training) 
    

    Server Side:

    function CheckMyObject(res) 
        if res==getThisResource() then 
            for _,object in ipairs(getElementsByType("object")) do 
                if getElementModel(object)==2916 then 
                    local x,y,z=getElementPosition(object) 
                    local int=getElementInterior(object) 
                    local dim=getElementDimension(object) 
                    myMarker = createMarker(x,y,z,"cylinder",2.0,255,0,0,125) 
                    setElementInterior(myMarker,int) 
                    setElementDimension(myMarker,dim)            
                end 
            end 
        end 
    end 
    addEventHandler("onResourceStart",getRootElement(),CheckMyObject) 
    

    I'm getting bad argument error each time I type in the command, can someone tell me if I have to export "myMarker" somehow from script.lua to client.lua or what?

  5. function attachDumb(thePlayer, command) 
        createdDumb = createObject(2916, 0,0,0) 
        bonePos = getPedBonePosition(thePlayer, 25) 
        attachElements(createdDumb, thePlayer, bonePos) 
        setPedAnimation(thePlayer, "gym", "gym_free_pickup") 
    end 
    addCommandHandler("dumb", attachDumb) 
    

    Can you tell me what's wrong with this?

    It shows "attempt to call global 'getPedBonePosition' (a nil value)".

×
×
  • Create New...