Help [REQ] Vehicle Get Plate CLEO

kokom7

Active member
Joined
Nov 4, 2016
Messages
42
Reaction score
1
Location
United Kingdom
Hello, i need a CLEO that can check car plate number based on Vehicle ID (VID) or Player ID with command.
Lets say theres a car named Faggio with Vehicle ID (VID) 415,
so i can check it by using command '/vplate 415',
but if i want to check it by Player ID, lets say the Player ID is 17, i can check it by using command '/plate 12', and then it will shows an output in chatlog like this :
"Faggio (VID: VIDHERE) (PLATE NUMBER HERE)", but if the vehicle got no plate which is empty, it will say "Faggio (VID: VIDHERE) has no plate!", and if i check by Player ID but the player is not on any vehicle, it will say "That player is not on vehicle!".
So, final example is like this
Output "Faggio (VID: 415) (KHJUYW9)" / "Faggio (VID: 415) has no plate!" (if using /vplate)
Output "That player is not on vehicle!". (if using /plate that use Player ID but the Player is not on vehicle)

I've SampFunc-5.6.1 0.3.DL for SAMP 0.3DL installed
 

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
SAMPFUNC doesn't have function for number plates xD

Not everything is Around SAMPFUNC..


 

kokom7

Active member
Joined
Nov 4, 2016
Messages
42
Reaction score
1
Location
United Kingdom
SAMPFUNC doesn't have function for number plates xD

Not everything is Around SAMPFUNC..


So my request is not possible? D:
I dont really understand and cant make one thats why i requested one hehe xD
 

kokom7

Active member
Joined
Nov 4, 2016
Messages
42
Reaction score
1
Location
United Kingdom
I provide link to code which is what you asked for
I tried this, but error when compiling, it says "Local variable 34 is out of range. Max variable is 33@." and refers link for the error "https://docs.sannybuilder.com/troubleshooting/errors/0034", Can you fix it for me?, i want that i able to use it by cmd /plate [VID]
Code:
{$CLEO .cs}
0000: NOP

// Command to get vehicle number plate by vehicle ID
:SAMPPlateCommand
{
    0.3.DL
    0AB1: @SAMPPlateCommand 1 Text 0@
}

// Main command handler
IF 0AA2: 31@ = "samp.dll"
THEN
    31@ += 0x2ACA24 // SAMP_INFO_OFFSET
    0A8D: 31@ readMem 31@ sz 4 vp 0
    31@ += 0x3DE // SAMP_PPOOLS_OFFSET
    0A8D: 31@ readMem 31@ sz 4 vp 0
    31@ += 0xC // SAMP_PPOOL_VEHICLE_OFFSET
    0A8D: 31@ readMem 31@ sz 4 vp 0

    // Check if the command is received
    IF 0AA2: 33@ = "/plate"
    THEN
        // Extract Vehicle ID from the command
        34@ = 0 // Initialize Vehicle ID
        0A8D: 34@ = readMem 0@ sz 4 vp 0 // Assuming the command is followed by Vehicle ID

        // Call the function to get the number plate
        0AB1: @SAMPGetCarNumberPlateByVehicleID 1 VehicleID 34@ _Returned: NumberPlate 0@

        // Check if the returned number plate is valid
        IF 4@ > 0
        THEN
            // Send the number plate to the player
            0A8D: 0@ = "Plate Number: " + NumberPlate
            0AB2: ret 1 0@
            // Replace with your actual function to send messages to players
            // Example: 0AB1: send_message_to_player 0@ // Implement this function as needed
        ELSE
            // If the vehicle ID is invalid
            0A8D: 0@ = "Invalid veh id"
            0AB2: ret 1 0@
            // Example: 0AB1: send_message_to_player 0@ // Implement this function as needed
        END
    END
END

// Function to get the vehicle number plate by Vehicle ID
:SAMPGetCarNumberPlateByVehicleID
{
    0.3.DL
    0AB1: @SAMPGetCarNumberPlateByVehicleID 1 VehicleID 1249 _Returned: NumberPlate 0@
}
IF 0AA2: 10@ = "samp.dll"
THEN
    10@ += 0x2ACA24 // SAMP_INFO_OFFSET
    0A8D: 10@ readMem 10@ sz 4 vp 0
    10@ += 0x3DE // SAMP_PPOOLS_OFFSET
    0A8D: 10@ readMem 10@ sz 4 vp 0
    10@ += 0xC // SAMP_PPOOL_VEHICLE_OFFSET
    0A8D: 10@ readMem 10@ sz 4 vp 0
    0@ *= 0x4 // VEHICLE_ID * 0x14
    0@ += 0x1134
    005A: 10@ += 0@
    0A8D: 10@ = readMem 10@ sz 4 vp 0
    10@ += 0x93 // SAMP_VEHICLE_NUMBER_PLATE_OFFSET
    0A8D: 4@ = readMem 10@ sz 1 vp 0
    IF 4@ > 0
    THEN 0485:  return_true
    ELSE
        059A:  return_false
        10@ = 0
    END
END
0AB2: ret 1 10@
 

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
I tried this, but error when compiling, it says "Local variable 34 is out of range. Max variable is 33@." and refers link for the error "https://docs.sannybuilder.com/troubleshooting/errors/0034", Can you fix it for me?, i want that i able to use it by cmd /plate [VID]
Code:
{$CLEO .cs}
0000: NOP

// Command to get vehicle number plate by vehicle ID
:SAMPPlateCommand
{
    0.3.DL
    0AB1: @SAMPPlateCommand 1 Text 0@
}

