Some snippets

OP
OP
Parazitas

Parazitas

Well-Known Member
Joined
Jan 2, 2017
Messages
2,229
Likes
420
Points
113
Location
Lithuania
Website
ugbase.eu
20
#41
but how to do the opposite?
PHP:
:GetPlayerTargetedEntity
{
    if
    0AB1: @GetPlayerTargetedEntity 0 _Return: TargetedActorHandle [email protected]
    then
        // do something...
    end
}
0470: [email protected] = actor $PLAYER_ACTOR current_weapon
[email protected] *= 0x70 
[email protected] += 0xC8AAB8 
[email protected] += 0x8 
0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0 // weapon range

    0A96: [email protected] = actor $PLAYER_ACTOR struct
    0A8D: [email protected] = read_memory 0xB6F1A8 size 2 virtual_protect 0 // TheCamera.m_aCams.m_wCamMode
    0AA6: call_method 0x5E4280 struct [email protected] num_params 3 pop 0 bIncludeAnim 1 iBoneID 25 vPosition [email protected] // CPed__getBonePosition
    000B: [email protected] += 0.3
    if or
        0039:   [email protected] == 53
        0039:   [email protected] == 55
    then
        0AA6: call_method 0x514970 struct 0xB6F028 num_params 6 pop 0 _targetOut [email protected] _cameraOut [email protected] _z [email protected] _y [email protected] _x [email protected] _range [email protected] // CCamera::Find3rdPersonCamTargetVector
    else
        068E: get_camera_target_point_to [email protected] [email protected] [email protected]
        068D: get_camera_position_to [email protected] [email protected] [email protected]
        0087: [email protected] = [email protected] // (float)
        0087: [email protected] = [email protected] // (float)
        0087: [email protected] = [email protected] // (float)
       
        0063: [email protected] -= [email protected]  // (float)
        0063: [email protected] -= [email protected]  // (float)
        0063: [email protected] -= [email protected]  // (float)
       
        0087: [email protected] = [email protected] // (float)
        0087: [email protected] = [email protected] // (float)
        0087: [email protected] = [email protected] // (float)
       
        0013: [email protected] *= [email protected]
        0013: [email protected] *= [email protected]
        0013: [email protected] *= [email protected]
       
        0087: [email protected] = [email protected] // (float)
        0087: [email protected] = [email protected] // (float)
        0087: [email protected] = [email protected] // (float)

        0063: [email protected] -= [email protected]  // (float)
        0063: [email protected] -= [email protected]  // (float)
        0063: [email protected] -= [email protected]  // (float)
       
        0063: [email protected] -= [email protected] // (float)
        0063: [email protected] -= [email protected] // (float)
        0063: [email protected] -= [email protected] // (float)

    end
    0006: [email protected] = 0 // entity = NULL
    0AA7: call_function 0x56BA00 num_params 12 pop 12 0 0 0 0 _objects 1 _peds 1 _vehicles 1 _buildings 1 _pEntity [email protected] _colPoint [email protected] _end [email protected] _start [email protected] _result: [email protected] // CWorld::ProcessLineOfSight
    0006: [email protected] = 0
    0006: [email protected] = 0
   
    if
    [email protected] <> 0
    then
        0A8E: [email protected] = [email protected] + 0x36 // [email protected] Entity struct
        0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0 // entity->m_nStatusType
        0B10: [email protected] = [email protected] AND 7
        if
        [email protected] == 3 // ENTITY_TYPE_PED
        then
            0A96: [email protected] = actor $PLAYER_ACTOR struct
            if
            803B:   not [email protected] == [email protected]  // (int)
            then
                0AEA: [email protected] = actor_struct [email protected] handle
            end
        end
    end

if 056D:   actor [email protected] defined
then 0485:  return_true
else 059A:  return_false
end
0AB2: ret 1 [email protected]
 
Last edited:
OP
OP
Parazitas

Parazitas

Well-Known Member
Joined
Jan 2, 2017
Messages
2,229
Likes
420
Points
113
Location
Lithuania
Website
ugbase.eu
20
#42
Makes your vehicle drive max speed as vehicle can..
PHP:
:SetVehicleMaxSpeed
// 0AB1: @SetVehicleMaxSpeed 0
03C0: [email protected] = actor $PLAYER_ACTOR car
0441: [email protected] = car [email protected] model
[email protected] *= 4
[email protected] += 0xA9B0C8
0A8D: [email protected] [email protected] 4 0
[email protected] += 0x4A
0A8D: [email protected] [email protected] 2 0
[email protected] *= 0xE0
[email protected] += 0xC2B9DC
[email protected] = 0x88
005A: [email protected] [email protected]
0A8D: [email protected] [email protected] 4 0
[email protected] *= 60.0
00AD: set_car [email protected] max_speed_to [email protected]
0AB2: 0
 
