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

Wysłany: 2014-12-21, 18:11


Sekllik

owner - newRPG






Wiek: 25
Na forum: 4233 dni
Posty: 23
Nick w MP: Sekllik

Piwa: 139

Respekt: 12

Ostrzeżeń: 20%
Witam po siadam o to taki skypt na inter akcje pojazdu R?czny itp ale jesy jeden ma?y problem bo gdy kto? idze i podskakuje to mu pisze ?e nie jest kierowc? albo nie jest w poje?dzie jak usuwam linijke z tym to w tedy wg to nie dzia?a pomocy! ta o to kod



--W tym miejscu mo?esz ustawi? Sobie pod jakim buttonem ma otwiera? si? okno
BUTTON = "LShift"

function Skaluj(sw, sh, sw2, sh2)
local sWidth,sHeight = guiGetScreenSize()
local scaleX, scaleY=(sWidth/1600), (sHeight/900)
return (sw*scaleX), (sh*scaleY), (sw2*scaleX), (sh2*scaleY)
end

x,y,w,h = Skaluj ( 707, 405, 97, 48 )
x1,y1,w1,h1 = Skaluj ( 804, 405, 97, 48 )
x2,y2,w2,h2 = Skaluj ( 707, 453, 97, 48 )
x3,y3,w3,h3 = Skaluj ( 804, 453, 97, 48 )


przycisk = {}


addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), function()
GUIEditor = {
button = {}
}
przycisk[1] = guiCreateButton(x,y,w,h, "Silnik", false)
addEventHandler ( "onClientGUIClick", przycisk[1], function()
wykonaj ( 1 )
end, false)
przycisk[2] = guiCreateButton(x1,y1,w1,h1, "?wiat?a", false)
addEventHandler ( "onClientGUIClick", przycisk[2], function()
wykonaj ( 2 )
end, false)
przycisk[3] = guiCreateButton(x2,y2,w2,h2, "R?czny", false)
addEventHandler ( "onClientGUIClick", przycisk[3], function()
wykonaj ( 3 )
end, false)
przycisk[4] = guiCreateButton(x3,y3,w3,h3, "Zamki", false)
addEventHandler ( "onClientGUIClick", przycisk[4], function()
wykonaj ( 4 )
end, false)
for i,v in ipairs ( przycisk ) do
guiSetVisible ( przycisk[i], false )
end
end)

bindKey ( BUTTON, "down", function()
auto = getPedOccupiedVehicle ( getLocalPlayer() )
if not auto or not getVehicleController ( auto ) then
outputChatBox ( "*Nie jeste? w poje?dzie b?d? nie jeste? jego kierowc?", 255, 255, 255 ) return end
interakcja ( 1 )
end)

bindKey ( BUTTON, "up", function()
interakcja ( 2 )
end)



function interakcja ( type )
if not type or type == nil then return end
type = tonumber(type)
if type == 1 then
for i,v in ipairs ( przycisk ) do
guiSetVisible ( przycisk[i], true )
showCursor ( true )
end
elseif type == 2 then
for i,v in ipairs ( przycisk ) do
guiSetVisible ( przycisk[i], false )
showCursor ( false )
end
end
end


function wykonaj ( number )
if not number or number == nil then return end
number = tonumber(number)
if number == 1 then
triggerServerEvent ( "silnik", getLocalPlayer() )
elseif number == 2 then
triggerServerEvent ( "swiatla", getLocalPlayer() )
elseif number == 3 then
triggerServerEvent ( "reczny", getLocalPlayer() )
elseif number == 4 then
triggerServerEvent ( "zamki", getLocalPlayer() )
end
end

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-12-22, 00:15


Jeey

Lua, Grafik






Wiek: 27
Na forum: 4339 dni
Posty: 98
Nick w MP: Jeey

Piwa: 383

Respekt: 80

Ostrzeżeń: 100%
outputChatBox "*Nie jeste? w poje?dzie b?d? nie jeste? jego kierowc?"255255255 )

usu? to

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-12-22, 12:08


Sekllik

owner - newRPG






Wiek: 25
Na forum: 4233 dni
Posty: 23
Nick w MP: Sekllik

Piwa: 139

Respekt: 12

Ostrzeżeń: 20%
"Jeey" napisał/a:

outputChatBox "*Nie jeste? w poje?dzie b?d? nie jeste? jego kierowc?"255255255 )

usu? to
Ok zrobi?em to ale nie dzia?a mi interakcja jak klikam co? to nie dzia?a

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-12-22, 12:30


Colin_Carleone







Wiek: 30
Na forum: 5725 dni
Posty: 373

Piwa: 4800

Respekt: 83,3

Ju? wiem sk?d to masz :)

Strona client'a :


BUTTON "LSHIFT"

function Skaluj(swshsw2sh2) 
    local sWidth,sHeight guiGetScreenSize()
    local scaleXscaleY=(sWidth/1600), (sHeight/900)
    return (sw*scaleX), (sh*scaleY), (sw2*scaleX), (sh2*scaleY)
end

x,y,w,Skaluj 129027019748 )
x1,y1,w1,h1 Skaluj 129032019748 )
x2,y2,w2,h2 Skaluj 129037019748 )
x3,y3,w3,h3 Skaluj 129042019748 )