// Main command handler
IF 0AA2: 31@ = "samp.dll"
THEN
    31@ += 0x2ACA24 // SAMP_INFO_OFFSET
    0A8D: 31@ readMem 31@ sz 4 vp 0
    31@ += 0x3DE // SAMP_PPOOLS_OFFSET
    0A8D: 31@ readMem 31@ sz 4 vp 0
    31@ += 0xC // SAMP_PPOOL_VEHICLE_OFFSET
    0A8D: 31@ readMem 31@ sz 4 vp 0

    // Check if the command is received
    IF 0AA2: 33@ = "/plate"
    THEN
        // Extract Vehicle ID from the command
        34@ = 0 // Initialize Vehicle ID
        0A8D: 34@ = readMem 0@ sz 4 vp 0 // Assuming the command is followed by Vehicle ID

        // Call the function to get the number plate
        0AB1: @SAMPGetCarNumberPlateByVehicleID 1 VehicleID 34@ _Returned: NumberPlate 0@

        // Check if the returned number plate is valid
        IF 4@ > 0
        THEN
            // Send the number plate to the player
            0A8D: 0@ = "Plate Number: " + NumberPlate
            0AB2: ret 1 0@
            // Replace with your actual function to send messages to players
            // Example: 0AB1: send_message_to_player 0@ // Implement this function as needed
        ELSE
            // If the vehicle ID is invalid
            0A8D: 0@ = "Invalid veh id"
            0AB2: ret 1 0@
            // Example: 0AB1: send_message_to_player 0@ // Implement this function as needed
        END
    END
END

// Function to get the vehicle number plate by Vehicle ID
:SAMPGetCarNumberPlateByVehicleID
{
    0.3.DL
    0AB1: @SAMPGetCarNumberPlateByVehicleID 1 VehicleID 1249 _Returned: NumberPlate 0@
}
IF 0AA2: 10@ = "samp.dll"
THEN
    10@ += 0x2ACA24 // SAMP_INFO_OFFSET
    0A8D: 10@ readMem 10@ sz 4 vp 0
    10@ += 0x3DE // SAMP_PPOOLS_OFFSET
    0A8D: 10@ readMem 10@ sz 4 vp 0
    10@ += 0xC // SAMP_PPOOL_VEHICLE_OFFSET
    0A8D: 10@ readMem 10@ sz 4 vp 0
    0@ *= 0x4 // VEHICLE_ID * 0x14
    0@ += 0x1134
    005A: 10@ += 0@
    0A8D: 10@ = readMem 10@ sz 4 vp 0
    10@ += 0x93 // SAMP_VEHICLE_NUMBER_PLATE_OFFSET
    0A8D: 4@ = readMem 10@ sz 1 vp 0
    IF 4@ > 0
    THEN 0485:  return_true
    ELSE
        059A:  return_false
        10@ = 0
    END
END
0AB2: ret 1 10@
Your own or others?
 

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
........................................................................rly.........................................................
You can't answer to provided question correctly and expecting to get help :unsure:
You wanna get your OWN ???????????????? or OTHERS number plate .................................
 

kokom7

Active member
Joined
Nov 4, 2016
Messages
42
Reaction score
1
Location
United Kingdom
........................................................................rly.........................................................
You can't answer to provided question correctly and expecting to get help :unsure:
You wanna get your OWN ???????????????? or OTHERS number plate .................................
Bro, thought you were talking about the where i got the code, not about the plate ._.
i want to get others plate, by using command, like if i use /vplate it uses Vehicle ID(VID), but if i use /plate, it uses Player ID
 

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
PHP:
{$CLEO .cs}

0000: 'Author: Parazitas | UGBASE.EU'

REPEAT
IF 8256:   player $PLAYER_CHAR defined
THEN 0A93: end_custom_thread
END
WAIT 1500
UNTIL 0256:   player $PLAYER_CHAR defined

0AC8: 31@ = allocate_memory_size 1024
0AD3: 31@ = string_format "vplate"
0AC7: 30@ = var 30@ pointer
0AC7: 29@ = var 29@ pointer
0AB1: @registerClientCommand 3 _CommandName 31@ _TogglingVar 30@ _ParamsPtrToVar 29@
30@ = 0 // default disabled
29@ = 0 // null ptr

WHILE TRUE
WAIT 0

IF 0256:   player $PLAYER_CHAR defined
THEN
    ////////////////////////////////////////////////////////// Command Check..
    IF 30@ <> 0
    THEN
        30@ = 0 // disable indication of the cmd
        0A8D: 28@ = read_memory 29@ size 1 virtual_protect 1
        IF 28@ <> 0 // not null ptr
        THEN
            IF 0AD4: $NOT_USED = scan_string 29@ format "%d" 0@
            THEN
                IF 0AB1: @SAMPGetCarNumberPlateByVehicleID 1 VehicleID 0@ _Returned: NumberPlate 1@
                THEN
                    0AC8: 2@ = allocate_memory_size 144
                    0AD3: 2@ = format "Number Plate: %s" 1@
                    0AB1: @Chatmsg 2 text 2@ color -1
                    0AC9: free_allocated_memory 2@
                END
            END
        END
    END
END
                      
END     
      
