Jump to content

[Help] Speed


Resulcan

Recommended Posts

Friends First of all, I made such a Panel 

In this panel, I want to drive the person's car and increase his speed

Server How To Increase The Speed Of The Car When The Person's Button Is Clicked

Quickly Boost Your Own Car With Vip Buyers

 

 

---------------------------------Client.lua

local screenW, screenH = guiGetScreenSize()
Wnd = guiCreateWindow((screenW - 389) / 2, (screenH - 310) / 2, 389, 310, "Araba Motor Güçlendirme", false)
guiWindowSetSizable(Wnd, false)
guiSetVisible(Wnd, false) 

motorB = guiCreateLabel(29, 21, 61, 15, "1.lvl Motor", false, Wnd)
guiSetFont(motorB, "default-bold-small")
motori = guiCreateLabel(29, 42, 61, 15, "250 KM/h", false, Wnd)
guiSetFont(motori, "default-bold-small")

VipM = guiCreateButton(136, 215, 100, 31, "Satın Al", false, Wnd)
Kapat = guiCreateButton(136, 267, 100, 31, "Kapat", false, Wnd)

---------------------------------Sever.lua

local predefinedHandling = {
    [411] = {
        ["engineAcceleration"] = 200,
        ["dragCoeff"] = 0,
        ["maxVelocity"] = 200,
        ["tractionMultiplier"] = 1.5,
        ["tractionLoss"] = 1.1,
    },
    
for i,v in pairs (predefinedHandling) do
    if i then
        for handling, value in pairs (v) do
            if not setModelHandling (i, handling, value) then
                outputDebugString ("* Önceden Tanımlanmış Kullanım '"..tostring(handling).."' Araç Modeli İçin '"..tostring(i).."' Olarak Ayarlanamadı '"..tostring(value).."'")
            end
        end
    end
end

for _,v in ipairs (getElementsByType("vehicle")) do
    if v and predefinedHandling[getElementModel(v)] then
        for k,vl in pairs (predefinedHandling[getElementModel(v)]) do
            setVehicleHandling (v, k, vl)
        end
    end
end

function resetHandling()
    for model in pairs (predefinedHandling) do
        if model then
            for k in pairs(getOriginalHandling(model)) do
                setModelHandling(model, k, nil)
            end
        end
    end

    for _,v in ipairs (getElementsByType("vehicle")) do
        if v then
            local model = getElementModel(v)
            if predefinedHandling[model] then
                for k,h in pairs(getOriginalHandling(model)) do
                    setVehicleHandling(v, k, h)
                end
            end
        end
    end
end
addEventHandler("onResourceStop", resourceRoot, resetHandling)

Link to comment

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...