Lukis37 Posted July 27, 2011 Share Posted July 27, 2011 Hello, I need help with /wb nickname == Welcome Back, (target Player Name). function wb ( playerSource, command, targetPlayerName ) outputChatBox ("<" .. getPlayerName (playerSource).."> Welcome Back, " ..targetPlayerName.." ! ",getRootElement (), 255, 255, 255, true) end addCommandHandler ( "wb", wb ) I say /wb luk (my nick is Lukis) and says Welcome Back, luk! I need /wb luk = Welcome Back, Lukis! Link to comment
Castillo Posted July 27, 2011 Share Posted July 27, 2011 function wb ( playerSource, command, targetPlayerName ) local playerWho = getPlayerFromName(targetPlayerName) if playerWho then local name = getPlayerName(playerWho) else name = targetPlayerName end outputChatBox ("<" .. getPlayerName (playerSource).."> Welcome Back, " ..tostring(name).." ! ",getRootElement (), 255, 255, 255, true) end addCommandHandler ( "wb", wb ) Link to comment
Lukis37 Posted July 27, 2011 Author Share Posted July 27, 2011 Thank you, but I have same problem. Again: /wb luk = Welcome back, luk! Not: /wb luk = Welcome back, Lukis! Link to comment
BinSlayer1 Posted July 27, 2011 Share Posted July 27, 2011 function findPlayerByName(playerPart) local pl = getPlayerFromName(playerPart) if isElement(pl) then return pl else for i,v in ipairs (getElementsByType ("player")) do if (string.find(string.gsub ( string.lower(getPlayerName(v)), '#%x%x%x%x%x%x', '' ),string.lower(playerPart))) then return v end end end end function wb ( playerSource, command, targetPlayerName ) local playerWho = findPlayerByName(targetPlayerName) if playerWho then local name = getPlayerName(playerWho) else name = targetPlayerName end outputChatBox ("<" .. getPlayerName (playerSource).."> Welcome Back, " ..tostring(name).." ! ",getRootElement (), 255, 255, 255, true) end addCommandHandler ( "wb", wb ) 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