:get_samp_version_id
// 0AB1: @get_samp_version_id 0 _returned: ID 0@
30@ = 0
IF 0AA2: 31@ = "samp.dll" // IF and SET
THEN
    31@ += 0x128
    0A8D: 29@ = read_memory 31@ size 4 virtual_protect 1
    IF 29@ == 0x5542F47A
    THEN // 0.3.7 R1
        30@ = 1
    END
  
    IF 29@ == 0x59C30C94
    THEN // 0.3.7 R2
        30@ = 2
    END
  
    IF 29@ == 0x5A6A3130
    THEN // 0.3.DL
        30@ = 3
    END
    31@ -= 8 // reading samp.dll + 0x120
    0A8D: 29@ = read_memory 31@ size 4 virtual_protect 1
    IF 29@ == 0x5C0B4243
    THEN // 0.3.7 R3
        30@ = 4
    END
  
    IF 29@ == 0x5DD606CD
    THEN // 0.3.7 R4
        30@ = 5
    END
    IF 29@ == 0x6094ACAB
    THEN // 0.3.7 R4 - v2
        30@ = 6
    END
    IF 29@ == 0x6372C39E
    THEN // 0.3.7 R5
        30@ = 7
    END
END
0AB2: ret 1 30@

:registerClientCommand
{
    Credits:
        Parazitas - UGBASE
        kawa_operand - BlastHack
  
    Usage:
    0AC8: 31@ = allocate_memory_size 1024
    0AD3: 31@ = string_format "vr"
    0AC7: 30@ = var 30@ pointer
    0AC7: 29@ = var 29@ pointer
    0AB1: @registerClientCommand 3 _CommandName 31@ _TogglingVar 30@ _ParamsPtrToVar 29@
    30@ = 0 // default disabled
    29@ = 0 // null ptr
 
    Note:
        The Reference Pointers passed at _TogglingVar and _ParamPtrToVar are required to be treated as ReadOnly. Which means that the value of those two Reference Pointers should not be manually overwritten/changed.

    I am having a problem with opcode 0AB1, it permanently writes on the main thread's local variables. Maybe its because I directly writes on the passed variable's memory pointer. An example case:
        Passing _ParamPtrToVar = 31@ , _TogglingVar = 30@
            Opcode 0AB1 31@ == Main Thread's 31@
            Opcode 0AB1 30@ == Main Thread's 30@

    Thats why I decided to use global variables since they aren't that exposed on scripts.
}
CONST
    //    WARNING:
    //        Do not use Local Variables
    //        Do not recycle/use the three variables on any operation inside the script because these variables will always be used by this function and doesn't override outside the function. I promise you that even if you replace this with a local variable, It will cause overwriting mistakes that will mess the operation
    // You can Replace any of these variables into any UNIQUE GLOBAL VARIABLES
    VAR1 = $2AFD
    VAR2 = $2BEC
    VAR3 = $2CDE
    VAR4 = $2DCB
    VAR5 = $2EBF
    VAR6 = $2FAA
END
IF 0AA2: VAR4 = "samp.dll"
THEN
        // ~~~~~~~~~~~~~ Create a New Callback Structure
        {
            51                      // push     ecx
            56                      // push     esi
            8B 74 24 0C             // mov     esi, [esp+0Ch]
            89 34 25 11 11 11 11    // mov     [11111111], esi // later: [11111111] becomes 1@
            83 35 11 11 11 11 01    // xor     [11111111], 01 // later: [11111111] becomes 2@
            5E                      // pop     esi
            59                      // pop     ecx
            C3 // retn
        }
            // Avoid using local variables by saving the values inside a global variables
    008A: VAR1 = 0@
    008A: VAR2 = 2@
    008A: VAR3 = 1@
            //
    0AC8: VAR5 = allocate_memory_size 23 // undeleteable memory region
    0084: VAR6 = VAR5
    0A8C: write_memory VAR6 size 4 value 0x748B5651 virtual_protect 1
    VAR6 += 4
    0A8C: write_memory VAR6 size 4 value 0x34890C24 virtual_protect 1
    VAR6 += 4
    0A8C: write_memory VAR6 size 1 value 0x25 virtual_protect 1
    VAR6++
    // 0A8C: write_memory VAR2 size 4 value 0 virtual_protect 0 // null string // NOT WORKING due to this function's varibles overriding
    0A8C: write_memory VAR6 size 4 value VAR2 virtual_protect 1
    VAR6 += 4
    0A8C: write_memory VAR6 size 2 value 0x3583 virtual_protect 1
    VAR6 += 2
    // 0A8C: write_memory VAR3 size 4 value 0 virtual_protect 0 // Zeroing TogglingVar // NOT WORKING due to this function's varibles overriding
    0A8C: write_memory VAR6 size 4 value VAR3 virtual_protect 1
    VAR6 += 4
    0A8C: write_memory VAR6 size 4 value 0xC3595E01 virtual_protect 1
        // ~~~~~~~~~~~~~ now callback struct VAR5 is ready
    10@ = @get_samp_version_id
    0AB1: 10@ 0 _returned: ID 17@
    IF 17@ > 0
    THEN
        IF 17@ == 1 // 0.3.7 R1
        THEN
            0A8E: VAR6 = VAR4 + 0x21A0E8 // SAMP_CHAT_INPUT_INFO_OFFSET
            0A8D: VAR6 = read_memory VAR6 size 4 virtual_protect 1
            VAR4 += 0x65AD0 // SAMP_REGISTER_CLIENT_CMD_OFFSET
        END
        IF 17@ == 2 // 0.3.7 R2
        THEN
            0A8E: VAR6 = VAR4 + 0x21A0F0 // SAMP_CHAT_INPUT_INFO_OFFSET
            0A8D: VAR6 = read_memory VAR6 size 4 virtual_protect 1
            VAR4 += 0x65BA0 // SAMP_REGISTER_CLIENT_CMD_OFFSET
        END
      
        IF 17@ == 3 // 0.3.DL
        THEN
            0A8E: VAR6 = VAR4 + 0x2ACA14 // SAMP_CHAT_INPUT_INFO_OFFSET
            0A8D: VAR6 = read_memory VAR6 size 4 virtual_protect 1
            VAR4 += 0x691B0 // SAMP_REGISTER_CLIENT_CMD_OFFSET
        END
      
        IF 17@ == 4 // 0.3.7 R3
        THEN
            0A8E: VAR6 = VAR4 + 0x26E8CC // SAMP_CHAT_INPUT_INFO_OFFSET
            0A8D: VAR6 = read_memory VAR6 size 4 virtual_protect 1
            VAR4 += 0x69000 // SAMP_REGISTER_CLIENT_CMD_OFFSET
        END
      
        IF 17@ == 5 // 0.3.7 R4
        THEN
            0A8E: VAR6 = VAR4 + 0x26E9FC // SAMP_CHAT_INPUT_INFO_OFFSET
            0A8D: VAR6 = read_memory VAR6 size 4 virtual_protect 1
            VAR4 += 0x69730 // SAMP_REGISTER_CLIENT_CMD_OFFSET
        END
      
        IF 17@ == 6 // 0.3.7 R4 - v2
        THEN
            0A8E: VAR6 = VAR4 + 0x26E9FC // SAMP_CHAT_INPUT_INFO_OFFSET
            0A8D: VAR6 = read_memory VAR6 size 4 virtual_protect 1
            VAR4 += 0x69770 // SAMP_REGISTER_CLIENT_CMD_OFFSET
        END

        IF 17@ == 7 // 0.3.7 R5
        THEN
            0A8E: VAR6 = VAR4 + 0x26EB84 // SAMP_CHAT_INPUT_INFO_OFFSET
            0A8D: VAR6 = read_memory VAR6 size 4 virtual_protect 1
            VAR4 += 0x69770 // SAMP_REGISTER_CLIENT_CMD_OFFSET
        END
  
        0AA6: call_method VAR4 struct VAR6 num_params 2 pop 0 VAR5 VAR1
    END
    0AA3: free_library VAR4
