Jump to content

NO! Handling


qaisjp

Recommended Posts

  • MTA Team
Posted

I have made a resource with a friend that detects and warns the player that he has handling modifications. I have a clean handling and I recently became aware that it also detects when going downhill. I need a bit of help in this, cos when people set their position to something high and go dropping down in a car this sometimes goes to 500kmph (Especially when I created a tram and warped my ped into it)

Code:

  
  
local playerVehicleTimer = { } 
local playerCaught = { } 
  
local maxSpeedList = { 
    160, -- Landstalker (and so on and on and on in a proper order) 
} 
function detectSpeedMod(thePlayer) 
    if isElement(thePlayer) then 
        if (playerCaught[thePlayer] == false) then 
            local theVehicle = getPedOccupiedVehicle(thePlayer) 
            if (theVehicle == false) then 
                playerCaught[thePlayer] = false 
                if (playerVehicleTimer[source] ~= false and playerVehicleTimer[source] ~= nil) then 
                    killTimer(playerVehicleTimer[thePlayer]) 
                end 
                playerVehicleTimer[thePlayer] = nil 
                return 
            end 
             
            local id = getElementModel(theVehicle) 
            local speedX, speedY, speedZ = getElementVelocity(theVehicle) 
            local actualSpeed = math.floor(((speedX ^ 2 + speedY ^ 2 + speedZ ^ 2) ^ (0.5)) * 100 * 1.61) 
             
            local i = (id - 399) 
            local percentage = math.floor(((actualSpeed * 100) / maxSpeedList[i]) - 100) 
            if (percentage >= 21) then 
                -- The player is using speedmod or has a modified handling.cfg. 
                -- We report it. 
                triggerEvent("reportToStaffLog", getRootElement(), thePlayer, "Speedmod / Modified handling", getVehicleName(theVehicle) .. " (+" .. tostring(percentage) .. "%)") 
                playerCaught[thePlayer] = true 
                return 
            end 
  
            playerVehicleTimer[thePlayer] = setTimer(detectSpeedMod, 5000, 1, thePlayer) 
        end 
    end 
end 
  

Don't worry about the calling of the function.

So how to make it detect if the player is going downhill. Could you provide me a function like isPlayerVehicleGoingDownwards()

Posted

I don't understand, why do you need this? MTA has it already... if you modify any data file of GTA:SA you can't join any server.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

  • MTA Team
Posted

I don't only need it for handling. I need it for something else too. (The downhill thing)

  • Moderators
Posted (edited)

Maybe this ? ( uncomment the correct line ):

CODE EDITED: Use isVehicleOnGround in client-side

local playerVehicleTimer = { } 
local playerCaught = { } 
  
local maxSpeedList = { 
    160, -- Landstalker (and so on and on and on in a proper order) 
} 
function detectSpeedMod(thePlayer) 
    if isElement(thePlayer) then 
        if (playerCaught[thePlayer] == false) then 
            local theVehicle = getPedOccupiedVehicle(thePlayer) 
            if (theVehicle == false) then 
                playerCaught[thePlayer] = false 
                if (playerVehicleTimer[source] ~= false and playerVehicleTimer[source] ~= nil) then 
                    killTimer(playerVehicleTimer[thePlayer]) 
                end 
                playerVehicleTimer[thePlayer] = nil 
                return 
            end 
  
            local id = getElementModel(theVehicle) 
            local speedX, speedY, speedZ = getElementVelocity(theVehicle) 
            local actualSpeed = math.floor(((speedX ^ 2 + speedY ^ 2 + speedZ ^ 2) ^ (0.5)) * 100 * 1.61) 
            if ( not IsVehicleOnGround( theVehicle ) ) then return end 
            local i = (id - 399) 
            local percentage = math.floor(((actualSpeed * 100) / maxSpeedList[i]) - 100) 
            if (percentage >= 21) then 
                -- The player is using speedmod or has a modified handling.cfg. 
                -- We report it. 
                triggerEvent("reportToStaffLog", getRootElement(), thePlayer, "Speedmod / Modified handling", getVehicleName(theVehicle) .. " (+" .. tostring(percentage) .. "%)") 
                playerCaught[thePlayer] = true 
                return 
            end 
  
            playerVehicleTimer[thePlayer] = setTimer(detectSpeedMod, 5000, 1, thePlayer) 
        end 
    end 
end  

Edited by Guest

The rEvolution is coming ...

Posted

getElementRotation would be able to tell you if a vehicle is going down a hill just play around with it and see which of the X Y Z will be what when its going down hill.

Posted

Well, Oz, we already know that AFS is using stolen DKR client side scripts ;)

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Well, as you know, some of AFS scripts (such as chat channel) is stolen client-side scripts from DKR.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...