OP
OP
Parazitas

Parazitas

Well-Known Member
Joined
Jan 2, 2017
Messages
2,229
Likes
420
Points
113
Location
Lithuania
Website
ugbase.eu
20
#43
Player Name By ID
PHP:
:GetPlayerNameByID
{
    0.3.7 R1
    0AB1: @GetPlayerNameByID 1 ID 995 _Returned: Name [email protected]
}
if 0AA2: [email protected] = loadLib "samp.dll" //samp base offset 
then       
    [email protected] += 0x21A0F8
    0A8D: [email protected] = readmem [email protected] sz 4 vp 0 //stInfo 
    [email protected] += 0x3CD
    0A8D: [email protected] = readmem [email protected] sz 4 vp 0 //stPools
    [email protected] += 0x18
    0A8D: [email protected] = readmem [email protected] sz 4 vp 0 //stPlayerPools
    [email protected] += 0x2E
    [email protected] *= 0x4
    005A: [email protected] += [email protected]
    0A8D: [email protected] readMem [email protected] sz 4 vp 0
    if [email protected] > 0
    then
        [email protected] += 0xC
        0A8D: [email protected] readMem [email protected] sz 4 vp 0
        [email protected] += 0x0            
        0A8D: [email protected] = readmem 0x8580DC sz 4 vp 0 // 0x8580DC - KERNEL32.lstrlenA
        0AA7: strlen_addr [email protected] num_params 1 pop 0 string [email protected] _returned_length [email protected]
        if [email protected] > 0
        then 0AB2: ret 1 [email protected]
        else 0AB2: ret 1 [email protected]
        end
    end
end
0AB2: ret 0
PHP:
:GetPlayerNameByID
{
    0.3.7 R2
    0AB1: @GetPlayerNameByID 1 ID 995 _Returned: Name [email protected]
}
if 0AA2: [email protected] = loadLib "samp.dll" //samp base offset 
then       
    [email protected] += 0x21A100
    0A8D: [email protected] = readmem [email protected] sz 4 vp 0 //stInfo 
    [email protected] += 0x3C5
    0A8D: [email protected] = readmem [email protected] sz 4 vp 0 //stPools
    [email protected] += 0x8
    0A8D: [email protected] = readmem [email protected] sz 4 vp 0 //stPlayerPools
    [email protected] += 0x26
    [email protected] *= 0x4
    005A: [email protected] += [email protected]
    0A8D: [email protected] readMem [email protected] sz 4 vp 0
    if [email protected] > 0
    then
        [email protected] += 0x14
        0A8D: [email protected] readMem [email protected] sz 4 vp 0
        [email protected] += 0x0            
        0A8D: [email protected] = readmem 0x8580DC sz 4 vp 0 // 0x8580DC - KERNEL32.lstrlenA
        0AA7: strlen_addr [email protected] num_params 1 pop 0 string [email protected] _returned_length [email protected]
        if [email protected] > 0
        then 0AB2: ret 1 [email protected]
        else 0AB2: ret 1 [email protected]
        end
    end
end
0AB2: ret 0
PHP:
:GetPlayerNameByID
{
    0.3.7 R4
    0AB1: @GetPlayerNameByID 1 ID 995 _Returned: Name [email protected]
}
if 0AA2: [email protected] = loadLib "samp.dll" //samp base offset 
then       
    [email protected] += 0x26EA0C
    0A8D: [email protected] = readmem [email protected] sz 4 vp 0 //stInfo 
    [email protected] += 0x3DE
    0A8D: [email protected] = readmem [email protected] sz 4 vp 0 //stPools
    [email protected] += 0x8
    0A8D: [email protected] = readmem [email protected] sz 4 vp 0 //stPlayerPools
    [email protected] += 0x2E
    [email protected] *= 0x4
    005A: [email protected] += [email protected]
    0A8D: [email protected] readMem [email protected] sz 4 vp 0
    if [email protected] > 0
    then
        [email protected] += 0x18
        0A8D: [email protected] readMem [email protected] sz 4 vp 0
        [email protected] += 0x0            
        0A8D: [email protected] = readmem 0x8580DC sz 4 vp 0 // 0x8580DC - KERNEL32.lstrlenA
        0AA7: strlen_addr [email protected] num_params 1 pop 0 string [email protected] _returned_length [email protected]
        if [email protected] > 0
        then 0AB2: ret 1 [email protected]
        else 0AB2: ret 1 [email protected]
        end
    end