END
0AB2: ret 0

:SAMPGetCarNumberPlateByVehicleID
{
    IF 0AB1: @SAMPGetCarNumberPlateByVehicleID 1 VehicleID 1249 _Returned: NumberPlate 0@
}
IF 0AA2: 31@ = "samp.dll"
THEN
    0AB1: @get_samp_version_id 0 _returned: ID 17@
    IF 17@ > 0
    THEN
        IF 17@ == 1 // 0.3.7 R1
        THEN
            31@ += 0x21A0F8 // SAMP_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x3CD // SAMP_PPOOLS_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x1C // SAMP_PPOOL_VEHICLE_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            0@ *= 0x4 // VEHICLE_ID * 0x14
            0@ += 0x1134
            005A: 31@ += 0@
            0A8D: 31@ = readMem 31@ sz 4 vp 0
            31@ += 0x93 // SAMP_VEHICLE_NUMBER_PLATE_OFFSET
            0A8D: 30@ = readMem 31@ sz 1 vp 0
        END
      
        IF 17@ == 2 // 0.3.7 R2
        THEN
            31@ += 0x21A100 // SAMP_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x3C5 // SAMP_PPOOLS_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0xC // SAMP_PPOOL_VEHICLE_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            0@ *= 0x4 // VEHICLE_ID * 0x14
            0@ += 0x1134
            005A: 31@ += 0@
            0A8D: 31@ = readMem 31@ sz 4 vp 0
            31@ += 0x93 // SAMP_VEHICLE_NUMBER_PLATE_OFFSET
            0A8D: 30@ = readMem 31@ sz 1 vp 0
        END
     
        IF 17@ == 3 // 0.3.DL
        THEN 
            31@ += 0x2ACA24 // SAMP_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x3DE // SAMP_PPOOLS_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0xC // SAMP_PPOOL_VEHICLE_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            0@ *= 0x4 // VEHICLE_ID * 0x14
            0@ += 0x1134
            005A: 31@ += 0@
            0A8D: 31@ = readMem 31@ sz 4 vp 0
            31@ += 0x93 // SAMP_VEHICLE_NUMBER_PLATE_OFFSET
            0A8D: 30@ = readMem 31@ sz 1 vp 0
        END
     
        IF 17@ == 4 // 0.3.7 R3
        THEN    
            31@ += 0x26E8DC // SAMP_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x3DE // SAMP_PPOOLS_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0xC // SAMP_PPOOL_VEHICLE_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            0@ *= 0x4 // VEHICLE_ID * 0x14
            0@ += 0x1134
            005A: 31@ += 0@
            0A8D: 31@ = readMem 31@ sz 4 vp 0
            31@ += 0x93 // SAMP_VEHICLE_NUMBER_PLATE_OFFSET
            0A8D: 30@ = readMem 31@ sz 1 vp 0
        END
     
        IF 17@ == 5 // 0.3.7 R4
        THEN    
            31@ += 0x26EA0C // SAMP_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x3DE // SAMP_PPOOLS_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0xC // SAMP_PPOOL_VEHICLE_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            0@ *= 0x4 // VEHICLE_ID * 0x14
            0@ += 0x1134
            005A: 31@ += 0@
            0A8D: 31@ = readMem 31@ sz 4 vp 0
            31@ += 0x93 // SAMP_VEHICLE_NUMBER_PLATE_OFFSET
            0A8D: 30@ = readMem 31@ sz 1 vp 0
        END
     
        IF 17@ == 6 // 0.3.7 R4 - v2
        THEN     
            31@ += 0x26EA0C // SAMP_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x3DE // SAMP_PPOOLS_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x0 // SAMP_PPOOL_VEHICLE_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            0@ *= 0x4 // VEHICLE_ID * 0x14
            0@ += 0x1134
            005A: 31@ += 0@
            0A8D: 31@ = readMem 31@ sz 4 vp 0
            31@ += 0x93 // SAMP_VEHICLE_NUMBER_PLATE_OFFSET
            0A8D: 30@ = readMem 31@ sz 1 vp 0
        END

        IF 17@ == 7 // 0.3.7 R5
        THEN    
            31@ += 0x26EB94 // SAMP_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x3DE // SAMP_PPOOLS_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x0 // SAMP_PPOOL_VEHICLE_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            0@ *= 0x4 // VEHICLE_ID * 0x14
            0@ += 0x1134
            005A: 31@ += 0@
            0A8D: 31@ = readMem 31@ sz 4 vp 0
            31@ += 0x93 // SAMP_VEHICLE_NUMBER_PLATE_OFFSET
            0A8D: 30@ = readMem 31@ sz 1 vp 0
        END
 
        IF 30@ > 0
        THEN
            0485:  return_true
        ELSE
            059A:  return_false
            31@ = 0
        END
    END
    0AA3: free_library 31@
