Jump to content

bad Ped pointer


Recommended Posts

Posted

Hi guys,

I have 2 problems,

1. Bad 'ped' pointer @warpPedIntoVehicle

2. The setElementPosition doesn't do what it has too do.

boatMarker = createMarker ( -1734.4, 221.3, 2.5, "cylinder", 3.5, 255, 0, 0, 255 ) 
dft = createVehicle( 578, -1745.1, 212.10001, 4.3, 0, 0, 270 ) 
dftBoat = createVehicle ( 473, -1747.4, 212.10001, 5 ) 
attachElements ( dftBoat, dft ) 
  
function spawnTheBoat ( thePlayer ) 
    if getElementModel ( thePlayer ) == 578 then 
    detachElements ( dftBoat ) 
    setElementPosition (dftBoat, -1723.6, 229.39999, 0, 0, 0, 270) 
    warpPedIntoVehicle ( thePlayer, dftBoat )   
    setElementFrozen ( dft, true ) 
            function unfreezeDft ( thePlayer ) 
                setElementFrozen ( dft, false ) 
                attachElements ( dftBoat, dft ) 
                warpPedIntoVehicle ( thePlayer, dft ) 
            end 
            addCommandHandler ("ready", unfreezeDft) 
    end 
end 
  
addEventHandler ("onMarkerHit", boatMarker, spawnTheBoat) 

Yes this is the full code

"If debugging is the process of removing software bugs, then programming must be the process of putting them in."

Posted

how do you mean is the string "ready"?

changed the function in function;

boatMarker = createMarker ( -1734.4, 221.3, 2.5, "cylinder", 3.5, 255, 0, 0, 255 ) 
dft = createVehicle( 578, -1745.1, 212.10001, 4.3, 0, 0, 270 ) 
dftBoat = createVehicle ( 473, -1747.4, 212.10001, 5 ) 
attachElements ( dftBoat, dft ) 
  
function spawnTheBoat ( thePlayer ) 
    if getElementModel ( thePlayer ) == 578 then 
    detachElements ( dftBoat ) 
    setElementPosition (dftBoat, -1723.6, 229.39999, 0, 0, 0, 270) 
    warpPedIntoVehicle ( thePlayer, dftBoat )   
    setElementFrozen ( dft, true ) 
    end 
end 
  
addEventHandler ("onMarkerHit", boatMarker, spawnTheBoat) 
  
function unfreezeDft ( thePlayer ) 
    setElementFrozen ( dft, false ) 
    attachElements ( dftBoat, dft ) 
    warpPedIntoVehicle ( thePlayer, dft ) 
end 
  
addCommandHandler ("ready", unfreezeDft) 

"If debugging is the process of removing software bugs, then programming must be the process of putting them in."

Posted

so what do I need to too? remove thePlayer and write "ready" everywhere?

The first function doesn't work either with the warpPedIntoVehicle and there's no command triggering it.

"If debugging is the process of removing software bugs, then programming must be the process of putting them in."

  • Moderators
Posted

Your code is serverside right?

MIKI785 is talking about this.

For addCommandHandler:

Server

player playerSource, string commandName, [string arg1, string arg2, ...] 

Client

string commandName, [string arg1, string arg2, ...] 

Make sure your code is serverside in the meta.

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...