Jump to content

Help with creating commands


Lukis37

Recommended Posts

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

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