AHK SAMP UdfEx (0.3.7)

Rat

Active member
Joined
Sep 24, 2013
Messages
137
Reaction score
0
Re: [AHK] samp UdfEx (0.3.7)

democrazy link said:
here's my
Code:
getActorModelId()
{
    if(!checkHandles())
        return -1

	dwCPedPtr := readDWORD(hGTA, ADDR_CPED_PTR)
    if(ErrorLevel) {
        ErrorLevel := ERROR_READ_MEMORY
        return -1
    }
	
	if(!dwCPedPtr)
		return -1
	
	dwVal := readMem(hGTA, dwCPedPtr + 0x22, 2, "UShort")
    if(ErrorLevel) {
        ErrorLevel := ERROR_READ_MEMORY
        return -1
    }
	
	return dwVal
}
thanks [member=24017]democrazy[/member] and [member=26902]luxdav[/member]
:stoned:
 

luxdav

Active member
Joined
Sep 17, 2014
Messages
45
Reaction score
5
Re: [AHK] samp UdfEx (0.3.7)

Aw, yea I took just one signed byte, it should be

Code:
id := readMem(hGTA, dwAddress + 0x22, 2, "UShort")
 

capo1337

Member
Joined
Jul 9, 2015
Messages
7
Reaction score
0
Re: [AHK] samp UdfEx (0.3.7)

Hey Is it possible to Return true if i hit my Target and when yes How ? So i Can make hitsounds and other stuft with AHK ?
 

luxdav

Active member
Joined
Sep 17, 2014
Messages
45
Reaction score
5
Re: [AHK] samp UdfEx (0.3.7)

Here are my getDialogText and getDialogTitle Functions:

Code:
; get the text in dialog
; @author luxdav aka David_Luchs
getDialogText()
{
	if(!checkHandles())
		return ""
	dwAddress := readDWORD(hGTA, dwSAMP + 0x21A0FC)
	if(ErrorLevel) {
		ErrorLevel := ERROR_READ_MEMORY
		return ""
	}
	dwAddress := readDWORD(hGTA, dwAddress + 0x1C)
	if(ErrorLevel) {
		ErrorLevel := ERROR_READ_MEMORY
		return ""
	}
	text := readString(hGTA, dwAddress, 4096)
	if(ErrorLevel) {
		ErrorLevel := ERROR_READ_MEMORY
		return ""
	}

	ErrorLevel := ERROR_OK
	return text
}
Code:
; get the title of dialog
; @author luxdav aka David_Luchs
getDialogTitle()
{
	if(!checkHandles())
		return ""
	dwAddress := readDWORD(hGTA, dwSAMP + 0x21A0B8)
	if(ErrorLevel) {
		ErrorLevel := ERROR_READ_MEMORY
		return ""
	}
	text := readString(hGTA, dwAddress + 0x40, 128)
	if(ErrorLevel) {
		ErrorLevel := ERROR_READ_MEMORY
		return ""
	}

	ErrorLevel := ERROR_OK
	return text
}
pls approve this, it's quite untested
 

Suicide Bomb

Active member
Joined
Jun 22, 2014
Messages
100
Reaction score
1
Re: [AHK] samp UdfEx (0.3.7)

Is it possible to make a function like getPlayerColor(playerid)? Thank you in advance!
 

democrazy

Active member
Joined
Aug 4, 2014
Messages
65
Reaction score
0
Re: [AHK] samp UdfEx (0.3.7)

color is some rgba shit
0xff0000ff  is red
0x00ff00ff  is green
etc.


Code:
getplayercolor(id)
{
    id += 0
    
    if(!checkHandles())
        return -1
    
    color := readDWORD(hGTA, dwSAMP + 0x216378 + 4*id)
    if(ErrorLevel) {
        ErrorLevel := ERROR_READ_MEMORY
        return -1
    }
    return color
}

setplayercolor(id,color)
{
    id += 0
    color +=0

    if(!checkHandles())
        return
    
    VarSetCapacity(bla, 4, 0)
    NumPut(color,bla,0,"UInt")
    
    writeRaw(hGTA, dwSAMP + 0x216378 + 4*id, &bla, 4)
}
 

Bugman

Active member
Joined
Aug 14, 2014
Messages
68
Reaction score
0
Re: [AHK] samp UdfEx (0.3.7)

Getplayercolor returns shitty number, Not the rgb
 

0x17BD

Member
Joined
Apr 29, 2014
Messages
6
Reaction score
0
Re: [AHK] samp UdfEx (0.3.7)

convert it from decimal into hexadecimal  :urtheman:
 

democrazy

Active member
Joined
Aug 4, 2014
Messages
65
Reaction score
0
Re: [AHK] samp UdfEx (0.3.7)

simple color to hex for color embedding:

Code:
ColorToStr(color)
{
    color += 0
    color >>= 8
    color &= 0xffffff
    SetFormat, IntegerFast, hex
    color += 0
    color .= ""
    StringTrimLeft, color, color, 2
    SetFormat, IntegerFast, d
    return "{" color "}"
}
 

Suicide Bomb

Active member
Joined
Jun 22, 2014
Messages
100
Reaction score
1
Re: [AHK] samp UdfEx (0.3.7)

Thank you. :D

Is it possible to make a script that gives you ammo to your current weapon and then quickly writes a command?

[member=24017]democrazy[/member] [member=26902]luxdav[/member] please :D
 

Rat

Active member
Joined
Sep 24, 2013
Messages
137
Reaction score
0
Re: [AHK] samp UdfEx (0.3.7)

please convert/add this:

Code:
{$CLEO .cs}

thread 'MESSAGES'

REPEAT
    wait 0
UNTIL 0AFA:   SAMP_IS_READY

while true
    wait 0
    0AC8:   1@ = allocate_memory_size 145
    0AB1:   call @getChatEntryText 1 id 99 to 1@
    
    if
        0C18:   2@ = strstr string1 1@ string2 "Your fuel is low."
    then
        6@ = Audiostream.Load("CLEO/snds/TOASTY.mp3")
        Audiostream.PerformAction(6@, PLAY)
        wait 100
    end
end

:GETCHATENTRYTEXT
IF 0AA2: 1@ = "samp.dll"
THEN
    1@ += 0x21A0E4
    0A8D: 1@ readMem 1@ sz 4 vp 0
    1@ += 0x132
    0@ *= 0xFC
    005A: 1@ += 0@ 
    1@ += 0x20
    0AA3: 1@
END
0AB2: ret 1 1@
 

democrazy

Active member
Joined
Aug 4, 2014
Messages
65
Reaction score
0
Re: [AHK] samp UdfEx (0.3.7)

if i got this right, it will play some sound if "Your fuel is low." is printed in chat?

then you can already do this with existing ahk functions
loop read, SoundPlay
 

Rat

Active member
Joined
Sep 24, 2013
Messages
137
Reaction score
0
Re: [AHK] samp UdfEx (0.3.7)

democrazy link said:
if i got this right, it will play some sound if "Your fuel is low." is printed in chat?

then you can already do this with existing ahk functions
loop read, SoundPlay
correct.  :urtheman:
 

Suicide Bomb

Active member
Joined
Jun 22, 2014
Messages
100
Reaction score
1
Re: [AHK] samp UdfEx (0.3.7)

luxdav link said:
Dude, here are my functions:

Code:
; sets the ingame hour (day/night)
; @author luxdav aka David_Luchs
; @param hour the time between 0 and 23
setTime(hour)
{
	if(!checkHandles())
		return
	; disable gta setTime function
	VarSetCapacity(nop, 6, 0)
	Loop 6 {
		NumPut(0x90,nop,A_INDEX-1,"UChar")
	}
	writeRaw(hGTA, 0x52D168, &nop, 6)

	; set our own weather
	VarSetCapacity(time, 1, 0)
	NumPut(hour, time,0,"Int")
	writeRaw(hGTA, 0xB70153, &time, 1)
}

Greets luxdav
Can you fix this one? It only sets the time for a milisecond or so.
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
271
Re: [AHK] samp UdfEx (0.3.7)

@smn for time, nop this too -> samp.dll+9C0B4, same instruction.
 

Ghost29

Member
Joined
Mar 11, 2015
Messages
10
Reaction score
1
Hello
Can't get it by myself, so
How to get amount of patrons?

some sketches:
Code:
numpad2:: 
patron := ReadMemory(0x0FCE82CC,"GTA:SA:MP")
addchatmsg(patron) 
return 

ReadMemory(MADDRESS,PROGRAM) 
{ 
winget, pid, PID, %PROGRAM% 

VarSetCapacity(MVALUE,4,0) 
ProcessHandle := DllCall("OpenProcess", "Int", 24, "Char", 0, "UInt", pid, "UInt") 
DllCall("ReadProcessMemory","UInt",ProcessHandle,"UInt",MADDRESS,"Str",MVALUE,"UInt",4,"UInt *",0) 

Loop 4 
result += *(&MVALUE + A_Index-1) « 8*(A_Index-1) 

return, result 
}

doesn't work(
can you write function for it? getWeaponAmmo() ...
 

Bl4ck5t3R

New member
Joined
Nov 6, 2014
Messages
3
Reaction score
0
There is the function getPedCarInfo(dwPED) 

but how do i get the car dll e.g. from an other player?

greetz
 

democrazy

Active member
Joined
Aug 4, 2014
Messages
65
Reaction score
0
what do you mean by "car dll"?
if you want like samp vehicle id, then you have to make some function like getGTAVehicleFromSAMPVehicleID from mod_sa
 
Top