Jump to content

Gate Did'nt working


Perfect

Recommended Posts

Hi All, I make this gate but its not working.

mgate1 = createObject ( 989, 864.5, -3973, 2.2999999523163, 0, 0, 267.99499511719 ) 
  
function opengate(thePlayer) 
local id = getElementModel (thePlayer) 
          moveObject ( mgate1, 1000, 859.79998779297, -3972.6000976563, 2.0999999046326 ) 
end 
addCommandHandler("mopen", opengate) 
  
function closegate(theplayer) 
local id = getElementModel (thePlayer) 
           moveObject ( mgate1, 1000, 864.5, -3973, 2.2999999523163 ) 
end 
addCommandHandler("mclose", closegate) 
  

Meta

    "Perfect" name="gates" version="1.2.0" type="script"/> 
    

Link to comment
  
mgate1 = createObject ( 989, 864.5, -3973, 2.2999999523163, 0, 0, 267.99499511719 ) 
  
function opengate(thePlayer) 
local id = getElementModel (thePlayer) 
          moveObject ( mgate1, 1000, 859.79998779297, -3972.6000976563, 2.0999999046326 ) 
end 
addCommandHandler("mopen", opengate) 
  
function closegate(thePlayer) -- thePlayer not theplayer 
local id = getElementModel (thePlayer) 
           moveObject ( mgate1, 1000, 864.5, -3973, 2.2999999523163 ) 
end 
addCommandHandler("mclose", closegate) 
  
  

Script should work and had no problem unless that it couldnt gain the element model in the last function because you used theplayer in function and thePlayer in model.

Link to comment

Debug

WARNING: Script 'gates/gates.lua' is not encoded in UTF-8. Loading as ANSI...

WARNING: Loading script failed: gates\gates.lua:1: unexpected symbol near '('

Fullcode

gates.lua

mgate1 = createObject ( 989, 864.5, -3973, 2.2999999523163, 0, 0, 267.99499511719 ) 
  
function opengate(thePlayer) 
local id = getElementModel (thePlayer) 
          moveObject ( mgate1, 1000, 859.79998779297, -3972.6000976563, 2.0999999046326 ) 
end 
addCommandHandler("mopen", opengate) 
  
function closegate(thePlayer) 
local id = getElementModel (thePlayer) 
           moveObject ( mgate1, 1000, 864.5, -3973, 2.2999999523163 ) 
end 
addCommandHandler("mclose", closegate) 
  

meta.xml

    "Sterick" name="gates" version="1.2.0" type="script"/> 
    

Link to comment
Your problem not in the code

the problem from the encoded

change it to UTF-8

and it will work just fine.

What is uncoded ?

and how to change it to UTF-8 ?

with Notepad: File > Save As > Encoding: UTF-8 > Save

done.

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