okno guiCreateWindow(x,y,w,h"Panel Pojazdu"false)
guiWindowSetSizable(oknofalse)
guiSetVisible oknofalse )

przycisk = {}


addEventHandler "onClientResourceStart"getResourceRootElement(getThisResource()), function()
GUIEditor = {
    button = {}
}
przycisk[1] = guiCreateButton(x,y,w,h"Silnik"false)
addEventHandler "onClientGUIClick"przycisk[1], function()
wykonaj )
endfalse)
przycisk[2] = guiCreateButton(x1,y1,w1,h1"?wiat?a"false)
addEventHandler "onClientGUIClick"przycisk[2], function()
wykonaj )
endfalse)
przycisk[3] = guiCreateButton(x2,y2,w2,h2"R?czny"false)
addEventHandler "onClientGUIClick"przycisk[3], function()
wykonaj )
endfalse)
przycisk[4] = guiCreateButton(x3,y3,w3,h3"Zamki"false)
addEventHandler "onClientGUIClick"przycisk[4], function()
wykonaj )
endfalse)
for i,v in ipairs przycisk ) do
guiSetVisible przycisk[i], false )
end
end)

bindKey BUTTON"down", function()
auto getPedOccupiedVehicle getLocalPlayer() )
if not auto or not getVehicleController auto then
return end
interakcja )
end)

bindKey BUTTON"up", function()
interakcja )
end)



function interakcja type )
if not type or type == nil then return end
type tonumber(type)
if type == 1 then
for i,v in ipairs przycisk ) do
guiSetVisible przycisk[i], true )
showCursor true )
end
elseif type == 2 then
for i,v in ipairs przycisk ) do
guiSetVisible przycisk[i], false )
showCursor false )
end
end
end


function wykonaj number )
if not number or number == nil then return end
number tonumber(number)
if number == 1 then
triggerServerEvent "silnik"getLocalPlayer() )
elseif number == 2 then
triggerServerEvent "swiatla"getLocalPlayer() )
elseif number == 3 then
triggerServerEvent "reczny"getLocalPlayer() )
elseif number == 4 then
triggerServerEvent "zamki"getLocalPlayer() )
end
end


Strona servera:


addEvent "silnik"true )
addEventHandler "silnik"root, function ()
auto getPedOccupiedVehicle source )
silnik getVehicleEngineState auto )
if silnik == false then
outputChatBox(getPlayerName(source).." odpala silnik w poje?dzie."source7068144 )
setVehicleEngineState autotrue )
else
setVehicleEngineState autofalse )
outputChatBox(getPlayerName(source).." gasi silnik w poje?dzie."source7068144 )
end
end)

addEvent "swiatla"true )
addEventHandler "swiatla"root, function()
auto getPedOccupiedVehicle source )
if getVehicleOverrideLights auto ) ~= 2 then
setVehicleOverrideLights auto)
outputChatBox(getPlayerName(source).." w??cza ?wiat?a w poje?dzie."source7068144 )
else
setVehicleOverrideLights auto)
outputChatBox(getPlayerName(source).." wy??cza ?wiat?a w poje?dzie."source7068144 )
end
end)

addEvent "reczny"true )
addEventHandler "reczny"root, function()
auto getPedOccupiedVehicle source )
if isElementFrozen auto then
setElementFrozen autofalse )
outputChatBox(getPlayerName(source).. " zwalnia r?czny w poje?dzie."source7068144 )
else
setElementFrozen autotrue )
outputChatBox(getPlayerName(source).. " zaci?ga r?czny w poje?dzie."source7068144 )
end
end)

addEvent "zamki"true )
addEventHandler "zamki"root, function()
auto getPedOccupiedVehicle source )
if isVehicleLocked auto then
setVehicleLocked autofalse )
outputChatBox(getPlayerName(source).." otwiera drzwi pojazdu."source7068144 )
else
setVehicleLocked autotrue )
outputChatBox(getPlayerName(source).." zamyka drzwi pojazdu."source7068144 )
end
end)


No i meta :)


<meta>
<script src="server_kontrola.lua"/>
<script src="client_kontrola.lua" type="client"/>
</meta>


Pozdrawiam i mam nadziej? ?e pomog?em :)

[ Dodano: 2014-12-22, 12:31 ]
Dla leniwych :D Gotowiec.

Ukryta wiadomość / Hidden message(aby ją zobaczyć musisz postawić użytkownikowi)
Wiadomość została ukryta, aby ją przeczytać należy się zalogować.


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Dejvmistrz
Wysłany: 2014-12-22, 18:12


Jeey

Lua, Grafik






Wiek: 27
Na forum: 4339 dni
Posty: 98
Nick w MP: Jeey

Piwa: 383

Respekt: 80

Ostrzeżeń: 100%
Colin_Carleone, to nie jest tw?j kod nie mo?esz go pod hide

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-12-22, 22:27


Colin_Carleone







Wiek: 30
Na forum: 5725 dni
Posty: 373

Piwa: 4800

Respekt: 83,3

Jeey, mog? da? go w hide je?li go modyfikowa?em lub po prostu da?em gotowca aby si? ch?opaki nie przem?czali klikaj?c :

kopiuj -> wklej :D

Postaw piwo autorowi tego posta
 

 
Tagi: panel :: interakcji :: pojazdu
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA 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