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

Wysłany: 2023-05-24, 11:51


mis14







Wiek: 25
Na forum: 3924 dni
Posty: 185

Piwa: 73

Respekt: -149

witam nie dzia?a mi otwieranie w takich pojazdach jak pony reszta pojazd?w jak messa dzia?a.

Kod:

addEvent("baga?nik",true)
addEventHandler("baga?nik",root,function()
local v = getPedOccupiedVehicle(source)
if v then
if getVehicleDoorOpenRatio(v,1) == 0 then
setVehicleDoorOpenRatio(v,1,1,2500)
outputChatBox("otwiera baga?nik w samochodzie.",source)
else
setVehicleDoorOpenRatio(v,1,0,2500)
outputChatBox( "zamyka baga?nik w samochodzie.",source)
end
end
end)


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
borsuk
Wysłany: 2023-05-24, 12:51


MlodyRafonix







Wiek: 26
Na forum: 1899 dni
Posty: 103

Piwa: 954

Respekt: 60

Poka? najlepiej tak?e trigger.

+ Je?li robisz addEvent po stronie serwera, to powiniene? okre?la? gracza jako client, wi?cej na ten temat znajdziesz tutaj: https://wiki.multitheftauto.com/wiki/TriggerServerEvent

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
borsuk
Wysłany: 2023-05-24, 13:16


mis14







Wiek: 25
Na forum: 3924 dni
Posty: 185

Piwa: 73

Respekt: -149

"MlodyRafonix" napisał/a:

Poka? najlepiej tak?e trigger.

+ Je?li robisz addEvent po stronie serwera, to powiniene? okre?la? gracza jako client, wi?cej na ten temat znajdziesz tutaj: https://wiki.multitheftauto.com/wiki/TriggerServerEvent


Kod:



function shadowText2(text, x, y, w, h, color, size, font, xx, yy)
dxDrawText(text, x, y, w, h, color, size, font, xx, yy, false,false,false,true)
end

function shadowText(text, x, y, w, h, color, size, font, xx, yy)
dxDrawText(text, x+1, y+1, w+1, h+1, tocolor(0,0,0), size, font, xx, yy, false)
dxDrawText(text, x, y, w, h, color, size, font, xx, yy, false,false,false,true)
end

function roundedRectangle(x, y, w, h, color)

dxDrawRectangle(x, y, w, h, color, false)
dxDrawRectangle(x + 2, y - 1, w - 4, 1, color, false)
dxDrawRectangle(x + 2, y + h, w - 4, 1, color, false)
dxDrawRectangle(x - 1, y + 2, 1, h - 4, color, false)
dxDrawRectangle(x + w, y + 2, 1, h - 4, color, false)
end
local font = "default-bold"












local w,h = guiGetScreenSize()
local rowery = {[509]=true,[481]=true,[444]=false}

local font = "arial"

function gui()
local v = getPedOccupiedVehicle(localPlayer)
if getVehicleOverrideLights(v) ~= 2 then
w1 = "Zapal ?wiat?a"
else
w1 = "Zga? ?wiat?a"
end

local silnik = getVehicleEngineState(v)
if silnik == false then
w2 = "Zapal silnik"
else
w2 = "Zga? silnik"
end

local drzwi = math.random(0,1)
if drzwi == true then
w3 = "Otw?rz drzwi"
else
w3 = "Zamknij drzwi"
end

if isElementFrozen(v) then
w4 = "Spu?? r?czny"
else
w4 = "Zaci?gnij r?czny"
end

if getVehicleDoorOpenRatio(v,0) == 0 then
w5 = "Otw?rz mask?"
else
w5 = "Zamknij mask?"
end

if getVehicleDoorOpenRatio(v,1) == 0 then
w6 = "Otw?rz baga?nik"
else
w6 = "Zamknij baga?nik"
end

r1,r2,r3,r4,r5,r6 = 0.9,0.9,0.9,0.9,0.9,0.9
local wybor = getElementData(localPlayer,"wybor")
if wybor == 1 then
r1 = 1.2
elseif wybor == 2 then
r2 = 1.2
elseif wybor == 3 then
r3 = 1.2
elseif wybor == 4 then
r4 = 1.2
elseif wybor == 5 then
r5 = 1.2
elseif wybor == 6 then
r6 = 1.2
end



roundedRectangle(w * 0.4363, h * 0.36, w * 0.0971, h * 0.0322, tocolor(0, 60, 255, 100), false)
dxDrawText(w1, w * 0.75000, h * 0.37, w * 0.2266, h * 0.3278, tocolor(255,255,255, 255), r1, font, "center", "top", false, false, false, false, false)

roundedRectangle(w * 0.4363, h * 0.41, w * 0.0971, h * 0.0322, tocolor(0, 60, 255, 100), false)
dxDrawText(w2, w * 0.75000, h * 0.42, w * 0.2266, h * 0.3278, tocolor(255,255,255, 255), r2, font, "center", "top", false, false, false, false, false)

roundedRectangle(w * 0.4363, h * 0.46, w * 0.0971, h * 0.0322, tocolor(0, 60, 255, 100), false)
dxDrawText(w3, w * 0.75000, h * 0.47, w * 0.2266, h * 0.3278, tocolor(255,255,255, 255), r3, font, "center", "top", false, false, false, false, false)
local sx,sy,sz = getElementVelocity(v)
local kmhs = math.ceil(((sx^2+sy^2+sz^2)^(0.5))*155)
if kmhs < 20 then

