Arsilex Posted August 21, 2012 Share Posted August 21, 2012 -- /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
BorderLine Posted August 21, 2012 Share Posted August 21, 2012 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
Arsilex Posted August 21, 2012 Author Share Posted August 21, 2012 nada esto lo unico que cambio es que ahora los Player no pueden enviar PM ni a admin ni a Player y los Admins si Lo que yo quiero es que los player solo puedan a admin y admin a todos Link to comment
BorderLine Posted August 22, 2012 Share Posted August 22, 2012 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. Dudo mucho, pero testealo Link to comment
Arsilex Posted August 22, 2012 Author Share Posted August 22, 2012 no funciona ya que esto es paradise y el getacount te devulve nil Link to comment
BorderLine Posted August 22, 2012 Share Posted August 22, 2012 aaah entonces me pillaste man yo nose mas alla ke eso Link to comment
Arsilex Posted August 22, 2012 Author Share Posted August 22, 2012 bueno grax aver si logro hacer algo con eso Link to comment
Alexs Posted August 23, 2012 Share Posted August 23, 2012 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
Recommended Posts