END
0AB2: ret 1 31@

:Chatmsg
/*
     0AC8: 0@ = allocate_memory_size 1024
     0AD3: 0@ = format "{FFFFFF}Auto Accept: {00FF00}ON"
     0AB1: @Chatmsg 2 text 0@ color -1
     0AC9: free_allocated_memory 0@
*/
IF 0AA2: 31@ = "samp.dll"
THEN
    0AB1: @get_samp_version_id 0 _Returned: ID 17@
    IF NOT 17@ < 1
    THEN
        IF 17@ == 1 // 0.3.7 R1
        THEN
            0A8E: 30@ = 31@ + 0x21A0E4            // SAMP_CHAT_INFO_OFFSET (R1)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x64010             // FUNC_ADDTOCHATWND (R1)
        END

        IF 17@ == 2 // 0.3.7 R2
        THEN
            0A8E: 30@ = 31@ + 0x21A0EC            // SAMP_CHAT_INFO_OFFSET (R2)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x640E0            // FUNC_ADDTOCHATWND (R2)
        END

        IF 17@ == 3 // 0.3.DL
        THEN
            0A8E: 30@ = 31@ + 0x2ACA10            // SAMP_CHAT_INFO_OFFSET (DL)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x67650             // FUNC_ADDTOCHATWND (DL)
        END

        IF 17@ == 4 // 0.3.7 R3
        THEN
            0A8E: 30@ = 31@ + 0x26E8C8            // SAMP_CHAT_INFO_OFFSET (R3)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x67460             // FUNC_ADDTOCHATWND (R3)
        END

        IF 17@ == 5 // 0.3.7 R4
        THEN
            0A8E: 30@ = 31@ + 0x26E9F8            // SAMP_CHAT_INFO_OFFSET (R4)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x67BA0             // FUNC_ADDTOCHATWND (R4) 699D0
        END
    
        IF 17@ == 6 // 0.3.7 R4 - v2
        THEN
            0A8E: 30@ = 31@ + 0x26E9F8            // SAMP_CHAT_INFO_OFFSET (R4)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x67BE0            // FUNC_ADDTOCHATWND (R4)
        END
      
        IF 17@ == 7 // 0.3.7 R5
        THEN
            0A8E: 30@ = 31@ + 0x26EB80            // SAMP_CHAT_INFO_OFFSET (R4)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x67BE0            // FUNC_ADDTOCHATWND (R4)
        END
              
        IF 1@ == -1
        THEN 1@ = 0xFFFFFFFF
        END
        0AA6: call 29@ struct 30@ num_params 5 pop 0 params 0 1@ 0 0@ 8
    END
    0AA3: free_library 31@  
END
0AB2: ret 0
 
Last edited:

kokom7

Active member
Joined
Nov 4, 2016
Messages
42
Reaction score
1
Location
United Kingdom
PHP:
{$CLEO .cs}

0000: 'Author: Parazitas | UGBASE.EU'

REPEAT
IF 8256:   player $PLAYER_CHAR defined
THEN 0A93: end_custom_thread
END
WAIT 1500
UNTIL 0256:   player $PLAYER_CHAR defined

0AC8: 31@ = allocate_memory_size 1024
0AD3: 31@ = string_format "vplate"
0AC7: 30@ = var 30@ pointer
0AC7: 29@ = var 29@ pointer
0AB1: @registerClientCommand 3 _CommandName 31@ _TogglingVar 30@ _ParamsPtrToVar 29@
30@ = 0 // default disabled
29@ = 0 // null ptr

WHILE TRUE
WAIT 0

IF 0256:   player $PLAYER_CHAR defined
THEN
    ////////////////////////////////////////////////////////// Command Check..
    IF 30@ <> 0
    THEN
        30@ = 0 // disable indication of the cmd
        0A8D: 28@ = read_memory 29@ size 1 virtual_protect 1
        IF 28@ <> 0 // not null ptr
        THEN
            IF 0AD4: $NOT_USED = scan_string 29@ format "%d" 0@
            THEN
                IF 0AB1: @SAMPGetCarNumberPlateByVehicleID 1 VehicleID 0@ _Returned: NumberPlate 1@
                THEN
                    0AC8: 2@ = allocate_memory_size 144
                    0AD3: 2@ = format "Number Plate: %s" 1@
                    0AB1: @Chatmsg 2 text 2@ color -1
                    0AC9: free_allocated_memory 2@
                END
            END
        END
    END