roundedRectangle(w * 0.4263, h * 0.33, w * 0.12, h * 0.35, tocolor(0, 0, 0, 30), false)
roundedRectangle(w * 0.4263, h * 0.33, w * 0.12, h * 0.02, tocolor(0, 60, 255, 60), false)
dxDrawText("Interakcja", w * 0.75000, h * 0.33, w * 0.2266, h * 0.3278, tocolor(255,255,255, 255), 1.2, font, "center", "top", false, false, false, false, false)
setElementData(localPlayer,"maxwybor",6)

roundedRectangle(w * 0.4363, h * 0.51, w * 0.0971, h * 0.0322, tocolor(0, 60, 255, 100), false)
dxDrawText(w4, w * 0.75000, h * 0.52, w * 0.2266, h * 0.3278, tocolor(255,255,255, 255), r4, font, "center", "top", false, false, false, false, false)

roundedRectangle(w * 0.4363, h * 0.56, w * 0.0971, h * 0.0322, tocolor(0, 60, 255, 100), false)
dxDrawText(w5, w * 0.75000, h * 0.57, w * 0.2266, h * 0.3278, tocolor(255,255,255, 255), r5, font, "center", "top", false, false, false, false, false)

roundedRectangle(w * 0.4363, h * 0.61, w * 0.0971, h * 0.0322, tocolor(0, 60, 255, 100), false)
dxDrawText(w6, w * 0.75000, h * 0.62, w * 0.2266, h * 0.3278, tocolor(255,255,255, 255), r6, font, "center", "top", false, false, false, false, false)
else
setElementData(localPlayer,"maxwybor",3)
roundedRectangle(w * 0.4263, h * 0.33, w * 0.12, h * 0.175, tocolor(0, 0, 0, 30), false)
roundedRectangle(w * 0.4263, h * 0.33, w * 0.12, h * 0.02, tocolor(0, 60, 255, 60), false)
dxDrawText("Interakcja", w * 0.75000, h * 0.33, w * 0.2266, h * 0.3278, tocolor(255,255,255, 255), 1.2, font, "center", "top", false, false, false, false, false)
end
end

function wybor1(key,state)
if state == "down" then
if getElementData(localPlayer,"wybor") == 1 then return end
setElementData(localPlayer,"wybor",getElementData(localPlayer,"wybor")-1)
end
end

function wybor2(key,state)
if state == "down" then
if getElementData(localPlayer,"wybor") == getElementData(localPlayer,"maxwybor") then return end
setElementData(localPlayer,"wybor",getElementData(localPlayer,"wybor")+1)
end
end

function pokazinterakcje(value)
local v = getPedOccupiedVehicle(localPlayer)
if v and getVehicleController(v) == localPlayer then
if rowery[getElementModel(v)] then return end
if value == true then
if getElementData(v,"dokupienia") then return end
addEventHandler("onClientRender",root,gui)
bindKey("arrow_up","both",wybor1)
bindKey("arrow_down","both",wybor2)
bindKey("arrow_u","both",wybor1)
bindKey("arrow_d","both",wybor2)
elseif value == false then
if getElementData(v,"dokupienia") then return end
removeEventHandler("onClientRender",root,gui)
unbindKey("arrow_up","both",wybor1)
unbindKey("arrow_down","both",wybor2)
unbindKey("arrow_u","both",wybor1)
unbindKey("arrow_d","both",wybor2)
end
end
end

bindKey("lshift", "both", function(key,state)
if state == "down" then
pokazinterakcje(true)
setElementData(localPlayer,"wybor",1)
elseif state == "up" then
wybierz()
pokazinterakcje(false)
end
end)

function wybierz()
local wybrano = getElementData(localPlayer,"wybor")
local v = getPedOccupiedVehicle(localPlayer)
if not v then return end
if v and getVehicleController(v) == localPlayer then
if wybrano == 1 then
triggerServerEvent("?wiat?a", localPlayer)
elseif wybrano == 2 then
triggerServerEvent("silnik", localPlayer)
elseif wybrano == 3 then
triggerServerEvent("drzwi", localPlayer)
elseif wybrano == 4 then
triggerServerEvent("r?czny", localPlayer)
elseif wybrano == 5 then
triggerServerEvent("maska", localPlayer)
elseif wybrano == 6 then
triggerServerEvent("baga?nik", localPlayer)
end
end
end

function zamknij(plr,seat)
if plr ~= localPlayer then return end
if seat ~= 0 then return end
removeEventHandler("onClientRender",root,gui)
unbindKey("arrow_u","both",wybor1)
unbindKey("arrow_d","both",wybor2)
end
addEventHandler("onClientVehicleStartExit",root,zamknij)
addEventHandler("onClientVehicleExit",root,zamknij)


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
borsuk
Wysłany: 2023-06-10, 16:47


!ryzee

rebornMTA






Wiek: 19
Na forum: 2253 dni
Posty: 111
Nick w MP: drakovskyy

Piwa: 55

Respekt: 60

najpro?ciej by?oby rozpocz?? twoj? nauk? za pomoc? wiki, poradnik?w lub poprostu wzorowa? si? na kodzie od innych, zasob?w na baga?nik znajdziesz tutaj pe?no, w ka?dej dowolnej interakcji w tych czasach to jest, podpatrz, i spr?buj zdzia?a? co? sam, je?li si? nie uda, skontaktuj si? tutaj ponownie.

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
borsuk
Tagi: otwieranie
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Odpowiedz do tematu

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