FallenEvolution Posted December 19, 2017 Posted December 19, 2017 (edited) 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 December 19, 2017 by FallenEvolution
koragg Posted December 19, 2017 Posted December 19, 2017 (edited) You're trying to set position of a string, not of a player. You should put getPlayerFromName (targetPlayerName) instead of targetPlayerName in setElementPosition function. Edited December 19, 2017 by koragg I love rock/metal/pop but don't mind any other music genre except чалга...that thing sux I also love cars PS I'm friendly
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now