Arsilex Posted July 13, 2012 Share Posted July 13, 2012 Hola miren tengo esto 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 pm( thePlayer, player, message ) 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 if ( hasObjectPermissionTo ( thePlayer, "command.kick", true ) ) then pm( source, recipent, message ) end end cancelEvent( ) end ) Y como ven intente poner si el player no es admin que no envie el pm pero no funciona el mensaje sigue llegando yo lo que quiero es que los jugadores solo puedan enviar PM a los admines y lo admines a todos los jugadores como aria eso S: Link to comment
Castillo Posted July 13, 2012 Share Posted July 13, 2012 Tu argumento es 'source', pero vos estas usando 'thePlayer' en el evento: 'onPlayerPrivateMessage'. Link to comment
Arsilex Posted July 17, 2012 Author Share Posted July 17, 2012 Mira hize esto pero cuando un admin envia el mensaje dice que el jugador no es admin por que claro el jugador al que envia no es admin como hacer para que un admin puede enviar a todos eso? -- /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 ( hasObjectPermissionTo ( player, "command.kick", true ) ) then if player then pm( thePlayer, player, message ) end else outputChatBox( "Este jugador no es administrador!", thePlayer, 255, 255, 255 ) 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 ) Link to comment
Recommended Posts