end
0AB2: ret 0
PHP:
:GetPlayerNameByID
{
    0.3.DL
    0AB1: @GetPlayerNameByID 1 ID 995 _Returned: Name [email protected]
}
if 0AA2: [email protected] = loadLib "samp.dll" //samp base offset 
then       
    [email protected] += 0x2ACA24
    0A8D: [email protected] = readmem [email protected] sz 4 vp 0 //stInfo 
    [email protected] += 0x3DE
    0A8D: [email protected] = readmem [email protected] sz 4 vp 0 //stPools
    [email protected] += 0x8
    0A8D: [email protected] = readmem [email protected] sz 4 vp 0 //stPlayerPools
    [email protected] += 0x26
    [email protected] *= 0x4
    005A: [email protected] += [email protected]
    0A8D: [email protected] readMem [email protected] sz 4 vp 0
    if [email protected] > 0
    then
        [email protected] += 0x14
        0A8D: [email protected] readMem [email protected] sz 4 vp 0
        [email protected] += 0x0            
        0A8D: [email protected] = readmem 0x8580DC sz 4 vp 0 // 0x8580DC - KERNEL32.lstrlenA
        0AA7: strlen_addr [email protected] num_params 1 pop 0 string [email protected] _returned_length [email protected]
        if [email protected] > 0
        then 0AB2: ret 1 [email protected]
        else 0AB2: ret 1 [email protected]
        end
    end
end
0AB2: ret 0
 
Last edited:

xAmUser

Active Member
Joined
Feb 23, 2018
Messages
35
Likes
1
Points
23
5
#44
Player Name By ID
PHP:
:GetPlayerNameByID
{
    0.3.7 R1
    0AB1: @GetPlayerHealthByID 1 ID 995 _Returned: Name [email protected]
}
if 0AA2: [email protected] = loadLib "samp.dll" //samp base offset 
then       
    [email protected] += 0x21A0F8
    0A8D: [email protected] = readmem [email protected] sz 4 vp 0 //stInfo 
    [email protected] += 0x3CD
    0A8D: [email protected] = readmem [email protected] sz 4 vp 0 //stPools
    [email protected] += 0x18
    0A8D: [email protected] = readmem [email protected] sz 4 vp 0 //stPlayerPools
    [email protected] += 0x2E
    [email protected] *= 0x4
    005A: [email protected] += [email protected]
    0A8D: [email protected] readMem [email protected] sz 4 vp 0
    if [email protected] > 0
    then
        [email protected] += 0xC
        0A8D: [email protected] readMem [email protected] sz 4 vp 0
        [email protected] += 0x0            
        0A8D: [email protected] = readmem 0x8580DC sz 4 vp 0 // 0x8580DC - KERNEL32.lstrlenA
        0AA7: strlen_addr [email protected] num_params 1 pop 0 string [email protected] _returned_length [email protected]
        if [email protected] > 0
        then 0AB2: ret 1 [email protected]
        else 0AB2: ret 1 [email protected]
        end
    end
end
0AB2: ret 0
PHP:
:GetPlayerNameByID
{
    0.3.7 R2
    0AB1: @GetPlayerHealthByID 1 ID 995 _Returned: Name [email protected]
}
if 0AA2: [email protected] = loadLib "samp.dll" //samp base offset 
then       
    [email protected] += 0x21A100
    0A8D: [email protected] = readmem [email protected] sz 4 vp 0 //stInfo 
    [email protected] += 0x3C5
    0A8D: [email protected] = readmem [email protected] sz 4 vp 0 //stPools
    [email protected] += 0x8
    0A8D: [email protected] = readmem [email protected] sz 4 vp 0 //stPlayerPools
    [email protected] += 0x26
    [email protected] *= 0x4
    005A: [email protected] += [email protected]
    0A8D: [email protected] readMem [email protected] sz 4 vp 0
    if [email protected] > 0
    then
        [email protected] += 0x14
        0A8D: [email protected] readMem [email protected] sz 4 vp 0
        [email protected] += 0x0            
        0A8D: [email protected] = readmem 0x8580DC sz 4 vp 0 // 0x8580DC - KERNEL32.lstrlenA
        0AA7: strlen_addr [email protected] num_params 1 pop 0 string [email protected] _returned_length [email protected]
        if [email protected] > 0
        then 0AB2: ret 1 [email protected]
        else 0AB2: ret 1 [email protected]
        end
    end
