SAMP Get Vehicle ID using Car Handle

Code:
:SAMPGetVehicleIDbyCarHandle // if 0AB1: @SAMPGetVehicleIDbyCarHandle 1 _OfCarHandle 0@ _StoreVehicleID 29@
if 0AA2: 31@ = load_dynamic_library "samp.dll" // pSAMPBase // no need to Free Memory
then
    31@ += 0x21A0F8
    0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // stSAMPInfo
    if 31@ > 0
    then
        31@ += 0x3CD
        0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // stSAMPPools
        if 31@ > 0
        then
            31@ += 0x1C
            0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // stVehiclePool
            if 31@ > 0
            then
                0A97: 30@ = vehicle 0@ struct
                for 29@ = 0 to 8000 step 4 // vehicle index = max vehicle * 4 = 2000 * 4
                    0A8E: 28@ = 29@ + 31@
                    0A8E: 27@ = 28@ + 0x3074
                    0A8D: 27@ = read_memory 27@ size 4 virtual_protect 0 // iIsListed
                    if 27@ > 0
                    then
                        0A8E: 27@ = 28@ + 0x1134
                        0A8D: 27@ = read_memory 27@ size 4 virtual_protect 0 // pSAMP_Vehicle
                        if 27@ > 0
                        then
                            27@ += 0x4C
                            0A8D: 26@ = read_memory 27@ size 4 virtual_protect 0 // pGTA_Vehicle
                            if 003B: 26@ == 30@  // our vehicle matched
                            then
                                29@ /= 4
                                0485:  return_true
                                ret 1 29@ // I now Got the Vehicle ID
                            end 
                        end
                    end
                end
            end
        end
    end
end
059A:  return_false
ret 1 -1 // null Vehicle ID
Code:
{$CLEO}
0000:

while true
    wait 0
    if 0449:   actor $PLAYER_ACTOR in_a_car
    then
        03C0: 0@ = actor $PLAYER_ACTOR car
        if 0AB1: @SAMPGetVehicleIDbyCarHandle 1 _OfCarHandle 0@ _StoreVehicleID 31@
        then 0AD1: show_formatted_text_highpriority "Your Vehicle's SAMP ID is %d" time 100 31@
        else 0ACD: show_text_highpriority "Your Vehicle have no SAMP ID" time 100
        end
    end
end
 

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
PHP:
:SAMPGetCarIDFromVehicleHandle
{
    0.3.7 - R2
    if 0AB1: @SAMPGetCarIDFromVehicleHandle 1 _VehicleHandle 0@ _StoreCarID 1@
}
if 0AA2: 31@ = load_dynamic_library "samp.dll" // pSAMPBase
then
    31@ += 0x21A100
    0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // stSAMPInfo
    if 31@ > 0
    then
        31@ += 0x3C5
        0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // stSAMPPools
        if 31@ > 0
        then
            31@ += 0xC
            0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // stVehiclePool
            if 31@ > 0
            then
                0A97: 30@ = vehicle 0@ struct
                for 29@ = 0 to 8000 step 4 // vehicle index = max vehicle * 4 = 2000 * 4
                    0A8E: 28@ = 29@ + 31@
                    0A8E: 27@ = 28@ + 0x3074
                    0A8D: 27@ = read_memory 27@ size 4 virtual_protect 0 // iIsListed
                    if 27@ > 0
                    then
                        0A8E: 27@ = 28@ + 0x1134
                        0A8D: 27@ = read_memory 27@ size 4 virtual_protect 0 // pSAMP_Vehicle
                        if 27@ > 0
                        then
                            27@ += 0x4C
                            0A8D: 26@ = read_memory 27@ size 4 virtual_protect 0 // pGTA_Vehicle
                            if 003B: 26@ == 30@  // our vehicle matched
                            then
                                29@ /= 4 
                                0085: 25@ = 29@
                                break
                            end
                        end
                    end
                end
            end
        end
    end
end
if 25@ < 0
then 059A:  return_false
else 0485:  return_true
end
0AB2: cleo_return 1 25@
 
