Jump to content

Una ayudita porfis


Arsilex

Recommended Posts

-- /pm to message other players 
local function pm( player, target, message ) 
    outputChatBox( "PM a [" .. exports.players:getID( target ) .. "] " .. getPlayerName( target ) .. ": " .. message, player, 255, 255, 0 ) 
    outputChatBox( "PM de [" .. exports.players:getID( player ) .. "] " .. getPlayerName( player ) .. ": " .. message, target, 255, 255, 0 ) 
end 
  
addCommandHandler( "pm", 
    function( thePlayer, commandName, otherPlayer, ... ) 
        if exports.players:isLoggedIn( thePlayer ) then 
            if otherPlayer and ( ... ) then 
                local message = table.concat( { ... }, " " ) 
                local player, name = exports.players:getFromName( thePlayer, otherPlayer ) 
                if player then 
                    if ( hasObjectPermissionTo ( getThisResource (), "command.kick", true ) ) then 
                        pm( thePlayer, player, message ) 
                    else 
                        outputChatBox( "El jugador no es un administrador", thePlayer, 255, 255, 255 ) 
                    end 
                end 
            else 
                outputChatBox( "Syntax: /" .. commandName .. " [player] [ooc text]", thePlayer, 255, 255, 255 ) 
            end 
        end 
    end 
) 
  
addEventHandler( "onPlayerPrivateMessage", root, 
    function( message, recipent ) 
        if exports.players:isLoggedIn( thePlayer ) and exports.players:isLoggedIn( recipent ) then 
                pm( source, recipent, message ) 
        end 
        cancelEvent( ) 
    end 
) 

Intente poner que no se pueda enviar PM a un jugador que no es admin pero lo que pasa es que cuando lo ago el admin tampoco puedo como ago para que el admin pueda?

Link to comment

intenta esto

addCommandHandler( "pm", 
    function( thePlayer, commandName, otherPlayer, ... ) 
 local account = getPlayerAccount(thePlayer) 
        if exports.players:isLoggedIn( thePlayer ) then 
            if otherPlayer and ( ... ) then 
                local message = table.concat( { ... }, " " ) 
                local player, name = exports.players:getFromName( thePlayer, otherPlayer ) 
                if player then 
 if isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'Admin' ) ) then 
                        pm( thePlayer, player, message ) 
                    else 
                        outputChatBox( "El jugador no es un administrador", thePlayer, 255, 255, 255 ) 
                    end 
                end 
            else 
                outputChatBox( "Syntax: /" .. commandName .. " [player] [ooc text]", thePlayer, 255, 255, 255 ) 
            end 
        end 
    end 
) 

Link to comment

aaaaaaaaah ahora entiendo.

addCommandHandler( "pm", 
    function( thePlayer, commandName, otherPlayer, ... ) 
 local account = getPlayerAccount(thePlayer) 
 local account2 = getPlayerAccount(otherPlayer) 
  
        if exports.players:isLoggedIn( thePlayer ) then 
            if otherPlayer and ( ... ) then 
                local message = table.concat( { ... }, " " ) 
                local player, name = exports.players:getFromName( thePlayer, otherPlayer ) 
                if player then 
 if isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'Everyone' ) ) and   
 if isObjectInACLGroup( 'user.'..getAccountName( account2 ), aclGetGroup( 'Admin' ) ) or 
 if isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'Admin' ) ) and   
 if isObjectInACLGroup( 'user.'..getAccountName( account2 ), aclGetGroup( 'Everyone' ) ) then 
                        pm( thePlayer, player, message ) 
                    else 
                        outputChatBox( "El jugador no es un administrador", thePlayer, 255, 255, 255 ) 
                    end 
                end 
end 
end 
end 
            else 
                outputChatBox( "Syntax: /" .. commandName .. " [player] [ooc text]", thePlayer, 255, 255, 255 ) 
            end 
        end 
    end 
) 

No estoy seguro. :S Dudo mucho, pero testealo

Link to comment
addCommandHandler( "pm", 
    function( thePlayer, commandName, otherPlayer, ... ) 
        if exports.players:isLoggedIn( thePlayer ) then 
            if otherPlayer and ( ... ) then 
                local message = table.concat( { ... }, " " ) 
                local player, name = exports.players:getFromName( thePlayer, otherPlayer ) 
                if player then 
                    if ( hasObjectPermissionTo ( getThisResource (), "command.kick", true ) ) then 
                     if ( hasObjectPermissionTo ( "user."..exports.players:getUserName( name ), "command.kick", true ) ) then 
                        pm( thePlayer, player, message ) 
                    elseif ( hasObjectPermissionTo ( "user."..exports.players:getUserName( player ), "command.kick", true ) ) then 
                        pm( thePlayer, player, message ) 
                      else 
                        outputChatBox( "El jugador no es un administrador", thePlayer, 255, 255, 255 ) 
                    end 
                end 
            else 
                outputChatBox( "Syntax: /" .. commandName .. " [player] [ooc text]", thePlayer, 255, 255, 255 ) 
            end 
        end 
    end 
end 
) 

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...