Help [REQ] Vehicle Get Plate CLEO

kokom7

Active member
Joined
Nov 4, 2016
Messages
35
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,301
Solutions
6
Reaction score
931
Location
Lithuania
SAMPFUNC doesn't have function for number plates xD

Not everything is Around SAMPFUNC..


 

kokom7

Active member
Joined
Nov 4, 2016
Messages
35
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
35
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,301
Solutions
6
Reaction score
931
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?
 
Top