Jump to content

Help puxa um jogador pra mim


Recommended Posts

 

I'm very beginner, I tried to make this script more did not work

function getPlayer(player, cmd, player2nick)
  local mx, my, mz = getElementPosition(player)
  local player2 = getPlayerFromID ( player2nick )
  for i,v in ipairs(getElementsByType("player2nick")) do 
    local rand = math.random(1, 5)
    setElementPosition(v, mx+rand, my+rand, mz)
  end
end 
addCommandHandler("pux", getPlayer)



 

 


 

Edited by giovanymito
Link to comment
function getPlayer(player, cmd, id)
	if tonumber(id) then
		local mx, my, mz = getElementPosition(player)
		local player2 = getPlayerFromID ( tonumber(id) )
		if not player2 or not isElement(player2) then
			return outputChatBox( "player not found", player )
		end
		local rand = math.random(1, 5)
		
		setElementPosition(player2, mx+rand, my+rand, mz + 1)
	end
end
addCommandHandler("pux", getPlayer)

Try it

P.S: You need to have getPlayerFromID function in your code.

  • Thanks 1
Link to comment
1 hour ago, DNL291 said:

function getPlayer(player, cmd, id)
	if tonumber(id) then
		local mx, my, mz = getElementPosition(player)
		local player2 = getPlayerFromID ( tonumber(id) )
		if not player2 or not isElement(player2) then
			return outputChatBox( "player not found", player )
		end
		local rand = math.random(1, 5)
		
		setElementPosition(player2, mx+rand, my+rand, mz + 1)
	end
end
addCommandHandler("pux", getPlayer)

Try it

P.S: You need to have getPlayerFromID function in your code.

I will test

1 hour ago, DNL291 said:

function getPlayer(player, cmd, id)
	if tonumber(id) then
		local mx, my, mz = getElementPosition(player)
		local player2 = getPlayerFromID ( tonumber(id) )
		if not player2 or not isElement(player2) then
			return outputChatBox( "player not found", player )
		end
		local rand = math.random(1, 5)
		
		setElementPosition(player2, mx+rand, my+rand, mz + 1)
	end
end
addCommandHandler("pux", getPlayer)

Try it

P.S: You need to have getPlayerFromID function in your code.

[2019-07-06 00:09:22] SCRIPT ERROR: [FW]Comandpux/Server.Lua:12: unexpected symbol near '�'
[2019-07-06 00:09:22] ERROR: Loading script failed: [FW]Comandpux/Server.Lua:12: unexpected symbol near '�'

 

Edited by giovanymito
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...