end
0AB2: ret 0
PHP:
:GetPlayerNameByID
{
    0.3.7 R4
    0AB1: @GetPlayerHealthByID 1 ID 995 _Returned: Name [email protected]
}
if 0AA2: [email protected] = loadLib "samp.dll" //samp base offset 
then       
    [email protected] += 0x26EA0C
    0A8D: [email protected] = readmem [email protected] sz 4 vp 0 //stInfo 
    [email protected] += 0x3DE
    0A8D: [email protected] = readmem [email protected] sz 4 vp 0 //stPools
    [email protected] += 0x8
    0A8D: [email protected] = readmem [email protected] sz 4 vp 0 //stPlayerPools
    [email protected] += 0x2E
    [email protected] *= 0x4
    005A: [email protected] += [email protected]
    0A8D: [email protected] readMem [email protected] sz 4 vp 0
    if [email protected] > 0
    then
        [email protected] += 0x18
        0A8D: [email protected] readMem [email protected] sz 4 vp 0
        [email protected] += 0x0            
        0A8D: [email protected] = readmem 0x8580DC sz 4 vp 0 // 0x8580DC - KERNEL32.lstrlenA
        0AA7: strlen_addr [email protected] num_params 1 pop 0 string [email protected] _returned_length [email protected]
        if [email protected] > 0
        then 0AB2: ret 1 [email protected]
        else 0AB2: ret 1 [email protected]
        end
    end
end
0AB2: ret 0
PHP:
:GetPlayerNameByID
{
    0.3.DL
    0AB1: @GetPlayerHealthByID 1 ID 995 _Returned: Name [email protected]
}
if 0AA2: [email protected] = loadLib "samp.dll" //samp base offset 
then       
    [email protected] += 0x2ACA24
    0A8D: [email protected] = readmem [email protected] sz 4 vp 0 //stInfo 
    [email protected] += 0x3DE
    0A8D: [email protected] = readmem [email protected] sz 4 vp 0 //stPools
    [email protected] += 0x8
    0A8D: [email protected] = readmem [email protected] sz 4 vp 0 //stPlayerPools
    [email protected] += 0x26
    [email protected] *= 0x4
    005A: [email protected] += [email protected]
    0A8D: [email protected] readMem [email protected] sz 4 vp 0
    if [email protected] > 0
    then
        [email protected] += 0x14
        0A8D: [email protected] readMem [email protected] sz 4 vp 0
        [email protected] += 0x0            
        0A8D: [email protected] = readmem 0x8580DC sz 4 vp 0 // 0x8580DC - KERNEL32.lstrlenA
        0AA7: strlen_addr [email protected] num_params 1 pop 0 string [email protected] _returned_length [email protected]
        if [email protected] > 0
        then 0AB2: ret 1 [email protected]
        else 0AB2: ret 1 [email protected]
        end
    end
end
0AB2: ret 0
hi, if it’s not difficult, please drop the circle rendering code
 
OP
OP
Parazitas

Parazitas

Well-Known Member
Joined
Jan 2, 2017
Messages
2,229
Likes
420
Points
113
Location
Lithuania
Website
ugbase.eu
20
#46
PHP:
:Convert3DposTo2Dscreen
{
    0xB6FA2C - CAMERA VIEW MATRIX
    input: [email protected] [email protected] [email protected] xyz world coordinates
    output: [email protected] [email protected] xy screen coordinates (640x448)
    0AB1: @Convert3DposTo2Dscreen 3 XYZ [email protected] [email protected] [email protected] ScreenXY [email protected] [email protected]
}
// x = _x * _11 + _y * _21 + _z * _31 + 1 * _41
0007: [email protected] = 0.0 // l=i (float)

0087: [email protected] = [email protected] // l=l (float)
0A8D: [email protected] = read_memory 0xB6FA2C size 4 vp 0 // _11
006B: [email protected] *= [email protected] // l*=l (float)
005B: [email protected] += [email protected]  // l+=l (float)

0087: [email protected] = [email protected] // l=l (float)
0A8D: [email protected] = read_memory 0xB6FA3C size 4 vp 0 // _21
006B: [email protected] *= [email protected] // l*=l (float)
005B: [email protected] += [email protected]  // l+=l (float)

