npwd icon indicating copy to clipboard operation
npwd copied to clipboard

Bug: onMessage

Open frazz1234 opened this issue 3 years ago • 7 comments

Development Issue

Yes

Phone Version

Last one

Issue Description

Im using this export :

exports.npwd:onMessage('911', function(ctx)
    local sendernmbr = exports.npwd:getPhoneNumber(ctx.source)
    local police = ESX.GetExtendedPlayers('job','police')
    for i = 1, #police do
        local targetnmbr = exports.npwd:getPhoneNumber(police[i].playerId)
        exports.npwd:emitMessage({
            senderNumber = sendernmbr,
            targetNumber = targetnmbr,
            message = ctx.data.message,
        })                
    end
end)

20220709012344_1

direct after receive this message in my phone i got this error : 20220709012406_1

Issue Reproduction

apply the export you will see

Evidence

No response

frazz1234 avatar Jul 09 '22 05:07 frazz1234

this error still going if i press on the empty message

frazz1234 avatar Jul 09 '22 05:07 frazz1234

can you provide a framework agnostic reproduction since none of our developers are using ESX

LiamDormon avatar Jul 09 '22 10:07 LiamDormon

Im using the legacy one, https://github.com/esx-framework/esx-legacy

frazz1234 avatar Jul 09 '22 17:07 frazz1234

Try exports.npwd:getPhoneNumber(police[i].source)

itschip avatar Jul 09 '22 18:07 itschip

I will try it today.

I see an other bug, I'm using ESX legacy like I told you and ox inventory , I have everything set up good.

But if I'm connect and I don't have the phone I can receive notifications from my phone when someone call. I can't answer.

frazz1234 avatar Jul 10 '22 20:07 frazz1234

@frazz1234 did chips change fix the error?

SamShanks1 avatar Jul 19 '22 12:07 SamShanks1

Hello, Ive already wrote something on PE discord, but I wanted to make it official here too: Thats my snippet and I know the error. The problem here is, that if you are police yourself you are receiving the message you send to the police yourself. So if you are texting a message to 911 not only will the message appear in the 911 chat, but you will send YOURSELF a message with that. Clicking on one of the empty chats will show you this error, since npwd isnt able to create a message-conversation with yourself.

For everyone in need of that snippet, because they want a possibility for the police to get messages rp-wise Id recommend to take a look at Mojitos npwd-dispatch script, which utilizes exactly that, just way better and smarter.

ItzTrivialOld avatar Jul 29 '22 14:07 ItzTrivialOld