joedajoester Posted January 17, 2012 Share Posted January 17, 2012 I need it so someone can type, warp me to [a playername] function sendMessage2( messageclean, messageType, commandName, player2nick, ..name ) if (string.find(messageclean, "warp") and string.find(messageclean, "..name")) then outputChatBox("You asked!", source, 0, 255, 0) executeCommandHandler ( "warp", "..name", source ) end end addEventHandler("onPlayerChat",root,sendMessage2) i just dont understand how the .. works Link to comment
FatalTerror Posted January 17, 2012 Share Posted January 17, 2012 Like that ? addEventHandler("onPlayerChat", getRootElement(), function(message, messageType) if message then if(string.find(message, "warp me to"))then local player = gettok ( message, 4, string.byte(' ') ) outputChatBox("Okey ! Warp now !") executeCommandHandler ( "warp", player, source ) end end end) Link to comment
joedajoester Posted January 17, 2012 Author Share Posted January 17, 2012 Bad argument @ executeCommandHandler expected element at argument 2 got string carl Carl was a player in the game. Nothing happens when i type, warp me to Carl. It says okey warp now Link to comment
arezu Posted January 17, 2012 Share Posted January 17, 2012 player = getPlayerFromName(player) executeCommandHandler("warp", source, player) Link to comment
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