Last edited:

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
PHP:
:SAMPGetCarIDFromVehicleHandle
{
    0.3.7 - R3
    if 0AB1: @SAMPGetCarIDFromVehicleHandle 1 _VehicleHandle 0@ _StoreCarID 1@
}
if 0AA2: 31@ = load_dynamic_library "samp.dll" // pSAMPBase
then
    31@ += 0x26E8DC
    0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // stSAMPInfo
    if 31@ > 0
    then
        31@ += 0x3DE
        0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // stSAMPPools
        if 31@ > 0
        then
            31@ += 0xC
            0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // stVehiclePool
            if 31@ > 0
            then
                0A97: 30@ = vehicle 0@ struct
                for 29@ = 0 to 8000 step 4 // vehicle index = max vehicle * 4 = 2000 * 4
                    0A8E: 28@ = 29@ + 31@
                    0A8E: 27@ = 28@ + 0x3074
                    0A8D: 27@ = read_memory 27@ size 4 virtual_protect 0 // iIsListed
                    if 27@ > 0
                    then
                        0A8E: 27@ = 28@ + 0x1134
                        0A8D: 27@ = read_memory 27@ size 4 virtual_protect 0 // pSAMP_Vehicle
                        if 27@ > 0
                        then
                            27@ += 0x4C
                            0A8D: 26@ = read_memory 27@ size 4 virtual_protect 0 // pGTA_Vehicle
                            if 003B: 26@ == 30@  // our vehicle matched
                            then
                                29@ /= 4
                                0085: 25@ = 29@
                                break
                            end
                        end
                    end
                end
            end
        end
    end
end
if 25@ < 0
then 059A:  return_false
else 0485:  return_true
end
0AB2: cleo_return 1 25@
 
Last edited:

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
PHP:
:SAMPGetCarIDFromVehicleHandle
{
    0.3.7 - R4
    if 0AB1: @SAMPGetCarIDFromVehicleHandle 1 _VehicleHandle 0@ _StoreCarID 1@
}
if 0AA2: 31@ = load_dynamic_library "samp.dll" // pSAMPBase
then
    31@ += 0x26EA0C
    0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // stSAMPInfo
    if 31@ > 0
    then
        31@ += 0x3DE
        0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // stSAMPPools
        if 31@ > 0
        then
            31@ += 0xC
            0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // stVehiclePool
            if 31@ > 0
            then
                0A97: 30@ = vehicle 0@ struct
                for 29@ = 0 to 8000 step 4 // vehicle index = max vehicle * 4 = 2000 * 4
                    0A8E: 28@ = 29@ + 31@
                    0A8E: 27@ = 28@ + 0x3074
                    0A8D: 27@ = read_memory 27@ size 4 virtual_protect 0 // iIsListed
                    if 27@ > 0
                    then
                        0A8E: 27@ = 28@ + 0x1134
                        0A8D: 27@ = read_memory 27@ size 4 virtual_protect 0 // pSAMP_Vehicle
                        if 27@ > 0
                        then
                            27@ += 0x4C
                            0A8D: 26@ = read_memory 27@ size 4 virtual_protect 0 // pGTA_Vehicle
                            if 003B: 26@ == 30@  // our vehicle matched
                            then
                                29@ /= 4
                                0085: 25@ = 29@
                                break
                            end
                        end
                    end
                end
            end
        end
    end
end
if 25@ < 0
then 059A:  return_false
else 0485:  return_true
end
0AB2: cleo_return 1 25@
 
