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

Wysłany: 2017-08-29, 03:11


Avenged

Młodszy Szkrypter






Wiek: 23
Na forum: 3510 dni
Posty: 654
Nick w MP: Avenged

Piwa: 1570

Respekt: 326,3
Respekt: 326,3Respekt: 326,3Respekt: 326,3

A wi?c po stronie klienta mam takie co?:
addEventHandler("onClientClick"root, function(bs)
  if ~= "state" and ~= "down" then return end
  if mysz(screenW 0.44screenH 0.50screenW 0.12screenH 0.05then
    triggerServerEvent("zaloguj_psp"localPlayer)
  elseif mysz(screenW 0.44screenH 0.58screenW 0.13screenH 0.05then
    triggerServerEvent("wyloguj_psp"localPlayer)
  end
end)


Strona servera:
function zaloguj (source)
local theTeam createTeam PSP )
  if theTeam then                      
    setPlayerTeam sourcePSP)  
end
end
addEvent"zaloguj_psp"true )
addEventHandler"zaloguj_psp"resourceRootzaloguj 


I nie wiem czemu nie zak?ada tego teamu i nie dodaje po klikni?ciu tego przycisku co wyliczy?em pozycj? myszy na ekranie. (DB 3 czyste)

Podpis
LUA, JS, PHP



Zapraszam do skorzystania z moich usług: Klik

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-08-29, 04:17


nanKy







Wiek: 22
Na forum: 3865 dni
Posty: 498
Nick w MP: nanky

Piwa: 1773

Respekt: 239
Respekt: 239Respekt: 239

function zaloguj (source)

zamien na
function zaloguj()


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-08-29, 04:44


Avenged

Młodszy Szkrypter






Wiek: 23
Na forum: 3510 dni
Posty: 654
Nick w MP: Avenged

Piwa: 1570

Respekt: 326,3
Respekt: 326,3Respekt: 326,3Respekt: 326,3

NankY., teraz gdy klikam przycisk to nie dzieje si? nic.

[ Dodano: 2017-08-29, 04:46 ]
Strona Clienta:
local screenWscreenH guiGetScreenSize()
local sxsy guiGetScreenSize()

local p = {}
local panel false

function mysz(psx,psy,pssx,pssy,abx,aby)
    if not isCursorShowing() then return end
    cx,cy=getCursorPosition()
    cx,cy=cx*sx,cy*sy
    if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then
        return true,cx,cy
    else
        return false
    end
end

function guiB()
       dxDrawRectangle(screenW 0.3202screenH 0.3029screenW 0.3595screenH 0.3952tocolor(000103), false)
        dxDrawLine(screenW 0.3202screenH 0.6981screenW 0.6792screenH 0.6981tocolor(255255255255), 3false)
        dxDrawRectangle(screenW 0.4387screenH 0.5848screenW 0.1250screenH 0.0448tocolor(105105105232), false)
        dxDrawRectangle(screenW 0.4387screenH 0.5019screenW 0.1238screenH 0.0467tocolor(105105105232), false)
        dxDrawText("Zaloguj"screenW 0.4774screenH 0.5114screenW 0.5804screenH 0.5390tocolor(255255255255), 1.50"default""left""top"falsefalsefalsefalsefalse)
        dxDrawText("Wyloguj"797624957654tocolor(255255255255), 1.50"default""left""top"falsefalsefalsefalsefalse)
        dxDrawText("Pa?stowa Stra? Po?arna "screenW 0.3310screenH 0.3267screenW 0.6714screenH 0.4019tocolor(21000232), 4.00"default""left""top"falsefalsefalsefalsefalse)
        dxDrawText("Wyloguj"screenW 0.4744screenH 0.5943screenW 0.5696screenH 0.6229tocolor(255255255255), 1.50"default""left""top"falsefalsefalsefalsefalse)
end

addEventHandler("onClientClick"root, function(bs)
  if ~= "state" and ~= "down" then return end
  if mysz(screenW 0.44screenH 0.50screenW 0.12screenH 0.05then
    triggerServerEvent("zaloguj_psp"localPlayer)
  elseif mysz(screenW 0.44screenH 0.58screenW 0.13screenH 0.05then
    triggerServerEvent("wyloguj_psp"localPlayer)
  end
end)

addEvent("open_gui"true)
addEventHandler("open_gui"root, function(t)
    if == "p" then
        addEventHandler("onClientPreRender"rootguiB)
        showCursor(truefalse)
        panel true
    elseif == "s" then
        removeEventHandler("onClientPreRender"rootguiB)
        showCursor(false)
        panel false
    end
end)


Strona servera:
local marker createMarker(1481.60461, -1730.1728513.38281"cylinder"1.05155155155125)

addEventHandler("onMarkerHit"marker, function(hit)
    if getElementType(hit) ~= "player" then return end
    if isPedInVehicle(hitthen return end
    triggerClientEvent(hit"open_gui"hit"p")
end)

addEventHandler("onMarkerLeave"marker, function(hit)
    if getElementType(hit) ~= "player" then return end
    if isPedInVehicle(hitthen return end
    triggerClientEvent(hit"open_gui"hit"s")
end)


function zaloguj()
local theTeam createTeam PSP )
  if theTeam then                      
    setPlayerTeam sourcePSP)  
end
end
addEvent"zaloguj_psp"true )
addEventHandler"zaloguj_psp"resourceRootzaloguj ) 