END
                     
END    
     
:get_samp_version_id
// 0AB1: @get_samp_version_id 0 _returned: ID 0@
30@ = 0
IF 0AA2: 31@ = "samp.dll" // IF and SET
THEN
    31@ += 0x128
    0A8D: 29@ = read_memory 31@ size 4 virtual_protect 1
    IF 29@ == 0x5542F47A
    THEN // 0.3.7 R1
        30@ = 1
    END
 
    IF 29@ == 0x59C30C94
    THEN // 0.3.7 R2
        30@ = 2
    END
 
    IF 29@ == 0x5A6A3130
    THEN // 0.3.DL
        30@ = 3
    END
    31@ -= 8 // reading samp.dll + 0x120
    0A8D: 29@ = read_memory 31@ size 4 virtual_protect 1
    IF 29@ == 0x5C0B4243
    THEN // 0.3.7 R3
        30@ = 4
    END
 
    IF 29@ == 0x5DD606CD
    THEN // 0.3.7 R4
        30@ = 5
    END
    IF 29@ == 0x6094ACAB
    THEN // 0.3.7 R4 - v2
        30@ = 6
    END
    IF 29@ == 0x6372C39E
    THEN // 0.3.7 R5
        30@ = 7
    END
END
0AB2: ret 1 30@

:registerClientCommand
{
    Credits:
        Parazitas - UGBASE
        kawa_operand - BlastHack
 
    Usage:
    0AC8: 31@ = allocate_memory_size 1024
    0AD3: 31@ = string_format "vr"
    0AC7: 30@ = var 30@ pointer
    0AC7: 29@ = var 29@ pointer
    0AB1: @registerClientCommand 3 _CommandName 31@ _TogglingVar 30@ _ParamsPtrToVar 29@
    30@ = 0 // default disabled
    29@ = 0 // null ptr
 
    Note:
        The Reference Pointers passed at _TogglingVar and _ParamPtrToVar are required to be treated as ReadOnly. Which means that the value of those two Reference Pointers should not be manually overwritten/changed.

    I am having a problem with opcode 0AB1, it permanently writes on the main thread's local variables. Maybe its because I directly writes on the passed variable's memory pointer. An example case:
        Passing _ParamPtrToVar = 31@ , _TogglingVar = 30@
            Opcode 0AB1 31@ == Main Thread's 31@
            Opcode 0AB1 30@ == Main Thread's 30@

    Thats why I decided to use global variables since they aren't that exposed on scripts.
}
CONST
    //    WARNING:
    //        Do not use Local Variables
    //        Do not recycle/use the three variables on any operation inside the script because these variables will always be used by this function and doesn't override outside the function. I promise you that even if you replace this with a local variable, It will cause overwriting mistakes that will mess the operation
    // You can Replace any of these variables into any UNIQUE GLOBAL VARIABLES
    VAR1 = $2AFD
    VAR2 = $2BEC
    VAR3 = $2CDE
    VAR4 = $2DCB
    VAR5 = $2EBF
    VAR6 = $2FAA