Last edited:

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
PHP:
:SAMPGetCarIDFromVehicleHandle
{
    0.3.DL
    if 0AB1: @SAMPGetCarIDFromVehicleHandle 1 _VehicleHandle 0@ _StoreCarID 1@
}
if 0AA2: 31@ = load_dynamic_library "samp.dll" // pSAMPBase
then
    31@ += 0x2ACA24
    0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // stSAMPInfo
    if 31@ > 0
    then
        31@ += 0x3DE
        0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // stSAMPPools
        if 31@ > 0
        then
            31@ += 0xC
            0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // stVehiclePool
            if 31@ > 0
            then
                0A97: 30@ = vehicle 0@ struct
                for 29@ = 0 to 8000 step 4 // vehicle index = max vehicle * 4 = 2000 * 4
                    0A8E: 28@ = 29@ + 31@
                    0A8E: 27@ = 28@ + 0x3074
                    0A8D: 27@ = read_memory 27@ size 4 virtual_protect 0 // iIsListed
                    if 27@ > 0
                    then
                        0A8E: 27@ = 28@ + 0x1134
                        0A8D: 27@ = read_memory 27@ size 4 virtual_protect 0 // pSAMP_Vehicle
                        if 27@ > 0
                        then
                            27@ += 0x4C
                            0A8D: 26@ = read_memory 27@ size 4 virtual_protect 0 // pGTA_Vehicle
                            if 003B: 26@ == 30@  // our vehicle matched
                            then
                                29@ /= 4
                                0085: 25@ = 29@
                                break
                            end
                        end
                    end
                end
            end
        end
    end
end
if 25@ < 0
then 059A:  return_false
else 0485:  return_true
end
0AB2: cleo_return 1 25@
 

woyaduh

New member
Joined
Apr 15, 2023
Messages
2
Reaction score
0
PHP:
:SAMPGetCarIDFromVehicleHandle
{
    0.3.7 - R4
    if 0AB1: @SAMPGetCarIDFromVehicleHandle 1 _VehicleHandle 0@ _StoreCarID 1@
}
if 0AA2: 31@ = load_dynamic_library "samp.dll" // pSAMPBase
then
    31@ += 0x26EA0C
    0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // stSAMPInfo
    if 31@ > 0
    then
        31@ += 0x3DE
        0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // stSAMPPools
        if 31@ > 0
        then
            31@ += 0xC
            0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // stVehiclePool
            if 31@ > 0
            then
                0A97: 30@ = vehicle 0@ struct
                for 29@ = 0 to 8000 step 4 // vehicle index = max vehicle * 4 = 2000 * 4
                    0A8E: 28@ = 29@ + 31@
                    0A8E: 27@ = 28@ + 0x3074
                    0A8D: 27@ = read_memory 27@ size 4 virtual_protect 0 // iIsListed
                    if 27@ > 0
                    then
                        0A8E: 27@ = 28@ + 0x1134
                        0A8D: 27@ = read_memory 27@ size 4 virtual_protect 0 // pSAMP_Vehicle
                        if 27@ > 0
                        then
                            27@ += 0x4C
                            0A8D: 26@ = read_memory 27@ size 4 virtual_protect 0 // pGTA_Vehicle
                            if 003B: 26@ == 30@  // our vehicle matched
                            then
                                29@ /= 4
                                0085: 25@ = 29@
                                break
                            end
                        end
                    end
                end
            end
        end
    end
end
if 25@ < 0
then 059A:  return_false
else 0485:  return_true
end
0AB2: cleo_return 1 25@
how to use this cleo?
 

dphome

Well-known member
Joined
Mar 21, 2020
Messages
475
Solutions
9
Reaction score
168
Location
Poland
how to use this cleo?
PHP:
{$CLEO}
0000:

while true
    wait 0
    if 0449:   actor $PLAYER_ACTOR in_a_car
    then
        03C0: 0@ = actor $PLAYER_ACTOR car
        if 0AB1: @SAMPGetVehicleIDbyCarHandle 1 _OfCarHandle 0@ _StoreVehicleID 31@
        then 0AD1: show_formatted_text_highpriority "Your Vehicle's SAMP ID is %d" time 100 31@
        else 0ACD: show_text_highpriority "Your Vehicle have no SAMP ID" time 100
        end
    end
end

