Jump to content

Commands for people..


Xeno

Recommended Posts

function sayHello(thePlayer, cmd, who) 
    if (who and who ~= "") then 
        local player = getPlayerFromName(who) 
        if (not player) then outputChatBox("This player does not exists.",thePlayer,255,0,0) return end 
        outputChatBox("Hello ".. getPlayerName(player) .. " from ".. getPlayerName(thePlayer) .."!",player,0,255,0) 
    end 
end 
addCommandHandler("hello",sayHello) 

That?

Link to comment
function sayHello(thePlayer, cmd, who) 
    if (who and who ~= "") then 
        local player = getPlayerFromName(who) 
        if (not player) then outputChatBox("This player does not exists.",thePlayer,255,0,0) return end 
        outputChatBox("Hello ".. getPlayerName(player) .. " from ".. getPlayerName(thePlayer) .."!",player,0,255,0) 
    end 
end 
addCommandHandler("hello",sayHello) 

That?

Yes, that is exactly what I need... But I need to setElementData with it, so I can do something like /setrank Awesome

I gave it ago...:

function sayHello(thePlayer, cmd, who) 
    if (who and who ~= "") then 
        local player = getPlayerFromName(who) 
        if (not player) then outputChatBox("This player does not exists.",thePlayer,255,0,0) return end 
      setElementData(player,"Rank","Awesome") 
    end 
end 
addCommandHandler("setRank",sayHello) 

But I guess this wouldn't work..

Link to comment
function setRank(thePlayer, cmd, who) 
    if (who and who ~= "") then 
        local player = getPlayerFromName(who) 
        if (not player) then outputChatBox("This player does not exists.",thePlayer,255,0,0) return end 
        setElementData(player,"Rank","Awesome") 
    end 
end 
addCommandHandler("setRank",setRank) 

Link to comment

Of course it's possible.

function setRank(thePlayer, cmd, who, ...) 
    if (who and who ~= "") then 
        local player = getPlayerFromName(who) 
        local rank = table.concat({...}, " ") 
        if (not player) then outputChatBox("This player does not exists.",thePlayer,255,0,0) return end 
        setElementData(player,"Rank",tostring(rank)) 
    end 
end 
addCommandHandler("setRank",setRank) 

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