Jump to content

[HELP] WarpToMe script.


Recommended Posts

Hi! I've started learning to script LUA and i want to warp players TO me by command instead of admin panel but my currect script isn't working, some help would be appreciated.

 

addCommandHandler( "w2m", 
    function( sourcePlayer, command, targetPlayerName ) 
		if targetPlayerName then -- We check if an target has been set
			if getPlayerFromName(targetPlayerName) then -- We get the player element instead of the player name.
				if not (targetPlayerName == getPlayerName(sourcePlayer)) then -- We make sure the player isn't trying to warp to himself
					setElementPosition( targetPlayerName, 0, 0, 3 )
				else
					outputChatBox("[Error] You can't warp to yourself!", sourcePlayer, 255, 0, 0, false)
					return false
				end
			else
				outputChatBox("[Error] Player could not be found, maybe he/she is offline?", sourcePlayer, 255, 0, 0, false)
				return false
			end
		else
			outputChatBox("[Error] Please choose a target", sourcePlayer, 255, 0, 0, false)
			return false
		end
    end 
) 

Error:

Quote

 WARNING: WarpToMe/script.lua:6: Bad argument @ 'setElementPosition' [
Expected element at argument 1, got string '#000000Bossdavid']

Thanks in advance!

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