END
IF 0AA2: VAR4 = "samp.dll"
THEN
        // ~~~~~~~~~~~~~ Create a New Callback Structure
        {
            51                      // push     ecx
            56                      // push     esi
            8B 74 24 0C             // mov     esi, [esp+0Ch]
            89 34 25 11 11 11 11    // mov     [11111111], esi // later: [11111111] becomes 1@
            83 35 11 11 11 11 01    // xor     [11111111], 01 // later: [11111111] becomes 2@
            5E                      // pop     esi
            59                      // pop     ecx
            C3 // retn
        }
            // Avoid using local variables by saving the values inside a global variables
    008A: VAR1 = 0@
    008A: VAR2 = 2@
    008A: VAR3 = 1@
            //
    0AC8: VAR5 = allocate_memory_size 23 // undeleteable memory region
    0084: VAR6 = VAR5
    0A8C: write_memory VAR6 size 4 value 0x748B5651 virtual_protect 1
    VAR6 += 4
    0A8C: write_memory VAR6 size 4 value 0x34890C24 virtual_protect 1
    VAR6 += 4
    0A8C: write_memory VAR6 size 1 value 0x25 virtual_protect 1
    VAR6++
    // 0A8C: write_memory VAR2 size 4 value 0 virtual_protect 0 // null string // NOT WORKING due to this function's varibles overriding
    0A8C: write_memory VAR6 size 4 value VAR2 virtual_protect 1
    VAR6 += 4
    0A8C: write_memory VAR6 size 2 value 0x3583 virtual_protect 1
    VAR6 += 2
    // 0A8C: write_memory VAR3 size 4 value 0 virtual_protect 0 // Zeroing TogglingVar // NOT WORKING due to this function's varibles overriding
    0A8C: write_memory VAR6 size 4 value VAR3 virtual_protect 1
    VAR6 += 4
    0A8C: write_memory VAR6 size 4 value 0xC3595E01 virtual_protect 1
        // ~~~~~~~~~~~~~ now callback struct VAR5 is ready
    10@ = @get_samp_version_id
    0AB1: 10@ 0 _returned: ID 17@
    IF 17@ > 0
    THEN
        IF 17@ == 1 // 0.3.7 R1
        THEN
            0A8E: VAR6 = VAR4 + 0x21A0E8 // SAMP_CHAT_INPUT_INFO_OFFSET
            0A8D: VAR6 = read_memory VAR6 size 4 virtual_protect 1
            VAR4 += 0x65AD0 // SAMP_REGISTER_CLIENT_CMD_OFFSET
        END
        IF 17@ == 2 // 0.3.7 R2
        THEN
            0A8E: VAR6 = VAR4 + 0x21A0F0 // SAMP_CHAT_INPUT_INFO_OFFSET
            0A8D: VAR6 = read_memory VAR6 size 4 virtual_protect 1
            VAR4 += 0x65BA0 // SAMP_REGISTER_CLIENT_CMD_OFFSET
        END
     
        IF 17@ == 3 // 0.3.DL
        THEN
            0A8E: VAR6 = VAR4 + 0x2ACA14 // SAMP_CHAT_INPUT_INFO_OFFSET
            0A8D: VAR6 = read_memory VAR6 size 4 virtual_protect 1
            VAR4 += 0x691B0 // SAMP_REGISTER_CLIENT_CMD_OFFSET
        END
     
        IF 17@ == 4 // 0.3.7 R3
        THEN
            0A8E: VAR6 = VAR4 + 0x26E8CC // SAMP_CHAT_INPUT_INFO_OFFSET
            0A8D: VAR6 = read_memory VAR6 size 4 virtual_protect 1
            VAR4 += 0x69000 // SAMP_REGISTER_CLIENT_CMD_OFFSET
        END
     
        IF 17@ == 5 // 0.3.7 R4
        THEN
            0A8E: VAR6 = VAR4 + 0x26E9FC // SAMP_CHAT_INPUT_INFO_OFFSET
            0A8D: VAR6 = read_memory VAR6 size 4 virtual_protect 1
            VAR4 += 0x69730 // SAMP_REGISTER_CLIENT_CMD_OFFSET
        END
     
        IF 17@ == 6 // 0.3.7 R4 - v2
        THEN
            0A8E: VAR6 = VAR4 + 0x26E9FC // SAMP_CHAT_INPUT_INFO_OFFSET
            0A8D: VAR6 = read_memory VAR6 size 4 virtual_protect 1
            VAR4 += 0x69770 // SAMP_REGISTER_CLIENT_CMD_OFFSET
        END

        IF 17@ == 7 // 0.3.7 R5
        THEN
            0A8E: VAR6 = VAR4 + 0x26EB84 // SAMP_CHAT_INPUT_INFO_OFFSET
            0A8D: VAR6 = read_memory VAR6 size 4 virtual_protect 1
            VAR4 += 0x69770 // SAMP_REGISTER_CLIENT_CMD_OFFSET
        END
 
        0AA6: call_method VAR4 struct VAR6 num_params 2 pop 0 VAR5 VAR1
    END
    0AA3: free_library VAR4
END
0AB2: ret 0

:SAMPGetCarNumberPlateByVehicleID
{
    IF 0AB1: @SAMPGetCarNumberPlateByVehicleID 1 VehicleID 1249 _Returned: NumberPlate 0@
}
IF 0AA2: 31@ = "samp.dll"
THEN
    0AB1: @get_samp_version_id 0 _returned: ID 17@
    IF 17@ > 0
    THEN
        IF 17@ == 1 // 0.3.7 R1
        THEN
            31@ += 0x21A0F8 // SAMP_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x3CD // SAMP_PPOOLS_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x1C // SAMP_PPOOL_VEHICLE_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            0@ *= 0x4 // VEHICLE_ID * 0x14
            0@ += 0x1134
            005A: 31@ += 0@
            0A8D: 31@ = readMem 31@ sz 4 vp 0
            31@ += 0x93 // SAMP_VEHICLE_NUMBER_PLATE_OFFSET
            0A8D: 30@ = readMem 31@ sz 1 vp 0
        END
     
        IF 17@ == 2 // 0.3.7 R2
        THEN
            31@ += 0x21A100 // SAMP_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x3C5 // SAMP_PPOOLS_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0xC // SAMP_PPOOL_VEHICLE_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            0@ *= 0x4 // VEHICLE_ID * 0x14
            0@ += 0x1134
            005A: 31@ += 0@
            0A8D: 31@ = readMem 31@ sz 4 vp 0
            31@ += 0x93 // SAMP_VEHICLE_NUMBER_PLATE_OFFSET
            0A8D: 30@ = readMem 31@ sz 1 vp 0
        END
    
        IF 17@ == 3 // 0.3.DL
        THEN
            31@ += 0x2ACA24 // SAMP_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x3DE // SAMP_PPOOLS_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0xC // SAMP_PPOOL_VEHICLE_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            0@ *= 0x4 // VEHICLE_ID * 0x14
            0@ += 0x1134
            005A: 31@ += 0@
            0A8D: 31@ = readMem 31@ sz 4 vp 0
            31@ += 0x93 // SAMP_VEHICLE_NUMBER_PLATE_OFFSET
            0A8D: 30@ = readMem 31@ sz 1 vp 0
        END
    
        IF 17@ == 4 // 0.3.7 R3
        THEN   
            31@ += 0x26E8DC // SAMP_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x3DE // SAMP_PPOOLS_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0xC // SAMP_PPOOL_VEHICLE_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            0@ *= 0x4 // VEHICLE_ID * 0x14
            0@ += 0x1134
            005A: 31@ += 0@
            0A8D: 31@ = readMem 31@ sz 4 vp 0
            31@ += 0x93 // SAMP_VEHICLE_NUMBER_PLATE_OFFSET
            0A8D: 30@ = readMem 31@ sz 1 vp 0
        END
    
        IF 17@ == 5 // 0.3.7 R4
        THEN   
            31@ += 0x26EA0C // SAMP_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x3DE // SAMP_PPOOLS_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0xC // SAMP_PPOOL_VEHICLE_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            0@ *= 0x4 // VEHICLE_ID * 0x14
            0@ += 0x1134
            005A: 31@ += 0@
            0A8D: 31@ = readMem 31@ sz 4 vp 0
            31@ += 0x93 // SAMP_VEHICLE_NUMBER_PLATE_OFFSET
            0A8D: 30@ = readMem 31@ sz 1 vp 0
        END
    
        IF 17@ == 6 // 0.3.7 R4 - v2
        THEN    
            31@ += 0x26EA0C // SAMP_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x3DE // SAMP_PPOOLS_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x0 // SAMP_PPOOL_VEHICLE_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            0@ *= 0x4 // VEHICLE_ID * 0x14
            0@ += 0x1134
            005A: 31@ += 0@
            0A8D: 31@ = readMem 31@ sz 4 vp 0
            31@ += 0x93 // SAMP_VEHICLE_NUMBER_PLATE_OFFSET
            0A8D: 30@ = readMem 31@ sz 1 vp 0
        END

        IF 17@ == 7 // 0.3.7 R5
        THEN   
            31@ += 0x26EB94 // SAMP_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x3DE // SAMP_PPOOLS_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x0 // SAMP_PPOOL_VEHICLE_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            0@ *= 0x4 // VEHICLE_ID * 0x14
            0@ += 0x1134
            005A: 31@ += 0@
            0A8D: 31@ = readMem 31@ sz 4 vp 0
            31@ += 0x93 // SAMP_VEHICLE_NUMBER_PLATE_OFFSET
            0A8D: 30@ = readMem 31@ sz 1 vp 0
        END
 
        IF 30@ > 0
        THEN
            0485:  return_true
        ELSE
            059A:  return_false
            31@ = 0
        END
    END
    0AA3: free_library 31@
