Wysłany: 2017-07-22, 17:22
KilusTv
Wiek: 28 Na forum: 3999 dni Posty: 58
Nick w MP: KilusTv
Piwa : 1
local screenW , screenH = guiGetScreenSize ()
we = guiCreateButton ( 544 , 454 , 143 , 43 , "Wejd? na s?u?b?" , false )
ze = guiCreateButton ( 821 , 455 , 147 , 42 , "Zejd? ze s?u?by" , false )
wy = guiCreateButton ( 684 , 510 , 137 , 33 , "Zamknij" , false )
guiSetProperty ( we , "NormalTextColour" , "FFAAAAAA" )
guiSetVisible ( we , false )
guiSetProperty ( ze , "NormalTextColour" , "FFAAAAAA" )
guiSetVisible ( ze , false )
guiSetProperty ( wy , "NormalTextColour" , "FFAAAAAA" )
guiSetVisible ( wy , false )
addEvent ( "showGUI" , true )
addEventHandler ( "showGUI" , getRootElement (), function()
guiSetVisible ( we , true )
addEventHandler ( "onClientRender" , getRootElement (), drawPanel )
showCursor ( true )
end )
addEvent ( "showGUI" , true )
addEventHandler ( "showGUI" , getRootElement (), function()
guiSetVisible ( ze , true )
addEventHandler ( "onClientRender" , getRootElement (), drawPanel )
showCursor ( true )
end )
addEvent ( "showGUI" , true )
addEventHandler ( "showGUI" , getRootElement (), function()
guiSetVisible ( wy , true )
addEventHandler ( "onClientRender" , getRootElement (), drawPanel )
showCursor ( true )
end )
function drawPanel ()
dxDrawImage ( 320 , 357 , 763 , 288 , ":frakcja-psp/tlofrakcji.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
dxDrawImage ( 424 , 432 , 125 , 113 , ":syrenkapsp/logo2.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
dxDrawText ( "Frakcja Pa?stwowa Stra? Po?arna" , 409 , 379 , 1001 , 422 , tocolor ( 254 , 29 , 29 , 255 ), 1.50 , "pricedown" , "center" , "top" , false , false , false , false , false )
dxDrawText ( "Designed & Created by KilusTv" , 833 , 532 , 986 , 539 , tocolor ( 255 , 255 , 255 , 255 ), 0.90 , "arial" , "left" , "top" , false , false , false , false , false )
end
addEventHandler ( "onClientGUIClick" , we , function()
------- nie wiem jakiego tutaj triggera dac
guiSetVisible ( we , false )
removeEventHandler ( "onClientRender" , getRootElement (), drawPanel )
showCursor ( false )
end , false )
addEventHandler ( "onClientGUIClick" , we , function()
guiSetVisible ( ze , false )
removeEventHandler ( "onClientRender" , getRootElement (), drawPanel )
showCursor ( false )
end , false )
addEventHandler ( "onClientGUIClick" , we , function()
guiSetVisible ( wy , false )
removeEventHandler ( "onClientRender" , getRootElement (), drawPanel )
showCursor ( false )
end , false )
addEventHandler ( "onClientGUIClick" , wy , function()
guiSetVisible ( wy , false )
removeEventHandler ( "onClientRender" , getRootElement (), drawPanel )
showCursor ( false )
end , false )
addEventHandler ( "onClientGUIClick" , wy , function()
guiSetVisible ( we , false )
removeEventHandler ( "onClientRender" , getRootElement (), drawPanel )
showCursor ( false )
end , false )
addEventHandler ( "onClientGUIClick" , wy , function()
guiSetVisible ( ze , false )
removeEventHandler ( "onClientRender" , getRootElement (), drawPanel )
showCursor ( false )
end , false )
addEventHandler ( "onClientGUIClick" , ze , function()
guiSetVisible ( ze , false )
removeEventHandler ( "onClientRender" , getRootElement (), drawPanel )
showCursor ( false )
end , false )
addEventHandler ( "onClientGUIClick" , ze , function()
guiSetVisible ( we , false )
removeEventHandler ( "onClientRender" , getRootElement (), drawPanel )
showCursor ( false )
end , false )
addEventHandler ( "onClientGUIClick" , ze , function()
guiSetVisible ( wy , false )
removeEventHandler ( "onClientRender" , getRootElement (), drawPanel )
showCursor ( false )
end , false )
--- addEvent
--- addEventHandler
--- ^ Nie wiem jaki event da ? aby mozna
up strona clienta
function isPlayerInFaction ( plr )
local uid = getElementData ( plr , 'player:uid' )
if not uid then return end
local result = exports [ 'ogrpg-db' ]: dbGet ( 'SELECT 1 FROM ogrpg_factions WHERE code=? AND uid=? LIMIT 1;' , "PSP" , uid )
if result [ 1 ] then
return true
else
return false
end
end
local licz = {}
marker = createMarker ( 1090.59 , 2377.09 , 10.5 , 'corona' , 0.8 , 0 , 0 , 255 )
addEventHandler ( 'onMarkerHit' , marker , function( el , md )
if isPlayerInFaction ( el ) then
if not getElementData ( el , 'player:duty' ) then
setElementModel ( el , 201 )
setPlayerNametagColor ( el , 0 , 0 , 255 )
exports [ 'frakcja' ]: rozpocznijnaliczanie ( el )
setElementData ( el , 'player:duty' , 'PSP' )
local rank = exports [ 'frakcja' ]: getPlayerFactionRank ( el , 'PSP' )
setElementData ( el , "player:rank" , rank )
giveWeapon ( el , 42 , 9999 )
else
exports [ 'frakcja' ]: zatrzymajnaliczanie ( el )
takeWeapon ( el , 42 )
removeElementData ( el , 'player:duty' )
removeElementData ( el , "player:rank" )
local skin = getElementData ( el , "player:skin" )
setElementModel ( el , skin )
end
else
outputChatBox ( 'Nie jeste? pracownikiem frakcji PSP.' , el , 255 , 0 , 0 )
end
end )
function naliczanie ( el )
if isElement ( el ) then
local x = getElementData ( el , "player:workinjob" ) or 0
setElementData ( el , "player:workinjob" , x + 1 )
else
if isTimer ( licz [ el ]) then
killTimer ( licz [ el ])
licz [ el ] = nil
end
end
end
up strona servera.
Chcialbym aby ktos pomogl mi zrobic tak ze po kliknieciu rozpocznij sluzbe (guzik o nazwie we) mozna bylo wejsc na sluzbe w PSP. Natomiast gdy kliknie sie zakoncz sluzbe, (guzik oznaczony ze) schodzilo nam ze sluzby. Zakoncz bylo proste do zrobienia i juz jest. Prosze bardzo o pomoc. STAWIAM PIWKO I RESPEKTAAAA
Wysłany: 2017-07-22, 17:31
amited
Wiek: 26 Na forum: 3714 dni Posty: 1233
Nick w MP: Amited
Piwa : 512
addEventHandler ( "onClientGUIClick" , we , function()
setElementData ( localPlayer , "player:duty" , false )
guiSetVisible ( we , false )
removeEventHandler ( "onClientRender" , getRootElement (), drawPanel )
showCursor ( false )
end , false )
w server side masz przy wchodzeniu w marker i tam dostajesz bro? oraz element daty ale wymagana jest data "player:duty" na false
Podpis
"amited" napisał/a :
Wysłany: 2017-07-22, 17:45
KilusTv
Wiek: 28 Na forum: 3999 dni Posty: 58
Nick w MP: KilusTv
Piwa : 1
dobra a jakiegos triggera mam gdzies wpychac czy niepotrzebne
Wysłany: 2017-07-22, 17:49
neku^
Wiek: 24 Na forum: 3521 dni Posty: 461
Nick w MP: neku^
Piwa : 1186
Nie, wklej tamto co podal amited na sam d?? kodu i sprawd? czy dzia?a. UWAGA: WKLEJ TO PO STRONI CLIENTA
Wysłany: 2017-07-22, 17:56
KilusTv
Wiek: 28 Na forum: 3999 dni Posty: 58
Nick w MP: KilusTv
Piwa : 1
zrobilem no i jak wchodze w marker to wchodzi mi na sluzbe nie pokazujac gui. Zamiast pojawic sie w markerze ze sluzba pojawia sie w markerze z syrena psp. Macie jakis pomysl?
Wysłany: 2017-07-22, 18:04
amited
Wiek: 26 Na forum: 3714 dni Posty: 1233
Nick w MP: Amited
Piwa : 512
tam gdzie masz te przyciski ze sluzba maja byc w innym markerze co dawanie broni
[ Dodano : 2017-07-22, 18:04 ]
i nie wiem po co ci 3 eventy na te same przyciski
Podpis
"amited" napisał/a :
Wysłany: 2017-07-22, 18:08
KilusTv
Wiek: 28 Na forum: 3999 dni Posty: 58
Nick w MP: KilusTv
Piwa : 1
XD nie wiem po co mi tyle eventow. Dopiero zaczynam z tym zabawe. a gdzie mam zmienic zeby te przyciski byly w innym markerze.
Wysłany: 2017-07-22, 18:11
amited
Wiek: 26 Na forum: 3714 dni Posty: 1233
Nick w MP: Amited
Piwa : 512
tu chodzi o to ?e na przycisk DOSTAJESZ elementDat? KT?RA pozwala wzi?? ekwipunek i naliczanie w frakcji, logiczne jest to ?e nie mog? by? w tym samym markerze. Nie wiem gdzie masz ten marker w kt?rym wy?wietla si? gui bo jest on w serverside ale nie z frakcj?.
Podpis
"amited" napisał/a :
Wysłany: 2017-07-22, 18:55
KilusTv
Wiek: 28 Na forum: 3999 dni Posty: 58
Nick w MP: KilusTv
Piwa : 1
zmodyfikowalem kodzik i nawet dziala gdyby nie to ze w sumie kazdy albo nikt nie mowe wejsc na sluzbe. O to kodzik :
C-side
local screenW , screenH = guiGetScreenSize ()
we = guiCreateButton ( 544 , 454 , 143 , 43 , "Wejd? na s?u?b?" , false )
ze = guiCreateButton ( 821 , 455 , 147 , 42 , "Zejd? ze s?u?by" , false )
wy = guiCreateButton ( 684 , 510 , 137 , 33 , "Zamknij" , false )
guiSetProperty ( we , "NormalTextColour" , "FFAAAAAA" )
guiSetVisible ( we , false )
guiSetProperty ( ze , "NormalTextColour" , "FFAAAAAA" )
guiSetVisible ( ze , false )
guiSetProperty ( wy , "NormalTextColour" , "FFAAAAAA" )
guiSetVisible ( wy , false )
addEvent ( "showPlayerGui" , true )
addEventHandler ( "showPlayerGui" , getRootElement (), function()
guiSetVisible ( we , true )
addEventHandler ( "onClientRender" , getRootElement (), drawPanel )
showCursor ( true )
end )
addEvent ( "showPlayerGui" , true )
addEventHandler ( "showPlayerGui" , getRootElement (), function()
guiSetVisible ( ze , true )
addEventHandler ( "onClientRender" , getRootElement (), drawPanel )
showCursor ( true )
end )
addEvent ( "showPlayerGui" , true )
addEventHandler ( "showPlayerGui" , getRootElement (), function()
guiSetVisible ( wy , true )
addEventHandler ( "onClientRender" , getRootElement (), drawPanel )
showCursor ( true )
end )
function drawPanel ()
dxDrawImage ( 320 , 357 , 763 , 288 , ":frakcja-psp/tlofrakcji.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
dxDrawImage ( 424 , 432 , 125 , 113 , ":syrenkapsp/logo2.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
dxDrawText ( "Frakcja Pa?stwowa Stra? Po?arna" , 409 , 379 , 1001 , 422 , tocolor ( 254 , 29 , 29 , 255 ), 1.50 , "pricedown" , "center" , "top" , false , false , false , false , false )
dxDrawText ( "Designed & Created by KilusTv" , 833 , 532 , 986 , 539 , tocolor ( 255 , 255 , 255 , 255 ), 0.90 , "arial" , "left" , "top" , false , false , false , false , false )
end
addEventHandler ( "onClientGUIClick" , we , function()
guiSetVisible ( ze , false )
removeEventHandler ( "onClientRender" , getRootElement (), drawPanel )
showCursor ( false )
end , false )
addEventHandler ( "onClientGUIClick" , we , function()
guiSetVisible ( wy , false )
removeEventHandler ( "onClientRender" , getRootElement (), drawPanel )
showCursor ( false )
end , false )
addEventHandler ( "onClientGUIClick" , wy , function()
guiSetVisible ( wy , false )
removeEventHandler ( "onClientRender" , getRootElement (), drawPanel )
showCursor ( false )
end , false )
addEventHandler ( "onClientGUIClick" , wy , function()
guiSetVisible ( we , false )
removeEventHandler ( "onClientRender" , getRootElement (), drawPanel )
showCursor ( false )
end , false )
addEventHandler ( "onClientGUIClick" , wy , function()
guiSetVisible ( ze , false )
removeEventHandler ( "onClientRender" , getRootElement (), drawPanel )
showCursor ( false )
end , false )
addEventHandler ( "onClientGUIClick" , ze , function()
guiSetVisible ( ze , false )
removeEventHandler ( "onClientRender" , getRootElement (), drawPanel )
showCursor ( false )
end , false )
addEventHandler ( "onClientGUIClick" , ze , function()
guiSetVisible ( we , false )
removeEventHandler ( "onClientRender" , getRootElement (), drawPanel )
showCursor ( false )
end , false )
addEventHandler ( "onClientGUIClick" , ze , function()
guiSetVisible ( wy , false )
removeEventHandler ( "onClientRender" , getRootElement (), drawPanel )
showCursor ( false )
end , false )
addEventHandler ( "onClientGUIClick" , we , function()
setElementData ( localPlayer , "player:duty" , false )
guiSetVisible ( we , false )
removeEventHandler ( "onClientRender" , getRootElement (), drawPanel )
showCursor ( false )
end , false )
addEventHandler ( "onClientGUIClick" , ze , function()
setElementData ( localPlayer , "player:duty" , false )
guiSetVisible ( ze , false )
removeEventHandler ( "onClientRender" , getRootElement (), drawPanel )
showCursor ( false )
end , false )
oraz s-side
function isPlayerInFaction ( plr )
local uid = getElementData ( plr , 'player:uid' )
if not uid then return end
local result = exports [ 'ogrpg-db' ]: dbGet ( 'SELECT 1 FROM ogrpg_factions WHERE code=? AND uid=? LIMIT 1;' , "PSP" , uid )
if result [ 1 ] then
return true
else
return false
end
end
local licz = {}
marker = createMarker ( 1090.60 , 2376.77 , 10 , "cylinder" , 1 , 0 , 0 , 0 , 170 )
addEventHandler ( "onMarkerHit" , marker , function( he )
triggerClientEvent ( he , "showPlayerGui" , he )
if isPlayerInFaction ( el ) then
if getElementData ( he , "player:duty" ) then
setElementModel ( el , 201 )
setPlayerNametagColor ( el , 0 , 0 , 255 )
exports [ 'frakcja' ]: rozpocznijnaliczanie ( el )
setElementData ( el , 'player:duty' , 'PSP' )
local rank = exports [ 'frakcja' ]: getPlayerFactionRank ( el , 'PSP' )
setElementData ( el , "player:rank" , rank )
giveWeapon ( el , 42 , 9999 )
else
exports [ 'frakcja' ]: zatrzymajnaliczanie ( el )
takeWeapon ( el , 42 )
removeElementData ( el , 'player:duty' )
removeElementData ( el , "player:rank" )
local skin = getElementData ( el , "player:skin" )
setElementModel ( el , skin )
end
else
outputChatBox ( 'Nie jeste? pracownikiem frakcji PSP.' , el , 255 , 0 , 0 )
end
function naliczanie ( el )
if isElement ( el ) then
local x = getElementData ( el , "player:workinjob" ) or 0
setElementData ( el , "player:workinjob" , x + 1 )
else
if isTimer ( licz [ el ]) then
killTimer ( licz [ el ])
licz [ el ] = nil
end
end
end
end )
Co powinienem zrobic ?
[ Dodano : 2017-07-22, 18:55 ]
w tym momencie tak jak widzisz nikt nie wejdzie na sluzbe. Wyskoczy gui i jak klikne rozpocznij wyskakuje ze nie jestem w psp
[ Dodano : 2017-07-22, 20:19 ]
To jak panowie? Pomozecie? Naprawde chcialbym to zrobic
Wysłany: 2017-07-22, 23:57
P.Wiśnia
Programista LUA
Wiek: 24 Na forum: 4045 dni Posty: 568
Nick w MP: P.Wiśnia
Piwa : 376
Masz b??d w wchodzenia na s?u?b? jutro jak wejd? na kompa to poprawi?.
Wysłany: 2017-07-23, 10:28
KilusTv
Wiek: 28 Na forum: 3999 dni Posty: 58
Nick w MP: KilusTv
Piwa : 1
Aidis , dzieki bede czekal
Wysłany: 2017-07-23, 11:12
Szymczu
Programista bo tak
Wiek: 27 Na forum: 3435 dni Posty: 194
Nick w MP: Szymczu
Piwa : 36
Troch? zmodyfikowa?em kod. Sprawd?.
C-side
local screenW , screenH = guiGetScreenSize ()
wdw = guiCreateWindow ( 500 , 400 , 350 , 200 , "" , false )
we = guiCreateButton ( 544 , 454 , 143 , 43 , "Wejd? na s?u?b?" , false , wdw )
ze = guiCreateButton ( 821 , 455 , 147 , 42 , "Zejd? ze s?u?by" , false , wdw )
wy = guiCreateButton ( 684 , 510 , 137 , 33 , "Zamknij" , false , wdw )
guiSetVisible ( wdw , false )
guiSetProperty ( we , "NormalTextColour" , "FFAAAAAA" )
guiSetProperty ( ze , "NormalTextColour" , "FFAAAAAA" )
guiSetProperty ( wy , "NormalTextColour" , "FFAAAAAA" )
addEvent ( "showPlayerGui" , true )
addEventHandler ( "showPlayerGui" , getRootElement (), function()
guiSetVisible ( wdw , true )
addEventHandler ( "onClientRender" , getRootElement (), drawPanel )
showCursor ( true )
end )
function drawPanel ()
dxDrawImage ( 320 , 357 , 763 , 288 , ":frakcja-psp/tlofrakcji.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
dxDrawImage ( 424 , 432 , 125 , 113 , ":syrenkapsp/logo2.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
dxDrawText ( "Frakcja Pa?stwowa Stra? Po?arna" , 409 , 379 , 1001 , 422 , tocolor ( 254 , 29 , 29 , 255 ), 1.50 , "pricedown" , "center" , "top" , false , false , false , false , false )
dxDrawText ( "Designed & Created by KilusTv" , 833 , 532 , 986 , 539 , tocolor ( 255 , 255 , 255 , 255 ), 0.90 , "arial" , "left" , "top" , false , false , false , false , false )
end
addEventHandler ( "onClientGUIClick" , root , function()
if source == we then
guiSetVisible ( wdw , false )
removeEventHandler ( "onClientRender" , getRootElement (), drawPanel )
showCursor ( false )
setElementData ( localPlayer , "player:duty" , false )
triggerServerEvent ( "join" , localPlayer )
elseif source == wy then
guiSetVisible ( wdw , false )
removeEventHandler ( "onClientRender" , getRootElement (), drawPanel )
showCursor ( false )
elseif source == ze then
guiSetVisible ( ze , false )
removeEventHandler ( "onClientRender" , getRootElement (), drawPanel )
showCursor ( false )
triggerServerEvent ( "join" , localPlayer )
end
end )
S-side
function isPlayerInFaction ( plr )
local uid = getElementData ( plr , 'player:uid' )
if not uid then return end
local result = exports [ 'ogrpg-db' ]: dbGet ( 'SELECT 1 FROM ogrpg_factions WHERE code=? AND uid=? LIMIT 1;' , "PSP" , uid )
if result [ 1 ] then
return true
else
return false
end
end
local licz = {}
marker = createMarker ( 1090.60 , 2376.77 , 10 , "cylinder" , 1 , 0 , 0 , 0 , 170 )
addEventHandler ( "onMarkerHit" , marker , function( he )
triggerClientEvent ( he , "showPlayerGui" , he )
end )
addEvent ( "join" , true )
addEventHandler ( "join" , getRootElement (), function()
if isPlayerInFaction ( el ) then
if getElementData ( he , "player:duty" ) then
setElementModel ( el , 201 )
setPlayerNametagColor ( el , 0 , 0 , 255 )
exports [ 'frakcja' ]: rozpocznijnaliczanie ( el )
setElementData ( el , 'player:duty' , 'PSP' )
local rank = exports [ 'frakcja' ]: getPlayerFactionRank ( el , 'PSP' )
setElementData ( el , "player:rank" , rank )
giveWeapon ( el , 42 , 9999 )
else
exports [ 'frakcja' ]: zatrzymajnaliczanie ( el )
takeWeapon ( el , 42 )
removeElementData ( el , 'player:duty' )
removeElementData ( el , "player:rank" )
local skin = getElementData ( el , "player:skin" )
setElementModel ( el , skin )
end
else
outputChatBox ( 'Nie jeste? pracownikiem frakcji PSP.' , el , 255 , 0 , 0 )
end
end )
function naliczanie ( el )
if isElement ( el ) then
local x = getElementData ( el , "player:workinjob" ) or 0
setElementData ( el , "player:workinjob" , x + 1 )
else
if isTimer ( licz [ el ]) then
killTimer ( licz [ el ])
licz [ el ] = nil
end
end
end
end )
Ostatnio zmieniony przez Szymczu 2017-07-25, 21:48, w całości zmieniany 3 razy
Wysłany: 2017-07-23, 11:27
KilusTv
Wiek: 28 Na forum: 3999 dni Posty: 58
Nick w MP: KilusTv
Piwa : 1
Szymczu , niestety nie dziala. Wyskakuje tylko jakies okienko wszystkim (to okno wdw). Po jego usunieciu, po wejsciu w marker pokazuje sie moje gui ale zaden guzik nie dziala.
[ Dodano : 2017-07-23, 11:33 ]
w debugcript nic sie nie pokazuje
Wysłany: 2017-07-23, 11:34
Szymczu
Programista bo tak
Wiek: 27 Na forum: 3435 dni Posty: 194
Nick w MP: Szymczu
Piwa : 36
By? ma?y b??d. Przeklej jeszcze raz c-side i zdaj raport
Wysłany: 2017-07-23, 11:37
KilusTv
Wiek: 28 Na forum: 3999 dni Posty: 58
Nick w MP: KilusTv
Piwa : 1
Raport nastepujacy
Po wejsciu w marker wyskakuje moje gui bez zadnych guzikow na nim oraz to okno co dodales. Nic sie nie da zrobic.
[ Dodano : 2017-07-23, 12:18 ]
jakies jeszcze pomysly?
Tagi: gui :: wchodzenie :: sluzbe
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: