Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetChatLine #14

Open
BigBrainAFK opened this issue Jul 19, 2015 · 4 comments
Open

GetChatLine #14

BigBrainAFK opened this issue Jul 19, 2015 · 4 comments

Comments

@BigBrainAFK
Copy link

I noticed that the function GetChatLine(LineNumber(FromTheBottom), Variable) is missing.

Was it renamed or isn't it in the api?

@BigBrainAFK
Copy link
Author

Here the function from SAMP UDF

; ##### Sonstiges #####
; written by David_Luchs
; returns nth message of chatlog (beggining from bottom)
; -1 = error
GetChatLine(Line, ByRef Output, timestamp=0, color=0){
chatindex := 0
FileRead, file, %A_MyDocuments%\GTA San Andreas User Files\SAMP\chatlog.txt
loop, Parse, file, n,r
{
if(A_LoopField)
chatindex := A_Index
}
loop, Parse, file, n,r
{
if(A_Index = chatindex - line){
output := A_LoopField
break
}
}
file := ""
if(!timestamp)
output := RegExReplace(output, "U)^[\d{2}:\d{2}:\d{2}]")
if(!color)
output := RegExReplace(output, "Ui){[a-f0-9]{6}}")
return
}

@ghost ghost added the enhancement label Jul 25, 2015
@ghost
Copy link

ghost commented Jul 25, 2015

If we have time, we add this without the need of the "chatlog.txt", so the performance is better.

@DavidBrenner3
Copy link

Right now I'm using the chatlog file as well...
But it would be fantastic if the chatlog would be read directly from memory...
Thank you.

@LuxXx
Copy link

LuxXx commented May 28, 2018

getChatLineEx(line := 0) {
    ; 0x152 - offset for first message
    ; 0xFC - size of a message
    ; 99 - max count of a messages
    if(!checkHandles())
        return
    dwPtr := dwSAMP + ADDR_SAMP_CHATMSG_PTR
    dwAddress := readDWORD(hGTA, dwPtr)
    if(ErrorLevel)
        return
    msg := readString(hGTA, dwAddress + 0x152 + ( (99-line) * 0xFC), 0xFC)
    if(ErrorLevel)
        return
    return msg
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants