Mateo_Strahm Posted December 28, 2012 Share Posted December 28, 2012 I want to make script for gate that only I can open, but script doesn't work Here is script: URgate = createObject ( 980, 1465.5, -1498.3000488281, 15.300000190735, 0, 0, 90 ) function open(command) if not( accountName == "Mateo" ) then cancelEvent() outputChatBox("(UR Base) Gate lock.",thePlayer ) else moveObject ( URgate, 3000, 1465.5, -1498.3000488281, 9.6999998092651, 0, 0, 0) outputChatBox("(UR Base) Gate opened. Do not forget to close it!",thePlayer ) end end addCommandHandler("uro", open) function close(command) moveObject ( URgate, 3000, 1465.5, -1016.8994140625, 15.300000190735, 0, 0, 0) outputChatBox("(UR Base) Kapija zatvorena.",thePlayer ) end addCommandHandler("urz", close) ERROR: garaza/URbaza.lua:9: attempt to call global ´cancle´ (a nil value) Please tell me where is problem... Link to comment
Sparrow Posted December 28, 2012 Share Posted December 28, 2012 change "accountName" on line 4 to getAccountName(getPlayerAccount(source)) or add local accountName = getAccountName(getPlayerAccount(source)) Link to comment
Mateo_Strahm Posted December 28, 2012 Author Share Posted December 28, 2012 Like this doesn't work, when I hit /uro I got outbox Gate locked..?? URkapija = createObject ( 980, 1465.5, -1498.3000488281, 15.300000190735, 0, 0, 90 ) function open(command) if not( getPlayerAccount(source) == "Mateo1997" ) then cancelEvent() outputChatBox("(UR Baza) Kapija Zakljucana.",thePlayer ) else moveObject ( URgate, 3000, 1465.5, -1498.3000488281, 9.6999998092651, 0, 0, 0) outputChatBox("(UR Baza) Kapija otvorena. Ne zaboravi zatvoriti!",thePlayer ) end end addCommandHandler("uro", open) function close(command) moveObject ( URkapija, 3000, 1465.5, -1016.8994140625, 15.300000190735, 0, 0, 0) outputChatBox("(UR Baza) Kapija zatvorena.",thePlayer ) end addCommandHandler("urz", close) Link to comment
Vision Posted December 28, 2012 Share Posted December 28, 2012 URgate = createObject ( 980, 1465.5, -1498.3000488281, 15.300000190735, 0, 0, 90 ) function open ( thePlayer, command ) local accountName = getAccountName ( getPlayerAccount( thePlayer ) ) if ( accountName == "Mateo1997" ) then moveObject ( URgate, 3000, 1465.5, -1498.3000488281, 9.6999998092651, 0, 0, 0 ) outputChatBox ( "(UR Base) Gate opened. Do not forget to close it!", thePlayer ) else outputChatBox ( "(UR Base) Gate lock.", thePlayer ) end end addCommandHandler("uro", open) function close ( thePlayer, command ) moveObject ( URgate, 3000, 1465.5, -1016.8994140625, 15.300000190735, 0, 0, 0 ) outputChatBox ( "(UR Base) Kapija zatvorena.", thePlayer ) end addCommandHandler("urz", close) Link to comment
Mateo_Strahm Posted December 28, 2012 Author Share Posted December 28, 2012 Castro thank you soooooooooo muchhh 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