Não sei se no MTA funcionaria a operação ternária, mas no SA-MP funciona.
function privateMessage(player, command, target, ...)
local target = getPlayerFromPartialName(target)
if timePM[player] then
local tempo = math.floor(getTimerDetails(timePM[player])/1000)
outputChatBox("#0080FF[PM] #FF1717ERROR: #FFFFFFEspere "..tempo.." segundos para enviar outra mensagem", player, 255, 255, 255, true)
playSoundFrontEnd(player, 40)
return
end
outputChatBox(blockPM[target] ? "#0080FF[PM] #FF1717ERROR: #FFFFFFEste jogador bloqueou o recebimento de mensagens" : target == player ? "#0080FF[PM] #FF1717ERROR: #FFFFFFVocê não pode enviar mensagem para si mesmo" : "", player, 255, 255, 255, true)
playSoundFrontEnd(player, 40)
local text = table.concat({...}, " ")
if text ~= "" then
if !isElement(target) then outputChatBox("#0080FF[PM] #FF1717ERROR: #FFFFFFO jogador especificado não foi encontrado", player, 255, 255, 255, true)
outputChatBox("#0080FF[PM] recebida de #FFFFFF"..getPlayerName(player).."#FFFFFF: "..text, target, 255, 255, 255, true)
outputChatBox("#0080FF[PM] para #FFFFFF"..getPlayerName(target).."#FFFFFF: "..text, player, 255, 255, 255, true)
replyPM[player] = target
replyPM[target] = player
triggerClientEvent(target, "playNotifyPM", resourceRoot)
timePM[player] = setTimer(function() timePM[player] = false end, 3000, 1, player)
else
outputChatBox("#0080FF[PM] #FF1717ERROR: #FFFFFFSYNTAX: /pm <jogador> <mensagem>", player, 255, 255, 255, true)
end
end