dragonofdark Posted March 11, 2011 Share Posted March 11, 2011 Hello, I made a little script wich create some objects in my Walton, so I have a command to create the objects and an other to destroy them. But when I destroy the objects, my Walton healt is at 250 To prevent that, I created a function wich fix the vehicle after the destroy. I set a timer of 1.5 sec before the function works. Here is the script : -- create the bags in the walton function sacWal1( player, cmd ) local wal = getPedOccupiedVehicle(player) local x,y,z = getElementPosition( wal ) o1 = createObject ( 2060, x, y, z ) o2 = createObject ( 2060, x, y, z ) o3 = createObject ( 2060, x, y, z ) o4 = createObject ( 2060, x, y, z ) o5 = createObject ( 2060, x, y, z ) o6 = createObject ( 2060, x, y, z ) o7 = createObject ( 2060, x, y, z ) o8 = createObject ( 2060, x, y, z ) o9 = createObject ( 2060, x, y, z ) o10 = createObject ( 2060, x, y, z ) o11 = createObject ( 2060, x, y, z ) o12 = createObject ( 2060, x, y, z ) o13 = createObject ( 2060, x, y, z ) o14 = createObject ( 2060, x, y, z ) o15 = createObject ( 2060, x, y, z ) o16 = createObject ( 2060, x, y, z ) o17 = createObject ( 2060, x, y, z ) o18 = createObject ( 2060, x, y, z ) o19 = createObject ( 2060, x, y, z ) o20 = createObject ( 2060, x, y, z ) o21 = createObject ( 2060, x, y, z ) o22 = createObject ( 2060, x, y, z ) o23 = createObject ( 2060, x, y, z ) o24 = createObject ( 2060, x, y, z ) o25 = createObject ( 2060, x, y, z ) o26 = createObject ( 2060, x, y, z ) o27 = createObject ( 2060, x, y, z ) o28 = createObject ( 2060, x, y, z ) o29 = createObject ( 2060, x, y, z ) o30 = createObject ( 2060, x, y, z ) o31 = createObject ( 2060, x, y, z ) o32 = createObject ( 2060, x, y, z ) o33 = createObject ( 2060, x, y, z ) o34 = createObject ( 2060, x, y, z ) o35 = createObject ( 2060, x, y, z ) o36 = createObject ( 2060, x, y, z ) o37 = createObject ( 2060, x, y, z ) o38 = createObject ( 2060, x, y, z ) o39 = createObject ( 2060, x, y, z ) o40 = createObject ( 2060, x, y, z ) o41 = createObject ( 2060, x, y, z ) attachElements ( o1, wal, -0.5, -0.1 , -0.35 ) attachElements ( o2, wal, 0.5, -0.1 , -0.35 ) attachElements ( o3, wal, -0.5, -0.6 , -0.35 ) attachElements ( o4, wal, 0.5, -0.6 , -0.35 ) attachElements ( o5, wal, -0.5, -1.1 , -0.35 ) attachElements ( o6, wal, 0.5, -1.1 , -0.35 ) attachElements ( o7, wal, -0.5, -1.6 , -0.35 ) attachElements ( o8, wal, 0.5, -1.6 , -0.35 ) attachElements ( o9, wal, -0.5, -2.1 , -0.35 ) attachElements ( o10, wal, 0.5, -2.1 , -0.35 ) attachElements ( o11, wal, -0.5, -2.55 , -0.35 ) attachElements ( o12, wal, 0.5, -2.55 , -0.35 ) attachElements ( o13, wal, -0.5, -0.1 , -0.1 ) attachElements ( o14, wal, 0.5, -0.1 , -0.1 ) attachElements ( o15, wal, -0.5, -0.6 , -0.1 ) attachElements ( o16, wal, 0.5, -0.6 , -0.1 ) attachElements ( o17, wal, -0.5, -1.1 , -0.1 ) attachElements ( o18, wal, 0.5, -1.1 , -0.1 ) attachElements ( o19, wal, -0.5, -1.6 , -0.1 ) attachElements ( o20, wal, 0.5, -1.6 , -0.1 ) attachElements ( o21, wal, -0.5, -2.1 , -0.1 ) attachElements ( o22, wal, 0.5, -2.1 , -0.1 ) attachElements ( o23, wal, -0.5, -2.55 , -0.1 ) attachElements ( o24, wal, 0.5, -2.55 , -0.1 ) attachElements ( o25, wal, -0.5, -0.1 , 0.1 ) attachElements ( o26, wal, 0.5, -0.1 , 0.1 ) attachElements ( o27, wal, -0.5, -0.6 , 0.1 ) attachElements ( o28, wal, 0.5, -0.6 , 0.1 ) attachElements ( o29, wal, -0.5, -1.1 , 0.1 ) attachElements ( o30, wal, 0.5, -1.1 , 0.1 ) attachElements ( o31, wal, -0.5, -1.6 , 0.1 ) attachElements ( o32, wal, 0.5, -1.6 , 0.1 ) attachElements ( o33, wal, -0.5, -2.1 , 0.1 ) attachElements ( o34, wal, 0.5, -2.1 , 0.1 ) attachElements ( o35, wal, -0.5, -2.55 , 0.1 ) attachElements ( o36, wal, 0.5, -2.55 , 0.1 ) attachElements ( o37, wal, 0, -0.35 , 0.35 ) attachElements ( o38, wal, 0, -0.85 , 0.35 ) attachElements ( o39, wal, 0, -1.35 , 0.35 ) attachElements ( o40, wal, 0, -1.85 , 0.35 ) attachElements ( o41, wal, 0, -2.35 , 0.35 ) setTimer ( fix, 1500, 1 ) end addCommandHandler ( "sacwal1", sacWal1) -- delete the bags function sacWal10 ( player, cmd ) local wal = getPedOccupiedVehicle(player) local x,y,z = getElementPosition( wal ) destroyElement ( o1 ) destroyElement ( o2 ) destroyElement ( o3 ) destroyElement ( o4 ) destroyElement ( o5 ) destroyElement ( o6 ) destroyElement ( o7 ) destroyElement ( o8 ) destroyElement ( o9 ) destroyElement ( o10 ) destroyElement ( o11 ) destroyElement ( o12 ) destroyElement ( o13 ) destroyElement ( o14 ) destroyElement ( o15 ) destroyElement ( o16 ) destroyElement ( o17 ) destroyElement ( o18 ) destroyElement ( o19 ) destroyElement ( o20 ) destroyElement ( o21 ) destroyElement ( o22 ) destroyElement ( o23 ) destroyElement ( o24 ) destroyElement ( o25 ) destroyElement ( o26 ) destroyElement ( o27 ) destroyElement ( o28 ) destroyElement ( o29 ) destroyElement ( o30 ) destroyElement ( o31 ) destroyElement ( o32 ) destroyElement ( o33 ) destroyElement ( o34 ) destroyElement ( o35 ) destroyElement ( o36 ) destroyElement ( o37 ) destroyElement ( o38 ) destroyElement ( o39 ) destroyElement ( o40 ) destroyElement ( o41 ) setTimer ( fix, 1500, 1 ) end addCommandHandler ( "sacwal10", sacWal10) -- fix the vehicle function fix () local wal = getPedOccupiedVehicle(player) fixVehicle ( wal ) end After that, i have 2 errors in the debugscript : i hope someone can help me Thanks in advance, dragonofdark Link to comment
Kenix Posted March 11, 2011 Share Posted March 11, 2011 Hello,I made a little script wich create some objects in my Walton, so I have a command to create the objects and an other to destroy them. But when I destroy the objects, my Walton healt is at 250 To prevent that, I created a function wich fix the vehicle after the destroy. I set a timer of 1.5 sec before the function works. Here is the script : -- create the bags in the walton function sacWal1( player, cmd ) local wal = getPedOccupiedVehicle(player) local x,y,z = getElementPosition( wal ) o1 = createObject ( 2060, x, y, z ) o2 = createObject ( 2060, x, y, z ) o3 = createObject ( 2060, x, y, z ) o4 = createObject ( 2060, x, y, z ) o5 = createObject ( 2060, x, y, z ) o6 = createObject ( 2060, x, y, z ) o7 = createObject ( 2060, x, y, z ) o8 = createObject ( 2060, x, y, z ) o9 = createObject ( 2060, x, y, z ) o10 = createObject ( 2060, x, y, z ) o11 = createObject ( 2060, x, y, z ) o12 = createObject ( 2060, x, y, z ) o13 = createObject ( 2060, x, y, z ) o14 = createObject ( 2060, x, y, z ) o15 = createObject ( 2060, x, y, z ) o16 = createObject ( 2060, x, y, z ) o17 = createObject ( 2060, x, y, z ) o18 = createObject ( 2060, x, y, z ) o19 = createObject ( 2060, x, y, z ) o20 = createObject ( 2060, x, y, z ) o21 = createObject ( 2060, x, y, z ) o22 = createObject ( 2060, x, y, z ) o23 = createObject ( 2060, x, y, z ) o24 = createObject ( 2060, x, y, z ) o25 = createObject ( 2060, x, y, z ) o26 = createObject ( 2060, x, y, z ) o27 = createObject ( 2060, x, y, z ) o28 = createObject ( 2060, x, y, z ) o29 = createObject ( 2060, x, y, z ) o30 = createObject ( 2060, x, y, z ) o31 = createObject ( 2060, x, y, z ) o32 = createObject ( 2060, x, y, z ) o33 = createObject ( 2060, x, y, z ) o34 = createObject ( 2060, x, y, z ) o35 = createObject ( 2060, x, y, z ) o36 = createObject ( 2060, x, y, z ) o37 = createObject ( 2060, x, y, z ) o38 = createObject ( 2060, x, y, z ) o39 = createObject ( 2060, x, y, z ) o40 = createObject ( 2060, x, y, z ) o41 = createObject ( 2060, x, y, z ) attachElements ( o1, wal, -0.5, -0.1 , -0.35 ) attachElements ( o2, wal, 0.5, -0.1 , -0.35 ) attachElements ( o3, wal, -0.5, -0.6 , -0.35 ) attachElements ( o4, wal, 0.5, -0.6 , -0.35 ) attachElements ( o5, wal, -0.5, -1.1 , -0.35 ) attachElements ( o6, wal, 0.5, -1.1 , -0.35 ) attachElements ( o7, wal, -0.5, -1.6 , -0.35 ) attachElements ( o8, wal, 0.5, -1.6 , -0.35 ) attachElements ( o9, wal, -0.5, -2.1 , -0.35 ) attachElements ( o10, wal, 0.5, -2.1 , -0.35 ) attachElements ( o11, wal, -0.5, -2.55 , -0.35 ) attachElements ( o12, wal, 0.5, -2.55 , -0.35 ) attachElements ( o13, wal, -0.5, -0.1 , -0.1 ) attachElements ( o14, wal, 0.5, -0.1 , -0.1 ) attachElements ( o15, wal, -0.5, -0.6 , -0.1 ) attachElements ( o16, wal, 0.5, -0.6 , -0.1 ) attachElements ( o17, wal, -0.5, -1.1 , -0.1 ) attachElements ( o18, wal, 0.5, -1.1 , -0.1 ) attachElements ( o19, wal, -0.5, -1.6 , -0.1 ) attachElements ( o20, wal, 0.5, -1.6 , -0.1 ) attachElements ( o21, wal, -0.5, -2.1 , -0.1 ) attachElements ( o22, wal, 0.5, -2.1 , -0.1 ) attachElements ( o23, wal, -0.5, -2.55 , -0.1 ) attachElements ( o24, wal, 0.5, -2.55 , -0.1 ) attachElements ( o25, wal, -0.5, -0.1 , 0.1 ) attachElements ( o26, wal, 0.5, -0.1 , 0.1 ) attachElements ( o27, wal, -0.5, -0.6 , 0.1 ) attachElements ( o28, wal, 0.5, -0.6 , 0.1 ) attachElements ( o29, wal, -0.5, -1.1 , 0.1 ) attachElements ( o30, wal, 0.5, -1.1 , 0.1 ) attachElements ( o31, wal, -0.5, -1.6 , 0.1 ) attachElements ( o32, wal, 0.5, -1.6 , 0.1 ) attachElements ( o33, wal, -0.5, -2.1 , 0.1 ) attachElements ( o34, wal, 0.5, -2.1 , 0.1 ) attachElements ( o35, wal, -0.5, -2.55 , 0.1 ) attachElements ( o36, wal, 0.5, -2.55 , 0.1 ) attachElements ( o37, wal, 0, -0.35 , 0.35 ) attachElements ( o38, wal, 0, -0.85 , 0.35 ) attachElements ( o39, wal, 0, -1.35 , 0.35 ) attachElements ( o40, wal, 0, -1.85 , 0.35 ) attachElements ( o41, wal, 0, -2.35 , 0.35 ) setTimer ( fix, 1500, 1 ) end addCommandHandler ( "sacwal1", sacWal1) -- delete the bags function sacWal10 ( player, cmd ) local wal = getPedOccupiedVehicle(player) local x,y,z = getElementPosition( wal ) destroyElement ( o1 ) destroyElement ( o2 ) destroyElement ( o3 ) destroyElement ( o4 ) destroyElement ( o5 ) destroyElement ( o6 ) destroyElement ( o7 ) destroyElement ( o8 ) destroyElement ( o9 ) destroyElement ( o10 ) destroyElement ( o11 ) destroyElement ( o12 ) destroyElement ( o13 ) destroyElement ( o14 ) destroyElement ( o15 ) destroyElement ( o16 ) destroyElement ( o17 ) destroyElement ( o18 ) destroyElement ( o19 ) destroyElement ( o20 ) destroyElement ( o21 ) destroyElement ( o22 ) destroyElement ( o23 ) destroyElement ( o24 ) destroyElement ( o25 ) destroyElement ( o26 ) destroyElement ( o27 ) destroyElement ( o28 ) destroyElement ( o29 ) destroyElement ( o30 ) destroyElement ( o31 ) destroyElement ( o32 ) destroyElement ( o33 ) destroyElement ( o34 ) destroyElement ( o35 ) destroyElement ( o36 ) destroyElement ( o37 ) destroyElement ( o38 ) destroyElement ( o39 ) destroyElement ( o40 ) destroyElement ( o41 ) setTimer ( fix, 1500, 1 ) end addCommandHandler ( "sacwal10", sacWal10) -- fix the vehicle function fix () local wal = getPedOccupiedVehicle(player) fixVehicle ( wal ) end After that, i have 2 errors in the debugscript : i hope someone can help me Thanks in advance, dragonofdark may be this: function sacWal1( player, cmd ) local wal = getPedOccupiedVehicle(player) local x,y,z = getElementPosition( wal ) o1 = createObject ( 2060, x, y, z ) o2 = createObject ( 2060, x, y, z ) o3 = createObject ( 2060, x, y, z ) o4 = createObject ( 2060, x, y, z ) o5 = createObject ( 2060, x, y, z ) o6 = createObject ( 2060, x, y, z ) o7 = createObject ( 2060, x, y, z ) o8 = createObject ( 2060, x, y, z ) o9 = createObject ( 2060, x, y, z ) o10 = createObject ( 2060, x, y, z ) o11 = createObject ( 2060, x, y, z ) o12 = createObject ( 2060, x, y, z ) o13 = createObject ( 2060, x, y, z ) o14 = createObject ( 2060, x, y, z ) o15 = createObject ( 2060, x, y, z ) o16 = createObject ( 2060, x, y, z ) o17 = createObject ( 2060, x, y, z ) o18 = createObject ( 2060, x, y, z ) o19 = createObject ( 2060, x, y, z ) o20 = createObject ( 2060, x, y, z ) o21 = createObject ( 2060, x, y, z ) o22 = createObject ( 2060, x, y, z ) o23 = createObject ( 2060, x, y, z ) o24 = createObject ( 2060, x, y, z ) o25 = createObject ( 2060, x, y, z ) o26 = createObject ( 2060, x, y, z ) o27 = createObject ( 2060, x, y, z ) o28 = createObject ( 2060, x, y, z ) o29 = createObject ( 2060, x, y, z ) o30 = createObject ( 2060, x, y, z ) o31 = createObject ( 2060, x, y, z ) o32 = createObject ( 2060, x, y, z ) o33 = createObject ( 2060, x, y, z ) o34 = createObject ( 2060, x, y, z ) o35 = createObject ( 2060, x, y, z ) o36 = createObject ( 2060, x, y, z ) o37 = createObject ( 2060, x, y, z ) o38 = createObject ( 2060, x, y, z ) o39 = createObject ( 2060, x, y, z ) o40 = createObject ( 2060, x, y, z ) o41 = createObject ( 2060, x, y, z ) attachElements ( o1, wal, -0.5, -0.1 , -0.35 ) attachElements ( o2, wal, 0.5, -0.1 , -0.35 ) attachElements ( o3, wal, -0.5, -0.6 , -0.35 ) attachElements ( o4, wal, 0.5, -0.6 , -0.35 ) attachElements ( o5, wal, -0.5, -1.1 , -0.35 ) attachElements ( o6, wal, 0.5, -1.1 , -0.35 ) attachElements ( o7, wal, -0.5, -1.6 , -0.35 ) attachElements ( o8, wal, 0.5, -1.6 , -0.35 ) attachElements ( o9, wal, -0.5, -2.1 , -0.35 ) attachElements ( o10, wal, 0.5, -2.1 , -0.35 ) attachElements ( o11, wal, -0.5, -2.55 , -0.35 ) attachElements ( o12, wal, 0.5, -2.55 , -0.35 ) attachElements ( o13, wal, -0.5, -0.1 , -0.1 ) attachElements ( o14, wal, 0.5, -0.1 , -0.1 ) attachElements ( o15, wal, -0.5, -0.6 , -0.1 ) attachElements ( o16, wal, 0.5, -0.6 , -0.1 ) attachElements ( o17, wal, -0.5, -1.1 , -0.1 ) attachElements ( o18, wal, 0.5, -1.1 , -0.1 ) attachElements ( o19, wal, -0.5, -1.6 , -0.1 ) attachElements ( o20, wal, 0.5, -1.6 , -0.1 ) attachElements ( o21, wal, -0.5, -2.1 , -0.1 ) attachElements ( o22, wal, 0.5, -2.1 , -0.1 ) attachElements ( o23, wal, -0.5, -2.55 , -0.1 ) attachElements ( o24, wal, 0.5, -2.55 , -0.1 ) attachElements ( o25, wal, -0.5, -0.1 , 0.1 ) attachElements ( o26, wal, 0.5, -0.1 , 0.1 ) attachElements ( o27, wal, -0.5, -0.6 , 0.1 ) attachElements ( o28, wal, 0.5, -0.6 , 0.1 ) attachElements ( o29, wal, -0.5, -1.1 , 0.1 ) attachElements ( o30, wal, 0.5, -1.1 , 0.1 ) attachElements ( o31, wal, -0.5, -1.6 , 0.1 ) attachElements ( o32, wal, 0.5, -1.6 , 0.1 ) attachElements ( o33, wal, -0.5, -2.1 , 0.1 ) attachElements ( o34, wal, 0.5, -2.1 , 0.1 ) attachElements ( o35, wal, -0.5, -2.55 , 0.1 ) attachElements ( o36, wal, 0.5, -2.55 , 0.1 ) attachElements ( o37, wal, 0, -0.35 , 0.35 ) attachElements ( o38, wal, 0, -0.85 , 0.35 ) attachElements ( o39, wal, 0, -1.35 , 0.35 ) attachElements ( o40, wal, 0, -1.85 , 0.35 ) attachElements ( o41, wal, 0, -2.35 , 0.35 ) setTimer ( fix, 1500, 1 ) end addCommandHandler ( "sacwal1", sacWal1) -- delete the bags function sacWal10 ( player, cmd ) local wal = getPedOccupiedVehicle(player) local x,y,z = getElementPosition( wal ) destroyElement ( o1 ) destroyElement ( o2 ) destroyElement ( o3 ) destroyElement ( o4 ) destroyElement ( o5 ) destroyElement ( o6 ) destroyElement ( o7 ) destroyElement ( o8 ) destroyElement ( o9 ) destroyElement ( o10 ) destroyElement ( o11 ) destroyElement ( o12 ) destroyElement ( o13 ) destroyElement ( o14 ) destroyElement ( o15 ) destroyElement ( o16 ) destroyElement ( o17 ) destroyElement ( o18 ) destroyElement ( o19 ) destroyElement ( o20 ) destroyElement ( o21 ) destroyElement ( o22 ) destroyElement ( o23 ) destroyElement ( o24 ) destroyElement ( o25 ) destroyElement ( o26 ) destroyElement ( o27 ) destroyElement ( o28 ) destroyElement ( o29 ) destroyElement ( o30 ) destroyElement ( o31 ) destroyElement ( o32 ) destroyElement ( o33 ) destroyElement ( o34 ) destroyElement ( o35 ) destroyElement ( o36 ) destroyElement ( o37 ) destroyElement ( o38 ) destroyElement ( o39 ) destroyElement ( o40 ) destroyElement ( o41 ) setTimer ( fix, 1500, 1 ) end addCommandHandler ( "sacwal10", sacWal10) -- fix the vehicle function fix () local wall = getPedOccupiedVehicle(source) fixVehicle ( wall ) end Link to comment
DakiLLa Posted March 11, 2011 Share Posted March 11, 2011 You should send a player variable to your 'fix' function that retrieves a player element to get his occupied vehicle. So, add 'player' var to your setTimer functions, because 'player' is the source of the executed command: setTimer ( fix, 1500, 1, player ) --line 87 and 136 And the resulting 'fix' function: function fix ( player ) local wal = getPedOccupiedVehicle(player) fixVehicle ( wal ) end Link to comment
dragonofdark Posted March 11, 2011 Author Share Posted March 11, 2011 Thanks DakiLLa, it works well Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now