END
0AB2: ret 1 31@

:Chatmsg
/*
     0AC8: 0@ = allocate_memory_size 1024
     0AD3: 0@ = format "{FFFFFF}Auto Accept: {00FF00}ON"
     0AB1: @Chatmsg 2 text 0@ color -1
     0AC9: free_allocated_memory 0@
*/
IF 0AA2: 31@ = "samp.dll"
THEN
    0AB1: @get_samp_version_id 0 _Returned: ID 17@
    IF NOT 17@ < 1
    THEN
        IF 17@ == 1 // 0.3.7 R1
        THEN
            0A8E: 30@ = 31@ + 0x21A0E4            // SAMP_CHAT_INFO_OFFSET (R1)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x64010             // FUNC_ADDTOCHATWND (R1)
        END

        IF 17@ == 2 // 0.3.7 R2
        THEN
            0A8E: 30@ = 31@ + 0x21A0EC            // SAMP_CHAT_INFO_OFFSET (R2)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x640E0            // FUNC_ADDTOCHATWND (R2)
        END

        IF 17@ == 3 // 0.3.DL
        THEN
            0A8E: 30@ = 31@ + 0x2ACA10            // SAMP_CHAT_INFO_OFFSET (DL)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x67650             // FUNC_ADDTOCHATWND (DL)
        END

        IF 17@ == 4 // 0.3.7 R3
        THEN
            0A8E: 30@ = 31@ + 0x26E8C8            // SAMP_CHAT_INFO_OFFSET (R3)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x67460             // FUNC_ADDTOCHATWND (R3)
        END

        IF 17@ == 5 // 0.3.7 R4
        THEN
            0A8E: 30@ = 31@ + 0x26E9F8            // SAMP_CHAT_INFO_OFFSET (R4)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x67BA0             // FUNC_ADDTOCHATWND (R4) 699D0
        END
   
        IF 17@ == 6 // 0.3.7 R4 - v2
        THEN
            0A8E: 30@ = 31@ + 0x26E9F8            // SAMP_CHAT_INFO_OFFSET (R4)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x67BE0            // FUNC_ADDTOCHATWND (R4)
        END
     
        IF 17@ == 7 // 0.3.7 R5
        THEN
            0A8E: 30@ = 31@ + 0x26EB80            // SAMP_CHAT_INFO_OFFSET (R4)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x67BE0            // FUNC_ADDTOCHATWND (R4)
        END
             
        IF 1@ == -1
        THEN 1@ = 0xFFFFFFFF
        END
        0AA6: call 29@ struct 30@ num_params 5 pop 0 params 0 1@ 0 0@ 8
    END
    0AA3: free_library 31@ 
END
0AB2: ret 0
I tried to compile it on sanny builder 4, and here is the results
First pic, i got this, it said string too long, so i make it shorter at the second picture
KTh4BBt.png

Second pic, here is whats it looks like when i tried to make it shorter string
D1V6bEo.png
 

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
Okay, now it successfully compiled.
But, it doesnt work when i tested it in game, it shows no output, like nothing happend when i typed /vplate [VID], nothings came out from it
 

Attachments

  • Vplate.cs
    34.5 KB · Views: 7
  • sa-mp-010.png
    sa-mp-010.png
    1.2 MB · Views: 14

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
Downloaded the .cs you gave, but still it shows nothing on my chatlog, no output shown, im using cleo 4.4 and samp 0.3dl, is there something that i need to make it work? @Parazitas
1. Provide pictures of cars number plate which you trying to obtain

2. Server Details
3. Account
 
Last edited:
Top