Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2021-05-02, 18:15


NeveQ







Wiek: 28
Na forum: 3388 dni
Posty: 24

Piwa: 1

Respekt: 50

Siema!
Og?lnie to chcia?bym przerobi? Rh1 kt?re jest w gui ?eby by?o pod klawiszami num8 i num2 da?oby rad? takie co? zrobi??


c.lua

addEventHandler("onClientResourceStart", resourceRoot,
function()
rh = guiCreateWindow(0.00, 0.93, 0.14, 0.07, "Gwintowane zawieszenie", true)
guiWindowSetSizable(rh, false)
guiWindowSetMovable(rh, false)

gora = guiCreateButton(0.05, 0.46, 0.43, 0.36, "Podwy?sz", true, rh)
dol = guiCreateButton(0.54, 0.46, 0.41, 0.36, "Obni?", true, rh)
guiSetVisible(rh, false)
end
)
addEventHandler("onClientGUIClick", resourceRoot, function(btn)
local veh = getPedOccupiedVehicle(localPlayer)
if source == gora then
triggerServerEvent("rh:p", root, veh)
elseif source == dol then
triggerServerEvent("rh:o", root, veh)
end
end)

function patch()
local veh = getPedOccupiedVehicle(localPlayer)
if not veh then
if rh and ( guiGetVisible ( rh ) == true ) then
guiSetVisible(rh, false)
end
end
end
addEventHandler("onClientRender", root, patch)

function show()
guiSetVisible(rh, true)
end
addEvent( "rhshow", true )
addEventHandler( "rhshow", root, show )
fileDelete("c.lua")


s.lua

function getVehicleHandlingProperty ( element, property )
if isElement ( element ) and getElementType ( element ) == "vehicle" and type ( property ) == "string" then
local handlingTable = getVehicleHandling ( element )
local value = handlingTable[property]

if value then
return value
end
end

return false
end

function o(c)
if c then
local gora = getElementData(c, "rh:up") or 0
local s=getVehicleHandlingProperty(c,"suspensionForceLevel")
if tonumber(gora) == 4 then outputChatBox("* Osi?gn??e?(a?) limit regulacji zawieszenia !", getVehicleController(c), 255, 255, 255) cancelEvent() return end
setVehicleHandling(c,"suspensionForceLevel",tonumber(s) - 0.24)
setElementData(c, "rh:up", gora+1)
outputChatBox("* Auto zosta?o obni?one.",getVehicleController(c),255,255,255,true)
end
end
addEvent("rh:o", true)
addEventHandler("rh:o", root, o)
function p(c)
if c then
local gora = getElementData(c, "rh:up") or 0
local s=getVehicleHandlingProperty(c,"suspensionForceLevel")
if tonumber(gora) == -8 then outputChatBox("* Osi?gn??e?(a?) limit regulacji zawieszenia !", getVehicleController(c), 255, 255, 255) cancelEvent() return end
setVehicleHandling(c,"suspensionForceLevel",tonumber(s) + 0.24)
setElementData(c, "rh:up", gora-1)
outputChatBox("* Auto zosta?o podwy?szone.",getVehicleController(c),255,255,255,true)
end
end
addEvent("rh:p", true)
addEventHandler("rh:p", root, p)

addEventHandler("onPlayerVehicleEnter", root,
function(car, seat)
if seat ~= 0 then return end
if getElementData(car, "vehicle:id") and getElementData(source, "player:sid") then
local qr = exports['f-db']:dbGet("SELECT * FROM pystories_vehicles WHERE id=? AND rh=?",getElementData(car, "vehicle:id"), "1")
if #qr == 1 then
triggerClientEvent(source,"rhshow", root)
end
end
end)

Komentarz Shuffle dodany 2021-05-02, 18:38Kod wrzucaj do [code] lub [lua]
Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-05-02, 18:39


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4395 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

[zb]https://gtao.pl/prosby-o-przerobienie-skryptu-vt82444.htm[/zb]

Postaw piwo autorowi tego posta
 

 
Tagi: zmiana :: rh1 :: gui :: klawisze
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Zmiana RH1 z gui na klawisze Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku