Jump to content

scripting help! Gate help!


Recommended Posts

For some unknown odd reason my gate is not working and i am getting a format error.

https://wiki.multitheftauto.com/wiki/MoveObject I got it from this site under example 3! Here is my script, please help me fix it so I dont get any errors! :D

Script is as follows:

local START_POS = {969, -717.7900390625, 954.7607421875, 11.264283180237, 0, 0, 87.499725341797}

local STOP_POS = {2464.0205078125, -1663.419921875, 12.338788032532, 0, 0, 2651}

local MOTION_DURATION = 5000

local WAIT_DURATION = 1000

addCommandHandler("smove",

function (player, cmd, strEasingType, period, amplitude, overshoot)

local x, y, z = unpack(START_POS)

local object = createObject(99, x, y, z)

x, y, z = unpack(STOP_POS)

period = period or 0.3

amplitude = amplitude or 1.0

overshoot = overshoot or 1.70158

outputChatBox(string.format("Server Easing %s %s %s %s", strEasingType, tostring(period), tostring(amplitude), tostring(overshoot)))

moveObject(object, MOTION_DURATION, x, y, z, 0, 0, 360, strEasingType, period, amplitude, overshoot)

setTimer(destroyElement, MOTION_DURATION+WAIT_DURATION, 1, object)

end)

I edited in the object id 969 and the coordinates, and the move coordinated and i got an error back. I used the create object script and it worked but now i want a gate to open to the moderator and up to admin acl groups. Can someone help me with this i want a gate to open to people in acl of admin and super moderator. Im new at scripting and this is my first try. Thanks :D

Link to comment

you don't even know what you are doing

you put id 99 for object?!

local object = createObject(99, x, y, z)

and you put the correct id in wrong place

local START_POS = {-717, 954, 12, 0, 0, 87} 
local STOP_POS = {-717, 954, 12, 0, 0, 2651} 
local MOTION_DURATION = 5000 
local WAIT_DURATION = 1000 
  
addCommandHandler("smove", 
function (player, cmd, strEasingType, period, amplitude, overshoot) 
if isObjectInACLGroup("user." ..getAccountName(getPlayerAccount (player)), aclGetGroup("Admin" or "SuperModerator")) then 
local x, y, z = unpack(START_POS) 
local object = createObject(969, x, y, z) 
x, y, z = unpack(STOP_POS) 
  
strEasingType = strEasingType or "Linear" 
period = period or 0.3 
amplitude = amplitude or 1.0 
overshoot = overshoot or 1.70158 
  
outputChatBox(string.format("Server Easing %s %s %s %s", strEasingType, tostring(period), tostring(amplitude), tostring(overshoot))) 
moveObject(object, MOTION_DURATION, x, y, z, 0, 0, 360, strEasingType, period, amplitude, overshoot) 
setTimer(destroyElement, MOTION_DURATION+WAIT_DURATION, 1, object) 
else 
outputChatBox ("You are not Admin or SuperModerator!", player, 255, 0, 0) 
end 
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...