function wyloguj ()                  
    removePlayerTeam sourcePSP)  
end
addEvent"wyloguj_psp"true )
addEventHandler"wyloguj_psp"resourceRootwyloguj 


Podpis
LUA, JS, PHP



Zapraszam do skorzystania z moich usług: Klik

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-08-29, 11:02


Kalizman







Wiek: 23
Na forum: 3651 dni
Posty: 1394

Piwa: 4619

Respekt: 358,8
Respekt: 358,8Respekt: 358,8Respekt: 358,8Respekt: 358,8


function zaloguj()
local theTeam createTeam PSP )
  if theTeam then                      
    setPlayerTeam sourcePSP)  
end
end
addEvent"zaloguj_psp"true )
addEventHandler"zaloguj_psp"rootzaloguj 


[ Dodano: 2017-08-29, 11:02 ]
A i dodam ?e ?le wype?ni?e? funkcj? createTeam

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-08-29, 13:20


maciek3286

LUA Developer






Wiek: 26
Na forum: 5201 dni
Posty: 230
Nick w MP: maciek00

Piwa: 3207

Respekt: 101,5
Respekt: 101,5

Zamiast source polecam u?ywa? client.

Dlaczego w wylogowaniu deklarujesz resourceRoot? a w zaloguj root? Lepiej jest u?ywa? resourceRoot. Ale wtedy po stronie clienta te? musisz zadeklarowa? resourceRoot w triggerze.

function zaloguj()
local theTeam createTeam("PSP")
   if theTeam then                      
      setPlayerTeam(clienttheTeam)  
   end
end
addEvent"zaloguj_psp"true )
addEventHandler"zaloguj_psp"resourceRootzaloguj


A po 2 gdzie ty w MTA widzia?e? funcje removePlayerTeam?

function wyloguj()                  
   setPlayerTeam(clientnil)  
end
addEvent("wyloguj_psp"true)
addEventHandler("wyloguj_psp"resourceRootwyloguj


A tak powinny wygl?da? triggery:

addEventHandler("onClientClick"root, function(bs)
  if ~= "state" and ~= "down" then return end
  if mysz(screenW 0.44screenH 0.50screenW 0.12screenH 0.05then
    triggerServerEvent("zaloguj_psp"resourceRoot)
  elseif mysz(screenW 0.44screenH 0.58screenW 0.13screenH 0.05then
    triggerServerEvent("wyloguj_psp"resourceRoot)
  end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-08-29, 17:34


Avenged

Młodszy Szkrypter






Wiek: 23
Na forum: 3510 dni
Posty: 654
Nick w MP: Avenged

Piwa: 1570

Respekt: 326,3
Respekt: 326,3Respekt: 326,3Respekt: 326,3

maciek3286, a jak zrobi? ?eby wi?cej ni? jedna osoba mog?a si? zalogowa?. Bo aktualnie jest tak ?e jak jedna osoba kliknie zaloguj to go loguje ale gdy kliknie druga osoba to nic si? nie dzieje.

Podpis
LUA, JS, PHP



Zapraszam do skorzystania z moich usług: Klik

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-08-30, 21:03


maciek3286

LUA Developer






Wiek: 26
Na forum: 5201 dni
Posty: 230
Nick w MP: maciek00

Piwa: 3207

Respekt: 101,5
Respekt: 101,5

Spr?buj tak:

function zaloguj()
if not getTeamFromName("PSP"then
   theTeam createTeam("PSP")
end
   if theTeam then                      
      setPlayerTeam(clientgetTeamFromName("PSP"))  
   end
end
addEvent"zaloguj_psp"true )
addEventHandler"zaloguj_psp"resourceRootzaloguj


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-08-31, 04:09


Avenged

Młodszy Szkrypter






Wiek: 23
Na forum: 3510 dni
Posty: 654
Nick w MP: Avenged

Piwa: 1570

Respekt: 326,3
Respekt: 326,3Respekt: 326,3Respekt: 326,3

maciek3286, Dzi?ki ci bardzo maciek ;)

[ Dodano: 2017-08-31, 04:09 ]
Mo?na @LOCK

Podpis
LUA, JS, PHP



Zapraszam do skorzystania z moich usług: Klik

Postaw piwo autorowi tego posta
 

 
Tagi: triggery :: gui
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