Jump to content

Need help at scripting


AG Adam

Recommended Posts

Posted

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!

Posted

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) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
Thanks, really, i just copied, but i will use onResourceStart (correct me if im noob).

Very thanks.

Stryp aka Adam

dunno if its needed to put the object into a function, i ever made it without function :P

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
SCRIPT ERROR: playmap2\server.lua:7: unexpected symbol near ')'

Maybe start to think by yourself?

You didn't even check that freaking like 7, did you?

function liftfel (hitPlayer,matchingDimension)) 

It's perfectly clear to see what is wrong here ;/

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted
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 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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