Help SetVehicleVelocity

maldivass

New member
Joined
Dec 25, 2022
Messages
4
Reaction score
1
hello, is there any way to make the MTB bike not have a certain mileage (9999) I ride at a higher speed than is set by the server? Now, the MTB bike does not have a certain mileage, it rides max 70~80, but I would like to somehow get around such a thing, and pretend that I ride the bike on much more.

i only have chat gpt's code
Code:
function OnPlayerCommandText(playerid, cmdtext)
    if cmdtext == "/rideMTB" then
        local vehicleid = GetPlayerVehicleID(playerid)
        if vehicleid > 0 then
            local modelid = GetVehicleModel(vehicleid)
            if modelid == 510 then -- Model ID 510 is the Mountain Bike (MTB)
                SetVehicleVelocity(vehicleid, 0.0, 0.0, 0.2)
                return true
            else
                SendClientMessage(playerid, 0xFFFFFF00, "You are not in an MTB bike.")
            end
        else
            SendClientMessage(playerid, 0xFFFFFF00, "You are not in any vehicle.")
        end
        return false
    end
end

function GetMaxSpeed(vehicleid)
    local speedX, speedY, speedZ = GetVehicleVelocity(vehicleid)
    return math.sqrt(speedX^2 + speedY^2 + speedZ^2)
end

function OnPlayerCommandText(playerid, cmdtext)
    if cmdtext == "/maxSpeedMTB" then
        local vehicleid = GetPlayerVehicleID(playerid)
        if vehicleid > 0 then
            local modelid = GetVehicleModel(vehicleid)
            if modelid == 510 then -- Model ID 510 is the Mountain Bike (MTB)
                local maxSpeed = GetMaxSpeed(vehicleid)
                SendClientMessage(playerid, 0xFFFFFF00, "Your MTB's maximum speed is: " .. maxSpeed)
                return true
            else
                SendClientMessage(playerid, 0xFFFFFF00, "You are not in an MTB bike.")
            end
        else
            SendClientMessage(playerid, 0xFFFFFF00, "You are not in any vehicle.")
        end
        return false
    end
end
 

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,178
Solutions
6
Reaction score
902
Location
Lithuania
hello, is there any way to make the MTB bike not have a certain mileage (9999) I ride at a higher speed than is set by the server? Now, the MTB bike does not have a certain mileage, it rides max 70~80, but I would like to somehow get around such a thing, and pretend that I ride the bike on much more.

i only have chat gpt's code
Code:
function OnPlayerCommandText(playerid, cmdtext)
    if cmdtext == "/rideMTB" then
        local vehicleid = GetPlayerVehicleID(playerid)
        if vehicleid > 0 then
            local modelid = GetVehicleModel(vehicleid)
            if modelid == 510 then -- Model ID 510 is the Mountain Bike (MTB)
                SetVehicleVelocity(vehicleid, 0.0, 0.0, 0.2)
                return true
            else
                SendClientMessage(playerid, 0xFFFFFF00, "You are not in an MTB bike.")
            end
        else
            SendClientMessage(playerid, 0xFFFFFF00, "You are not in any vehicle.")
        end
        return false
    end
end

function GetMaxSpeed(vehicleid)
    local speedX, speedY, speedZ = GetVehicleVelocity(vehicleid)
    return math.sqrt(speedX^2 + speedY^2 + speedZ^2)
end

function OnPlayerCommandText(playerid, cmdtext)
    if cmdtext == "/maxSpeedMTB" then
        local vehicleid = GetPlayerVehicleID(playerid)
        if vehicleid > 0 then
            local modelid = GetVehicleModel(vehicleid)
            if modelid == 510 then -- Model ID 510 is the Mountain Bike (MTB)
                local maxSpeed = GetMaxSpeed(vehicleid)
                SendClientMessage(playerid, 0xFFFFFF00, "Your MTB's maximum speed is: " .. maxSpeed)
                return true
            else
                SendClientMessage(playerid, 0xFFFFFF00, "You are not in an MTB bike.")
            end
        else
            SendClientMessage(playerid, 0xFFFFFF00, "You are not in any vehicle.")
        end
        return false
    end
end
What about spamming W or UP ARROW?
 

Tuzas

Active member
Joined
Nov 1, 2019
Messages
126
Reaction score
72
Location
null
JavaScript:
local RPC_SetVehicleVelocity = 91

function onReceiveRpc(id, bs)
    if id == RPC_SetVehicleVelocity then
        return false
    end
end
 
Top