Jump to content

Need help at scripting


AG Adam

Recommended Posts

Hello, i have a problem. Start with, i suck at scripting, but i want to do this.

This should be an elevator (lift).

Code:

addEventHandler("onPlayerJoin",getRootElement(), function () 
  
lifttargy = CreateObject(1301,-682.98144531,1017.06542969,10.673,0.00000000,0.00000000,0.00000000) 
liftmarkerje = createMarker(-682.98144531,1017.06542969,12,'cylinder',3,0,0,0,0) 
end 
  
function liftfel (hitPlayer,matchingDimension)) 
local skin = getElementModel (hitPlayer) 
 if skin == 0 or skin == 285 then 
  moveObject (lifttargy,10000,-682.98162842,1017.06610107,511.943,0.00000000,0.00000000,0.00000000) 
 else 
  killPed (hitPlayer) 
 end 
  
addEventHandler ('onMarkerHit', liftmarkerje, liftfel) 
  
  
function liftle (hitPlayer,matchingDimension) 
  moveObject (lifttargy,10000,-682.98144531,1017.06542969,10.673,0.00000000,0.00000000,0.00000000) 
end 
  
addEventHandler ("onMarkerLeave",liftmarkerje, liftle) 
end 

Errors/warnings:

[2010-09-27 15:53:38] SCRIPT ERROR: playmap2\server.lua:7: ')' expected (to close '(' at line 1) near 'function' 
[2010-09-27 15:53:38] WARNING: Loading script failed: playmap2\server.lua:7: ')' expected (to close '(' at line 1) near 'function' 

Please help me!

Link to comment

well, the event must go after function not in function body, and also got a question, why you do onPlayerJoin make the object?

addEventHandler("onPlayerJoin",getRootElement(), 
function () 
lifttargy = CreateObject(1301,-682.98144531,1017.06542969,10.673,0.00000000,0.00000000,0.00000000) 
liftmarkerje = createMarker(-682.98144531,1017.06542969,12,'cylinder',3,0,0,0,0) 
end) 
  
function liftfel (hitPlayer,matchingDimension)) 
local skin = getElementModel (hitPlayer) 
 if skin == 0 or skin == 285 then 
  moveObject (lifttargy,10000,-682.98162842,1017.06610107,511.943,0.00000000,0.00000000,0.00000000) 
 else 
  killPed (hitPlayer) 
   end 
 end 
addEventHandler ('onMarkerHit', liftmarkerje, liftfel) 
  
  
function liftle (hitPlayer,matchingDimension) 
  moveObject (lifttargy,10000,-682.98144531,1017.06542969,10.673,0.00000000,0.00000000,0.00000000) 
end 
addEventHandler ("onMarkerLeave",liftmarkerje, liftle) 

Link to comment
[2010-09-27 16:26:25] SCRIPT ERROR: playmap2\server.lua:7: unexpected symbol near ')'

[2010-09-27 16:26:25] WARNING: Loading script failed: playmap2\server.lua:7: unexpected symbol near ')'

using your script.

EDIT:

With OnPlayerJoin.

addEventHandler("onPlayerJoin",getRootElement(), 
function () 
lifttargy = CreateObject(1301,-682.98144531,1017.06542969,10.673,0.00000000,0.00000000,0.00000000) 
liftmarkerje = createMarker(-682.98144531,1017.06542969,12,'cylinder',3,0,0,0,0) 
end) 
  
function liftfel (hitPlayer,matchingDimension) 
local skin = getElementModel (hitPlayer) 
 if skin == 0 or skin == 285 then 
  moveObject (lifttargy,10000,-682.98162842,1017.06610107,511.943,0.00000000,0.00000000,0.00000000) 
 else 
  killPed (hitPlayer) 
   end 
 end 
addEventHandler ('onMarkerHit', liftmarkerje, liftfel) 
  
  
function liftle (hitPlayer,matchingDimension) 
  moveObject (lifttargy,10000,-682.98144531,1017.06542969,10.673,0.00000000,0.00000000,0.00000000) 
end 
addEventHandler ("onMarkerLeave",liftmarkerje, liftle) 

you put wrong syntax at function.

Link to comment
Bad argument: AddEventHandler (line 15 and 21)

15 addEventHandler ('onMarkerHit', liftmarkerje, liftfel)

21 addEventHandler ("onMarkerLeave",liftmarkerje, liftle)

now im totally stuck.

And yeah, i didnt checked, but thanks :)

try this maybe,

addEventHandler("onPlayerJoin",getRootElement(), 
function () 
lifttargy = CreateObject(1301,-682.98144531,1017.06542969,10.673,0.00000000,0.00000000,0.00000000) 
liftmarkerje = createMarker(-682.98144531,1017.06542969,12,'cylinder',3,0,0,0,0) 
addEventHandler ('onMarkerHit', liftmarkerje, liftfel) 
addEventHandler ("onMarkerLeave",liftmarkerje, liftle) 
end) 
  
function liftfel (hitPlayer,matchingDimension) 
local skin = getElementModel (hitPlayer) 
 if skin == 0 or skin == 285 then 
  moveObject (lifttargy,10000,-682.98162842,1017.06610107,511.943,0.00000000,0.00000000,0.00000000) 
 else 
  killPed (hitPlayer) 
   end 
 end 
  
 function liftle (hitPlayer,matchingDimension) 
  moveObject (lifttargy,10000,-682.98144531,1017.06542969,10.673,0.00000000,0.00000000,0.00000000) 
end 

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