Jump to content

Help puxa um jogador pra mim


Recommended Posts

Posted

We can't give you code we are here to help you learn and imporve your code not make it for you if you want a ready resource here is wrong section 

Posted (edited)

 

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
Posted
14 hours ago, Dimos7 said:

We can't give you code we are here to help you learn and imporve your code not make it for you if you want a ready resource here is wrong section 

 

Posted
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
Posted (edited)
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

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