Jump to content

need this


Recommended Posts

I really don't understand, you want to output when the player uses a command, and which commnd is that?

addEventHandler ( "onPlayerCommand", root, 
    function ( cmd ) 
        outputChatBox ( getPlayerName ( source ) .." used the command /".. cmd ) 
    end 
) 

Link to comment
addCommandHandler ( "hello", 
    function ( thePlayer, _, who ) 
        local playerWho = getPlayerFromName ( who ) -- Get the player from the string entered on the command. 
        if ( playerWho ) then -- If the player really exists... 
            outputChatBox ( getPlayerName ( thePlayer ) .." says hello!", playerWho ) -- Output a chatbox message to him. 
        end 
    end 
) 

Link to comment
addCommandHandler ( "warpt", 
    function ( thePlayer, _, who ) 
        local playerWho = getPlayerFromName ( who ) -- Get the player from the string entered on the command. 
        if ( playerWho ) then -- If the player really exists... 
    setElementPosition ( playerWho, x, y, z ) 
        end 
    end 
) 

Link to comment

\/

function teleportarPlayer (player, CMD, targetName, thePlayer) 
local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) 
     if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then   
        if not targetName then 
            outputChatBox("Uso Correto: /tep nick", player) 
        else 
            local target = getPlayerFromName (targetName ) 
            if not target then -- check if the name is valit 
                outputChatBox("ERRO: Jogador não encontra-se online!", player) 
            else 
                local x,y,z = getElementPosition ( target ) 
                setElementPosition ( player,x,y,z+1) 
                --setElementPosition ( player, getElementPosition ( target )) 
            end 
        end 
    end 
    addCommandHandler ( "tep", teleportarPlayer  ) 

Link to comment
\/
function teleportarPlayer (player, CMD, targetName, thePlayer) 
local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) 
     if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then   
        if not targetName then 
            outputChatBox("Uso Correto: /tep nick", player) 
        else 
            local target = getPlayerFromName (targetName ) 
            if not target then -- check if the name is valit 
                outputChatBox("ERRO: Jogador não encontra-se online!", player) 
            else 
                local x,y,z = getElementPosition ( target ) 
                setElementPosition ( player,x,y,z+1) 
                --setElementPosition ( player, getElementPosition ( target )) 
            end 
        end 
    end 
    addCommandHandler ( "tep", teleportarPlayer  ) 

will that do it? why the outputchatboxs?

Link to comment
addCommandHandler ( "warpt", 
    function ( thePlayer, _, who ) 
        local playerWho = getPlayerFromName ( who ) -- Get the player from the string entered on the command. 
        if ( playerWho ) then -- If the player really exists... 
    setElementPosition ( playerWho, x, y, z ) 
        end 
    end 
) 

Are the "x, y, z" defined smoewhere at the script ?

Link to comment

try

addCommandHandler ( "warpt", 
    function ( thePlayer, _, who ) 
        local playerWho = getPlayerFromName ( who )  
        if ( playerWho ) then  
        local x, y, z = getElementPosition(playerWho) 
    setElementPosition ( thePlayer, x, y, z ) 
        end 
    end 
) 
  

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