:SAMPGetCarIDFromVehicleHandle
{
    0.3.7 - R4
    if 0AB1: @SAMPGetCarIDFromVehicleHandle 1 _VehicleHandle 0@ _StoreCarID 1@
}
if 0AA2: 31@ = load_dynamic_library "samp.dll" // pSAMPBase
then
    31@ += 0x26EA0C
    0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // stSAMPInfo
    if 31@ > 0
    then
        31@ += 0x3DE
        0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // stSAMPPools
        if 31@ > 0
        then
            31@ += 0xC
            0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // stVehiclePool
            if 31@ > 0
            then
                0A97: 30@ = vehicle 0@ struct
                for 29@ = 0 to 8000 step 4 // vehicle index = max vehicle * 4 = 2000 * 4
                    0A8E: 28@ = 29@ + 31@
                    0A8E: 27@ = 28@ + 0x3074
                    0A8D: 27@ = read_memory 27@ size 4 virtual_protect 0 // iIsListed
                    if 27@ > 0
                    then
                        0A8E: 27@ = 28@ + 0x1134
                        0A8D: 27@ = read_memory 27@ size 4 virtual_protect 0 // pSAMP_Vehicle
                        if 27@ > 0
                        then
                            27@ += 0x4C
                            0A8D: 26@ = read_memory 27@ size 4 virtual_protect 0 // pGTA_Vehicle
                            if 003B: 26@ == 30@  // our vehicle matched
                            then
                                29@ /= 4
                                0085: 25@ = 29@
                                break
                            end
                        end
                    end
                end
            end
        end
    end
end
if 25@ < 0
then 059A:  return_false
else 0485:  return_true
end
0AB2: cleo_return 1 25@
 

woyaduh

New member
Joined
Apr 15, 2023
Messages
2
Reaction score
0
PHP:
{$CLEO}
0000:

while true
    wait 0
    if 0449:   actor $PLAYER_ACTOR in_a_car
    then
        03C0: 0@ = actor $PLAYER_ACTOR car
        if 0AB1: @SAMPGetVehicleIDbyCarHandle 1 _OfCarHandle 0@ _StoreVehicleID 31@
        then 0AD1: show_formatted_text_highpriority "Your Vehicle's SAMP ID is %d" time 100 31@
        else 0ACD: show_text_highpriority "Your Vehicle have no SAMP ID" time 100
        end
    end
end

:SAMPGetCarIDFromVehicleHandle
{
    0.3.7 - R4
    if 0AB1: @SAMPGetCarIDFromVehicleHandle 1 _VehicleHandle 0@ _StoreCarID 1@
}
if 0AA2: 31@ = load_dynamic_library "samp.dll" // pSAMPBase
then
    31@ += 0x26EA0C
    0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // stSAMPInfo
    if 31@ > 0
    then
        31@ += 0x3DE
        0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // stSAMPPools
        if 31@ > 0
        then
            31@ += 0xC
            0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // stVehiclePool
            if 31@ > 0
            then
                0A97: 30@ = vehicle 0@ struct
                for 29@ = 0 to 8000 step 4 // vehicle index = max vehicle * 4 = 2000 * 4
                    0A8E: 28@ = 29@ + 31@
                    0A8E: 27@ = 28@ + 0x3074
                    0A8D: 27@ = read_memory 27@ size 4 virtual_protect 0 // iIsListed
                    if 27@ > 0
                    then
                        0A8E: 27@ = 28@ + 0x1134
                        0A8D: 27@ = read_memory 27@ size 4 virtual_protect 0 // pSAMP_Vehicle
                        if 27@ > 0
                        then
                            27@ += 0x4C
                            0A8D: 26@ = read_memory 27@ size 4 virtual_protect 0 // pGTA_Vehicle
                            if 003B: 26@ == 30@  // our vehicle matched
                            then
                                29@ /= 4
                                0085: 25@ = 29@
                                break
                            end
                        end
                    end
                end
            end
        end
    end
end
if 25@ < 0
then 059A:  return_false
else 0485:  return_true
end
0AB2: cleo_return 1 25@
what the cmd?
 
Top