Jump to content

hey this script aint working [help]


Recommended Posts

  
function setupForRace ( ) 
    local RacerPed = createPed (1171.09765625,-2037.2551269531,69.0078125) 
    local RaceVehicle = createVehicle (1161.5633544922,-2043.7193603516,69.0078125)            -- create a vehicle. 
    warpPedIntoVehicle ( RacerPed, RaceVehicle )                  -- warp the ped straight into the vehicle 
end 
addCommandHandler ( "startrace", setupForRace )                   -- add a command to start race 
  

hey every time i type startrace i get a bunch of errors

here are the errors take from my log files

  
[10:35:24] New resource 'ped' loaded 
[10:35:25] Resources: 137 loaded, 0 failed 
[10:35:25] Starting ped 
[10:35:45] WARNING: pedRace.lua: Bad argument @ 'createPed' - Line: 2 
[10:35:45] WARNING: pedRace.lua: Bad argument @ 'createVehicle' - Line: 3 
[10:35:45] WARNING: pedRace.lua: Bad argument @ 'warpPedIntoVehicle' - Line: 4 
[10:35:55] WARNING: pedRace.lua: Bad argument @ 'createPed' - Line: 2 
[10:35:55] WARNING: pedRace.lua: Bad argument @ 'createVehicle' - Line: 3 
[10:35:55] WARNING: pedRace.lua: Bad argument @ 'warpPedIntoVehicle' - Line: 4 
  

any clues?

am i crazy?

http://development.mtasa.com/index.php? ... ntoVehicle

Link to comment

You could at least TRY to read how to use functions before writing down something completely arbitrary... createPed and createVehicle both need at least 4 arguments each (you forgot the skin ID and vehicle ID, skin goes before coords, vehicle ID goes after). Since you provide the wrong kind of input in one and nothing at all in the other, they throw an error (invalid argument) and end up not creating what they're supposed to. Therefore, you get the same error in every function call that tries to use the results.

http://development.mtasa.com/index.php?title=Main_Page

Open it, read it, use it.

Edited by Guest
Link to comment
You could at least TRY to read how to use functions before writing down something completely arbitrary... createPed and createVehicle both need at least 4 arguments each (you forgot the skin ID and vehicle ID, respectively, which go after the coordinates in each function). Since those are nil, you get an error there (invalid argument) and since they end up not creating the ped nor the vehicle, you get the same error in every function call that tries to use them.

http://development.mtasa.com/index.php?title=Main_Page

Open it, read it, use it.

ok thanks -__- :)

Link to comment

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...