0087: [email protected] = [email protected] // l=l (float)
0A8D: [email protected] = read_memory 0xB6FA4C size 4 vp 0 // _31
006B: [email protected] *= [email protected] // l*=l (float)
005B: [email protected] += [email protected]  // l+=l (float)

0A8D: [email protected] = read_memory 0xB6FA5C size 4 vp 0 // _41
005B: [email protected] += [email protected]  // l+=l (float)

// y = _x * _12 + _y * _22 + _z * _32 + 1 * _42
0007: [email protected] = 0.0 // l=i (float)

0087: [email protected] = [email protected] // l=l (float)
0A8D: [email protected] = read_memory 0xB6FA30 size 4 vp 0 // _12
006B: [email protected] *= [email protected] // l*=l (float)
005B: [email protected] += [email protected]  // l+=l (float)

0087: [email protected] = [email protected] // l=l (float)
0A8D: [email protected] = read_memory 0xB6FA40 size 4 vp 0 // _22
006B: [email protected] *= [email protected] // l*=l (float)
005B: [email protected] += [email protected]  // l+=l (float)

0087: [email protected] = [email protected] // l=l (float)
0A8D: [email protected] = read_memory 0xB6FA50 size 4 vp 0 // _32
006B: [email protected] *= [email protected] // l*=l (float)
005B: [email protected] += [email protected]  // l+=l (float)
                                
0A8D: [email protected] = read_memory 0xB6FA60 size 4 vp 0 // _42
005B: [email protected] += [email protected]  // l+=l (float)

// z = _x * _13 + _y * _23 + _z * _33 + 1 * _43
0007: [email protected] = 0.0 // l=i (float)

0087: [email protected] = [email protected] // l=l (float)
0A8D: [email protected] = read_memory 0xB6FA34 size 4 vp 0 // _13
006B: [email protected] *= [email protected] // l*=l (float)
005B: [email protected] += [email protected]  // l+=l (float)

0087: [email protected] = [email protected] // l=l (float)
0A8D: [email protected] = read_memory 0xB6FA44 size 4 vp 0 // _23
006B: [email protected] *= [email protected] // l*=l (float)
005B: [email protected] += [email protected]  // l+=l (float)

0087: [email protected] = [email protected] // l=l (float)
0A8D: [email protected] = read_memory 0xB6FA54 size 4 vp 0 // _33
006B: [email protected] *= [email protected] // l*=l (float)
005B: [email protected] += [email protected]  // l+=l (float)

0A8D: [email protected] = read_memory 0xB6FA64 size 4 vp 0 // _43
005B: [email protected] += [email protected]  // l+=l (float)

// x *= 640.0 / z
// y *= 448.0 / z
0007: [email protected] = 640.0 // l=i (float)
0007: [email protected] = 448.0 // l=i (float)

006B: [email protected] *= [email protected] // l*=l (float)
006B: [email protected] *= [email protected] // l*=l (float)

0073: [email protected] /= [email protected] // l/=l (float)
0073: [email protected] /= [email protected] // l/=l (float)
0AB2: 2 [email protected] [email protected]
 
Last edited:
OP
OP
Parazitas

Parazitas

Well-Known Member
Joined
Jan 2, 2017
Messages
2,229
Likes
420
Points
113
Location
Lithuania
Website
ugbase.eu
20
#47
PHP:
:GetGameText
{ 
    for [email protected] = 0 to 7  
        if 0AB1: @GetGameText  1 GameTextID [email protected] _returned: string [email protected]
        then
            // do something...
        end
    end
}
[email protected] *= 0x80 // size *= ID
[email protected] += 0xBAACC0 // base pointer
0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0
if [email protected] > 0 // if exist then
then
    0A8C: write_memory [email protected] size 0 value 0 virtual_protect 0  // anti crash - clear unknown shit i guess
    0485:  return_true
    0AC8: [email protected] = allocate_memory_size 260
    0AD3: [email protected] = format "%s" [email protected]
    0AB2: ret 1 [email protected]
else
    059A:  return_false
end
0AB2: ret 0
 
OP
OP
Parazitas

Parazitas

Well-Known Member
Joined
Jan 2, 2017
Messages
2,229
Likes
420
Points
113
Location
Lithuania
Website
ugbase.eu
20
#48
PHP:
:LockVehicleCamera
// 0AB1: @LockVehicleCamera 0
0A8C: write_memory 0xB70118 size 4 value 50.0 virtual_protect 0
0AB2: ret 0
 
Top