Jump to content

Small problem. oO


Jockie

Recommended Posts

Posted

I want to create a teleport. (As you can see at the code)

Don't ask: Why /home @ commandHandler?: because I want "//home" as command. ^.^

The console says that there is a bad argument at getElementDimension.. (Oh fricking dimensions)

Why only dimension 0? That's secret. :P

This is just a small part. ^^

player = source
veh = getPedOccupiedVehicle(source)
dimension = getElementDimension(source)
 
function teleHome ()
if dimension == 0 then
if not veh then
setElementPosition( player, 405.25030517578, 2436.3159179688, 17.747388839722)
else
setElementPosition( veh, 423.39221191406, 2522.8637695313, 16.484375)
end
end
end
 
addCommandHandler ( "/home", teleHome)

I've also tested:

veh = getPedOccupiedVehicle(player)
dimension = getElementDimension(player)
 
function teleHome ()
if dimension == 0 then
if not veh then
setElementPosition( player, 405.25030517578, 2436.3159179688, 17.747388839722)
else
setElementPosition( veh, 423.39221191406, 2522.8637695313, 16.484375)
end
end
end
 
addCommandHandler ( "/home", teleHome)

Posted

Try this

function teleHome ( source, command )
local veh = getPedOccupiedVehicle(source)
local dimension = getElementDimension(source)
if dimension == 0 then
if not veh then
setElementPosition( source, 405.25030517578, 2436.3159179688, 17.747388839722)
else
setElementPosition( veh, 423.39221191406, 2522.8637695313, 16.484375)
end
end
end
addCommandHandler ( "/home", teleHome)

Posted
Try this
function teleHome ( source, command )
local veh = getPedOccupiedVehicle(source)
local dimension = getElementDimension(source)
if dimension == 0 then
if not veh then
setElementPosition( source, 405.25030517578, 2436.3159179688, 17.747388839722)
else
setElementPosition( veh, 423.39221191406, 2522.8637695313, 16.484375)
end
end
end
addCommandHandler ( "/home", teleHome)

Doesn't work.

Still bad argument @ getElementDimension. :(

Posted
Try this
function teleHome ( source, command )
local veh = getPedOccupiedVehicle(source)
local dimension = getElementDimension(source)
if dimension == 0 then
if not veh then
setElementPosition( source, 405.25030517578, 2436.3159179688, 17.747388839722)
else
setElementPosition( veh, 423.39221191406, 2522.8637695313, 16.484375)
end
end
end
addCommandHandler ( "/home", teleHome)

Doesn't work.

Still bad argument @ getElementDimension. :(

Is the script client-side or serverside? If its client side then try this.

function teleHome ( )
local player = getLocalPlayer()
local veh = getPedOccupiedVehicle(player)
local dimension = getElementDimension(player)
if dimension == 0 then
if not veh then
setElementPosition( player, 405.25030517578, 2436.3159179688, 17.747388839722)
else
setElementPosition( veh, 423.39221191406, 2522.8637695313, 16.484375)
end
end
end
addCommandHandler ( "/home", teleHome)

Posted

Only the client-side is working, except the vehicle teleport. :S

I hate when It's only working at client-side.

And luac5.1.exe is not working, it's getting better and better! X.X

Posted
Only client-side. :S

I hate when It's only working at client-side.

And luac5.1.exe is not working, it's getting better and better! X.X

Well did the client-side version of the script work?

Posted

Yes, only client-side script is working.

The vehicle teleport was not working, but I've turned:

if not veh then
setElementPosition( player, 405.25030517578, 2436.3159179688, 17.747388839722)
else
setElementPosition( veh, 423.39221191406, 2522.8637695313, 16.484375)
end

Into:

if veh then
setElementPosition( veh, 423.39221191406, 2522.8637695313, 16.484375)
else
setElementPosition( player, 405.25030517578, 2436.3159179688, 17.747388839722)
end

And now it's working.

Posted

one thing, i didnt read the whole post, but

when adding command handler use "home" not "/home"

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

Because there is some other places I want to add.

And the short name of it is SS, SkyScraper.

Freeroam resource is also installed on the server.

So.. Freeroam + /ss = SetSkin + SkyScraper teleport. xD

If I use for all the teleports / and for the SkyScraper //ss.

You would think: What the hell? Why double /? :mrgreen:

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