Sign in to follow this  
easyrider

Randomly Teleport Tp PvP places

Recommended Posts

 

Hi Friends,

I want to teleport to different places when I write / pvp command.

I write some codes. It says 'RUNNING' in the resources.but It is not teleporting :C    Help me please ...

serverside :

local spawns = {
{ -1569.2819824219, 1196.4373779297, 7.1865711212158, 0 },
{ -1661.0703125, 1212.8386230469, 32.897026062012, 0 },
{ -1684.5240478516, 1360.486328125, 7.1721897125244, 0 },
{ -1768.2357177734, 1175.0441894531, 25.125, 0 }
}
function spawn( player )
local rnd = mat.random( 1, #spawns )
setElementPosition( player, spawns[rnd][1], spawns[rnd][2], spawns[rnd][3] )
setElementPosition( player, 0 , 0, spawns[rnd][4] )
end
addCommandHandler("pvp",Spawn)

 

Meta File:

<meta>
<script src="server.lua" type="server" />
</meta>

What is wrong ??? 

 

 

 

Share this post


Link to post

Please use the code button when posting code.

If you checked your debug you'd know that u have a typo on line 8.

Share this post


Link to post

Mr.Loki please give me example. ı am newbie about scripts.can you write for me ? ı dont know what ı will add on 8 line.

Share this post


Link to post
function spawn( player )
	local rnd = math.random( 1, #spawns )
	setElementPosition( player, spawns[rnd][1], spawns[rnd][2], spawns[rnd][3] )
	setElementPosition( player, 0 , 0, spawns[rnd][4] )
end
addCommandHandler("pvp",spawn)

 

Share this post


Link to post

local spawns = {
{ -1569.2819824219, 1196.4373779297, 7.1865711212158, 0 },
{ -1661.0703125, 1212.8386230469, 32.897026062012, 0 },
{ -1684.5240478516, 1360.486328125, 7.1721897125244, 0 },
{ -1768.2357177734, 1175.0441894531, 25.125, 0 }
}
function spawn( player )
    local rnd = math.random( 1, #spawns )
    setElementPosition( player, spawns[rnd][1], spawns[rnd][2], spawns[rnd][3] )
    setElementPosition( player, 0 , 0, spawns[rnd][4] )
end
addCommandHandler("pvp",spawn)

 

 

Bro ı did try but its warp to me at BLUBERRY TOWN and just 1 warp.

Share this post


Link to post
local spawns = {
{ -1569.2819824219, 1196.4373779297, 7.1865711212158, 90 },
{ -1661.0703125, 1212.8386230469, 32.897026062012, 90 },
{ -1684.5240478516, 1360.486328125, 7.1721897125244, 90 },
{ -1768.2357177734, 1175.0441894531, 25.125, 90 }
} 
function spawn( player )
local rnd = math.random( 1, #spawns )
setElementPosition( player, spawns[rnd][1], spawns[rnd][2], spawns[rnd][3] )
end
addCommandHandler("pvp",spawn)

 

Share this post


Link to post
9 hours ago, easyrider said:

local spawns = {
{ -1569.2819824219, 1196.4373779297, 7.1865711212158, 0 },
{ -1661.0703125, 1212.8386230469, 32.897026062012, 0 },
{ -1684.5240478516, 1360.486328125, 7.1721897125244, 0 },
{ -1768.2357177734, 1175.0441894531, 25.125, 0 }
}
function spawn( player )
    local rnd = math.random( 1, #spawns )
    setElementPosition( player, spawns[rnd][1], spawns[rnd][2], spawns[rnd][3] )
    setElementPosition( player, 0 , 0, spawns[rnd][4] )
end
addCommandHandler("pvp",spawn)

 

 

Bro ı did try but its warp to me at BLUBERRY TOWN and just 1 warp.

1

 

it's because you have setElementPosition twice the second function should be setElementRotation( player, 0 , 0, spawns[rnd][4] )

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.