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

Wysłany: 2014-01-30, 23:43


zuraw13







Wiek: 27
Na forum: 5214 dni
Posty: 95
Nick w MP: zuraw113

Piwa: 191

Respekt: 50

Dzi?ki dzia?a. Zrobi?em ca?y kod po stronie klienta,jak i serwera.
Jak teraz doda? gui do tego? Kod gui w pierwszym po?cie.

A i jak doda? opcje teleportacji z pojazdem lub wyskakuj?cy tekst na chacie o wysiadni?ciu z pojazdu? Mo?e to tak by? po stronie serwera:
local vehicle = getPedOccupiedVehicle(playerSource)
function greetingontpls ( posX, posY, posZ, player )
       if vehicle then
    setElementPosition ( player, posX, posY, posZ )
       else
    setElementPosition ( vehicle, posX, posY, posZ )
end
addEvent( "ontpls", true )
addEventHandler( "ontpls", root, greetingontpls )


Kod:
- strona klienta:
local player = getLocalPlayer()

-- POZYCJA LS
local lsposX = 2500.5952
local lsposY = -1669.4454
local lsposZ = 13.3532
-- POZYCJA LV
local lvposX = 2140.8190
local lvposY = 986.2273
local lvposZ = 10.8203
-- POZYCJA SF
local sfposX = -2041.2288
local sfposY = 136.2675
local sfposZ = 28.8359
-- POZYCJA LSLOT
local lslotposX = 1945.4160
local lslotposY = -2305.6423
local lslotposZ = 15.0583
-- POZYCJA SALONSF
local salonsfposX = -1642.9013671875
local salonsfposY = 1203.9830322266
local salonsfposZ = 7.25
-- POZYCJA PUSTYNIA
local pustyniaposX = 428.4866
local pustyniaposY = 2533.7695
local pustyniaposZ = 16.5045
-- POZYCJA WYSPA
local wyspaposX = 776.6111
local wyspaposY = -2834.7358
local wyspaposZ = 4.2433
-- POZYCJA TAMA
local tamaposX = -924.3400
local tamaposY = 2019.7234
local tamaposZ = 60.9141
-- POZYCJA MOLO
local moloposX = 836.2119
local moloposY = -2057.7136
local moloposZ = 12.8671
-- POZYCJA BAGNO
local bagnoposX = -841.3732
local bagnoposY = -1940.7094
local bagnoposZ = 12.5643
-- POZYCJA PORT
local portposX = 2294.0693
local portposY = 558.9081
local portposZ = 7.7813
-- POZYCJA CHILLIAD
local chilliadposX = -2301.9609
local chilliadposY = -1648.8076
local chilliadposZ = 483.6195
-- POZYCJA DRAG
local dragposX = 2041.7806
local dragposY = 856.4257
local dragposZ = 790.5769
-- POZYCJA WYSKOK
local wyskokposX = 2071.7295
local wyskokposY = 284.0156
local wyskokposZ = 403.1366
-- POZYCJA TOR
local torposX = 2160.7292480469
local torposY = -4034.1831054688
local torposZ = 5.2526798248291

--LS
function tpls ( commandName )
        triggerServerEvent ( "texttpls", getRootElement(), "Witamy w Los Santos!", player ) 
        triggerServerEvent ( "ontpls", getRootElement(), lsposX, lsposY, lsposZ, player )
end
addCommandHandler ( "ls", tpls )
--LV
function tplv ( commandName )
        triggerServerEvent ( "texttplv", getRootElement(), "Witamy w Las Venturas!", player ) 
        triggerServerEvent ( "ontplv", getRootElement(), lvposX, lvposY, lvposZ, player )
end
addCommandHandler ( "lv", tplv )
--SF
function tpsf ( commandName )
        triggerServerEvent ( "texttpsf", getRootElement(), "Witamy w San Fierro!", player ) 
        triggerServerEvent ( "ontpsf", getRootElement(), sfposX, sfposY, sfposZ, player )
end
addCommandHandler ( "sf", tpsf )
--LSLOT
function tplslot ( commandName )
        triggerServerEvent ( "texttplslot", getRootElement(), "Witamy na Lotnisku w Los Santos!", player ) 
        triggerServerEvent ( "ontplslot", getRootElement(), lslotposX, lslotposY, lslotposZ, player )
end
addCommandHandler ( "lslot", tplslot )
--SALONSF
function tpsalonsf ( commandName )
        triggerServerEvent ( "texttpsalonsf", getRootElement(), "Witamy przed Salonem w San Fierro!", player ) 
        triggerServerEvent ( "ontpsalonsf", getRootElement(), salonsfposX, salonsfposY, salonsfposZ, player )
end
addCommandHandler ( "salonsf", tpsalonsf )
--PUSTYNIA
function tppustynia ( commandName )
        triggerServerEvent ( "texttppustynia", getRootElement(), "Witamy na Pustyni!", player ) 
        triggerServerEvent ( "ontppustynia", getRootElement(), pustyniaposX, pustyniaposY, pustyniaposZ, player )
end
addCommandHandler ( "pustynia", tppustynia )
--WYSPA
function tpwyspa ( commandName )
        triggerServerEvent ( "texttpwyspa", getRootElement(), "Witamy na Wyspie!", player ) 
        triggerServerEvent ( "ontpwyspa", getRootElement(), wyspaposX, wyspaposY, wyspaposZ, player )
end
addCommandHandler ( "wyspa", tpwyspa )
--TAMA
function tptama ( commandName )
        triggerServerEvent ( "texttptama", getRootElement(), "Witamy na Tamie!", player ) 
        triggerServerEvent ( "ontptama", getRootElement(), tamaposX, tamaposY, tamaposZ, player )
end
addCommandHandler ( "tama", tptama )
--MOLO
function tpmolo ( commandName )
        triggerServerEvent ( "texttpmolo", getRootElement(), "Witamy na Molo!", player ) 
        triggerServerEvent ( "ontpmolo", getRootElement(), moloposX, moloposY, moloposZ, player )
end
addCommandHandler ( "molo", tpmolo )
--BAGNO
function tpbagno ( commandName )
        triggerServerEvent ( "texttpbagno", getRootElement(), "Witamy na Bagnach!", player ) 
        triggerServerEvent ( "ontpbagno", getRootElement(), bagnoposX, bagnoposY, bagnoposZ, player )
end
addCommandHandler ( "bagno", tpbagno )
--PORT
function tpport ( commandName )
        triggerServerEvent ( "texttpport", getRootElement(), "Witamy w Porcie!", player ) 
        triggerServerEvent ( "ontpport", getRootElement(), portposX, portposY, portposZ, player )
end
addCommandHandler ( "port", tpport )
--CHILLIAD
function tpchilliad ( commandName )
        triggerServerEvent ( "texttpchilliad", getRootElement(), "Witamy na G?rze Chilliad!", player ) 
        triggerServerEvent ( "ontpchilliad", getRootElement(), chilliadposX, chilliadposY, chilliadposZ, player )
end
addCommandHandler ( "chilliad", tpchilliad )
addCommandHandler ( "gora", tpchilliad )
--DRAG
function tpdrag ( commandName )
        triggerServerEvent ( "texttpdrag", getRootElement(), "Witamy na Dragu!", player ) 
        triggerServerEvent ( "ontpdrag", getRootElement(), dragposX, dragposY, dragposZ, player )
end
addCommandHandler ( "drag", tpdrag )
--WYSKOK
function tpwyskok ( commandName )
        triggerServerEvent ( "texttpwyskok", getRootElement(), "Witamy na Wyskoku!", player ) 
        triggerServerEvent ( "ontpwyskok", getRootElement(), wyskokposX, wyskokposY, wyskokposZ, player )
end
addCommandHandler ( "wyskok", tpwyskok )
--TOR
function tptor ( commandName )
        triggerServerEvent ( "texttptor", getRootElement(), "Witamy na Torze!", player ) 
        triggerServerEvent ( "ontptor", getRootElement(), torposX, torposY, torposZ, player )
end
addCommandHandler ( "tor", tptor )


- strona serwera:
--LS
function greetingtextls ( message, player )
    outputChatBox ( message, player )
end
addEvent( "texttpls", true )
addEventHandler( "texttpls", root, greetingtextls )

function greetingontpls ( posX, posY, posZ, player )
    setElementPosition ( player, posX, posY, posZ )
end
addEvent( "ontpls", true )
addEventHandler( "ontpls", root, greetingontpls )
--LV
function greetingtextlv ( message, player )
    outputChatBox ( message, player )
end
addEvent( "texttplv", true )
addEventHandler( "texttplv", root, greetingtextlv )

function greetingontplv ( posX, posY, posZ, player )
    setElementPosition ( player, posX, posY, posZ )
end
addEvent( "ontplv", true )
addEventHandler( "ontplv", root, greetingontplv )
--SF
function greetingtextsf ( message, player )
    outputChatBox ( message, player )
end
addEvent( "texttpsf", true )
addEventHandler( "texttpsf", root, greetingtextsf )

function greetingontpsf ( posX, posY, posZ, player )
    setElementPosition ( player, posX, posY, posZ )
end
addEvent( "ontpsf", true )
addEventHandler( "ontpsf", root, greetingontpsf )    
--LSLOT 
function greetingtextlslot ( message, player )
    outputChatBox ( message, player )
end
addEvent( "texttplslot", true )
addEventHandler( "texttplslot", root, greetingtextlslot )

function greetingontplslot ( posX, posY, posZ, player )
    setElementPosition ( player, posX, posY, posZ )
end
addEvent( "ontplslot", true )
addEventHandler( "ontplslot", root, greetingontplslot )    
--SALONSF
function greetingtextsalonsf ( message, player )
    outputChatBox ( message, player )
end
addEvent( "texttpsalonsf", true )
addEventHandler( "texttpsalonsf", root, greetingtextsalonsf )

function greetingontpsalonsf ( posX, posY, posZ, player )
    setElementPosition ( player, posX, posY, posZ )
end
addEvent( "ontpsalonsf", true )
addEventHandler( "ontpsalonsf", root, greetingontpsalonsf )    
--PUSTYNIA 
function greetingtextpustynia ( message, player )
    outputChatBox ( message, player )
end
addEvent( "texttppustynia", true )
addEventHandler( "texttppustynia", root, greetingtextpustynia )

function greetingontppustynia ( posX, posY, posZ, player )
    setElementPosition ( player, posX, posY, posZ )
end
addEvent( "ontppustynia", true )
addEventHandler( "ontppustynia", root, greetingontppustynia )    
--WYSPA
function greetingtextwyspa ( message, player )
    outputChatBox ( message, player )
end
addEvent( "texttpwyspa", true )
addEventHandler( "texttpwyspa", root, greetingtextwyspa )

function greetingontpwyspa ( posX, posY, posZ, player )
    setElementPosition ( player, posX, posY, posZ )
end
addEvent( "ontpwyspa", true )
addEventHandler( "ontpwyspa", root, greetingontpwyspa )    
--TAMA
function greetingtexttama ( message, player )
    outputChatBox ( message, player )
end
addEvent( "texttptama", true )
addEventHandler( "texttptama", root, greetingtexttama )

function greetingontptama ( posX, posY, posZ, player )
    setElementPosition ( player, posX, posY, posZ )
end
addEvent( "ontptama", true )
addEventHandler( "ontptama", root, greetingontptama )
--MOLO
function greetingtextmolo ( message, player )
    outputChatBox ( message, player )
end
addEvent( "texttpmolo", true )
addEventHandler( "texttpmolo", root, greetingtextmolo )

function greetingontpmolo ( posX, posY, posZ, player )
    setElementPosition ( player, posX, posY, posZ )
end
addEvent( "ontpmolo", true )
addEventHandler( "ontpmolo", root, greetingontpmolo )
--BAGNO
function greetingtextbagno ( message, player )
    outputChatBox ( message, player )
end
addEvent( "texttpbagno", true )
addEventHandler( "texttpbagno", root, greetingtextbagno )

function greetingontpbagno ( posX, posY, posZ, player )
    setElementPosition ( player, posX, posY, posZ )
end
addEvent( "ontpbagno", true )
addEventHandler( "ontpbagno", root, greetingontpbagno )
--PORT
function greetingtextport ( message, player )
    outputChatBox ( message, player )
end
addEvent( "texttpport", true )
addEventHandler( "texttpport", root, greetingtextport )

function greetingontpport ( posX, posY, posZ, player )
    setElementPosition ( player, posX, posY, posZ )
end
addEvent( "ontpport", true )
addEventHandler( "ontpport", root, greetingontpport )
--CHILLIAD
function greetingtextchilliad ( message, player )
    outputChatBox ( message, player )
end
addEvent( "texttpchilliad", true )
addEventHandler( "texttpchilliad", root, greetingtextchilliad )

function greetingontpchilliad ( posX, posY, posZ, player )
    setElementPosition ( player, posX, posY, posZ )
end
addEvent( "ontpchilliad", true )
addEventHandler( "ontpchilliad", root, greetingontpchilliad )
--DRAG
function greetingtextdrag ( message, player )
    outputChatBox ( message, player )
end
addEvent( "texttpdrag", true )
addEventHandler( "texttpdrag", root, greetingtextdrag )

function greetingontpdrag ( posX, posY, posZ, player )
    setElementPosition ( player, posX, posY, posZ )
end
addEvent( "ontpdrag", true )
addEventHandler( "ontpdrag", root, greetingontpdrag )
--WYSKOK
function greetingtextwyskok ( message, player )
    outputChatBox ( message, player )
end
addEvent( "texttpwyskok", true )
addEventHandler( "texttpwyskok", root, greetingtextwyskok )

function greetingontpwyskok ( posX, posY, posZ, player )
    setElementPosition ( player, posX, posY, posZ )
end
addEvent( "ontpwyskok", true )
addEventHandler( "ontpwyskok", root, greetingontpwyskok )
--TOR
function greetingtexttor ( message, player )
    outputChatBox ( message, player )
end
addEvent( "texttptor", true )
addEventHandler( "texttptor", root, greetingtexttor )

function greetingontptor ( posX, posY, posZ, player )
    setElementPosition ( player, posX, posY, posZ )
end
addEvent( "ontptor", true )
addEventHandler( "ontptor", root, greetingontptor )


Podpis
Moje skrypty i mapy:
-Baza by Zuraw [SAMP]
-RC Vehicles enter by Zuraw [SAMP]
-Neony by zuraw [SAMP]
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-01-31, 10:01


luki123luki123

Place Game






Wiek: 28
Na forum: 5416 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6103

Respekt: 611
Respekt: 611Respekt: 611

Zrobi?em ci ten skrypt Kod :
Klient:
local player = getLocalPlayer()


tabela = {
{ 2500.5952, -1669.4454, 13.3532, "Witamy w Los Santos!" }, -- Teleport LS
{ 2140.8190, 986.2273, 10.8203, "Witamy w Las Venturas!" }, -- Teleport LV
{ -2041.2288, 136.2675, 28.8359 "Witamy w San Fierro!" }, -- Teleport SF
{ 1945.4160, -2305.6423, 15.0583, "Witamy na Lotnisku w Los Santos!" }, -- Teleport LS LOT
{ -1642.9013671875, 1203.9830322266, 7.25, "Witamy przed Salonem w San Fierro!" }, -- Teleport SF Salon
{ 428.4866, 2533.7695, 16.5045, "Witamy na Pustyni!" }, -- Pustynia
{ 776.6111, -2834.7358, 4.2433, "Witamy na Wyspie!" }, -- Wyspa
{ -924.3400, 2019.7234, 60.9141, "Witamy na Tamie!" }, -- Tama
{ 836.2119, -2057.7136, 12.8671, "Witamy na Molo!"}, -- Molo
{ -841.3732, -1940.7094, 12.5643, "Witamy na Bagnach!" }, -- Bagno
{ 2294.0693, 558.9081, 7.7813, "Witamy w Porcie!" }, -- Port
{ -2301.9609, -1648.8076, 483.6195, "Witamy na G?rze Chilliad!" }, -- G?ra  CHILLIAD
{ 2041.7806, 856.4257, 790.5769, "Witamy na Dragu!" }, -- Drag
{ 2071.7295, 284.0156, 403.1366, "Witamy na Wyskoku!" }, -- Wyskok
{ 2160.729469, -4034.18310, 5.2526798, "Witamy na Torze!" } -- Tor
}

GUIEditor = {
    gridlist = {},
    window = {},
    button = {}
}

        GUIEditor.window[1] = guiCreateWindow(0.02, 0.20, 0.26, 0.53, "System Teleportow", true)
        guiWindowSetSizable(GUIEditor.window[1], false)
        guiSetVisible(GUIEditor.window[1], false)

        GUIEditor.button[1] = guiCreateButton(0.37, 0.91, 0.26, 0.06, "Exit", true, GUIEditor.window[1])
        guiSetFont(GUIEditor.button[1], "clear-normal")
        guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA")
        GUIEditor.gridlist[1] = guiCreateGridList(0.05, 0.05, 0.89, 0.84, true, GUIEditor.window[1])
        local Kolumna1 = guiGridListAddColumn(GUIEditor.gridlist[2],"X",0.5)
        local Kolumna2 = guiGridListAddColumn(GUIEditor.gridlist[2],"Y",0.5)
        local Kolumna3 = guiGridListAddColumn(GUIEditor.gridlist[2],"Z",0.5)
        local Kolumna4 = guiGridListAddColumn(GUIEditor.gridlist[2],"Wiadomosc",0.5)
        guiSetAlpha(GUIEditor.gridlist[1], 0.80)    

function open ()
if guiGetVisible(GUIEditor.window[1]) == false then -- Patrzenie czy okno jest zamki?te
    guiGridListClear(GUIEditor.gridlist[1]) -- Od?wie?anie Listy
    showCursor(true) -- w?aczanie Kursora
    guiSetVisible(GUIEditor.window[1], true) -- pokazywanie okna gui
        for i=1,#tabela do -- Tworzenie p?tli
        xxD = tabela[i][1] -- pobieranie argumentu tabeli x
        yxD = tabela[i][2] -- pobieranie argumentu tabeli y
        zxD = tabela[i][3] -- pobieranie argumentu tabeli z
        wxD = tabela[i][4] -- pobieranie argumentu tabeli wiadomosci
        local row = guiGridListAddRow(GUIEditor.gridlist[1]) -- Tworzenie row listy
        guiGridListSetItemText(GUIEditor.gridlist[1], row, Kolumna1, xxD, false, false) -- Dodawanie do listy pozycji x
        guiGridListSetItemText(GUIEditor.gridlist[1], row, Kolumna2, yxD, false, false) -- Dodawanie do listy pozycji y
        guiGridListSetItemText(GUIEditor.gridlist[1], row, Kolumna3, zxD, false, false) -- Dodawanie do listy pozycji z
        guiGridListSetItemText(GUIEditor.gridlist[1], row, Kolumna4, wxD, false, false) -- Dodawanie do listy wiadomosc
        end
end
end

function klik ()
if (source == PodajButton) then -- spawdza czy klik??es na button.
local x = guiGridListGetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), Kolumna1) -- pobieranie pozycji x    
local y = guiGridListGetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), Kolumna2) -- pobieranie pozycji y    
local z = guiGridListGetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), Kolumna3) -- pobieranie pozycji z
local w = guiGridListGetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), Kolumna4) -- pobieranie wiadomosci     
triggerServerEvent("Teleport", getRootElement(), x, y, z, w, player) -- Tworzenie Tigger na strone Serwer
end
end
addEventHandler("onClientGUIClick", PodajButton, wylaczpanelurzadu, false) -- Tworzenie Eventu

function oknoclose ()
if (source == GUIEditor.button[1]) then -- spawdza czy klik??es na button.
showCursor(false) -- w?aczanie Kursora
guiSetVisible(GUIEditor.window[1], false) -- Zamykanie Okna
end
end
addEventHandler("onClientGUIClick", GUIEditor.button[1], oknoclose, false)


Serwer:
function Teleport_S (x, y, z, w, player)
setElementPosition(player, x, y, z )
outputChatBox( w, player, 255, 255, 0)
end
addEvent("Teleport", true)
addEventHandler("Teleport", getRootElement(), podawajdane2wlacielaTeleport_S )


Trzeba dorobic jeszcze 1 button w tym gui i jego nazwe w odpowiednim miejscu w kodzie gdzie jest nazwa "PodajButton"

Pomog?em ci Podstaw piwko, Zapraszam do mojego Poradnika Xml link w podpisie

PS: jak jest xxD = tabela[i][1] to usun z [i] te :1 i poniezej w kodzie :2,:3,:4

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-01-31, 16:10


zuraw13







Wiek: 27
Na forum: 5214 dni
Posty: 95
Nick w MP: zuraw113

Piwa: 191

Respekt: 50

Pr?bowa?em wstawi? bindkey,bo nie by?o w kodzie ?adnej komendy, a ja wole bindkey, ale jak wstawia?em to si? nie otwiera?o gui.
bindKey('F2', 'down', open)


- Klient z dodanym tym drugim buttonie:
local player = getLocalPlayer()


tabela = {
{ 2500.5952, -1669.4454, 13.3532, "Witamy w Los Santos!" }, -- Teleport LS
{ 2140.8190, 986.2273, 10.8203, "Witamy w Las Venturas!" }, -- Teleport LV
{ -2041.2288, 136.2675, 28.8359 "Witamy w San Fierro!" }, -- Teleport SF
{ 1945.4160, -2305.6423, 15.0583, "Witamy na Lotnisku w Los Santos!" }, -- Teleport LS LOT
{ -1642.9013671875, 1203.9830322266, 7.25, "Witamy przed Salonem w San Fierro!" }, -- Teleport SF Salon
{ 428.4866, 2533.7695, 16.5045, "Witamy na Pustyni!" }, -- Pustynia
{ 776.6111, -2834.7358, 4.2433, "Witamy na Wyspie!" }, -- Wyspa
{ -924.3400, 2019.7234, 60.9141, "Witamy na Tamie!" }, -- Tama
{ 836.2119, -2057.7136, 12.8671, "Witamy na Molo!"}, -- Molo
{ -841.3732, -1940.7094, 12.5643, "Witamy na Bagnach!" }, -- Bagno
{ 2294.0693, 558.9081, 7.7813, "Witamy w Porcie!" }, -- Port
{ -2301.9609, -1648.8076, 483.6195, "Witamy na G?rze Chilliad!" }, -- G?ra  CHILLIAD
{ 2041.7806, 856.4257, 790.5769, "Witamy na Dragu!" }, -- Drag
{ 2071.7295, 284.0156, 403.1366, "Witamy na Wyskoku!" }, -- Wyskok
{ 2160.729469, -4034.18310, 5.2526798, "Witamy na Torze!" } -- Tor
}

GUIEditor = {
    gridlist = {},
    window = {},
    button = {}
}

        GUIEditor.window[1] = guiCreateWindow(0.02, 0.20, 0.26, 0.53, "System Teleportow", true)
        guiWindowSetSizable(GUIEditor.window[1], false)
        guiSetVisible(GUIEditor.window[1], false)

        GUIEditor.button[1] = guiCreateButton(0.37, 0.91, 0.26, 0.06, "Exit", true, GUIEditor.window[1])
        guiSetFont(GUIEditor.button[1], "clear-normal")
        guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA")
        GUIEditor.button[2] = guiCreateButton(10, 230, 60, 14, "Teleport", false, GUIEditor.window[1])
        guiSetFont(GUIEditor.button[2], "clear-normal")
        guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFAAAAAA")   
        GUIEditor.gridlist[1] = guiCreateGridList(0.05, 0.05, 0.89, 0.84, true, GUIEditor.window[1])
        local Kolumna1 = guiGridListAddColumn(GUIEditor.gridlist[2],"X",0.5)
        local Kolumna2 = guiGridListAddColumn(GUIEditor.gridlist[2],"Y",0.5)
        local Kolumna3 = guiGridListAddColumn(GUIEditor.gridlist[2],"Z",0.5)
        local Kolumna4 = guiGridListAddColumn(GUIEditor.gridlist[2],"Wiadomosc",0.5)
        guiSetAlpha(GUIEditor.gridlist[1], 0.80)

function open ()        
if guiGetVisible(GUIEditor.window[1]) == false then -- Patrzenie czy okno jest zamki?te
    guiGridListClear(GUIEditor.gridlist[1]) -- Od?wie?anie Listy
    showCursor(true) -- w?aczanie Kursora
    guiSetVisible(GUIEditor.window[1], true) -- pokazywanie okna gui
        for i=1,#tabela do -- Tworzenie p?tli
        xxD = tabela[i][1] -- pobieranie argumentu tabeli x
        yxD = tabela[i][2] -- pobieranie argumentu tabeli y
        zxD = tabela[i][3] -- pobieranie argumentu tabeli z
        wxD = tabela[i][4] -- pobieranie argumentu tabeli wiadomosci
        local row = guiGridListAddRow(GUIEditor.gridlist[1]) -- Tworzenie row listy
        guiGridListSetItemText(GUIEditor.gridlist[1], row, Kolumna1, xxD, false, false) -- Dodawanie do listy pozycji x
        guiGridListSetItemText(GUIEditor.gridlist[1], row, Kolumna2, yxD, false, false) -- Dodawanie do listy pozycji y
        guiGridListSetItemText(GUIEditor.gridlist[1], row, Kolumna3, zxD, false, false) -- Dodawanie do listy pozycji z
        guiGridListSetItemText(GUIEditor.gridlist[1], row, Kolumna4, wxD, false, false) -- Dodawanie do listy wiadomosc
        end
end
end

function klik ()
if (source == GUIEditor.button[2]) then -- spawdza czy klik??es na button.
local x = guiGridListGetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), Kolumna1) -- pobieranie pozycji x    
local y = guiGridListGetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), Kolumna2) -- pobieranie pozycji y    
local z = guiGridListGetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), Kolumna3) -- pobieranie pozycji z
local w = guiGridListGetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), Kolumna4) -- pobieranie wiadomosci     
triggerServerEvent("Teleport", getRootElement(), x, y, z, w, player) -- Tworzenie Tigger na strone Serwer
end
end
addEventHandler("onClientGUIClick", GUIEditor.button[2], wylaczpanelurzadu, false) -- Tworzenie Eventu

function oknoclose ()
if (source == GUIEditor.button[1]) then -- spawdza czy klik??es na button.
showCursor(false) -- w?aczanie Kursora
guiSetVisible(GUIEditor.window[1], false) -- Zamykanie Okna
end
end
addEventHandler("onClientGUIClick", GUIEditor.button[1], oknoclose, false)


-Serwer:
function Teleport_S (x, y, z, w, player)
setElementPosition(player, x, y, z )
outputChatBox( w, player, 255, 255, 0)
end
addEvent("Teleport", true)
addEventHandler("Teleport", getRootElement(), Teleport_S )


Kod z gui editor:
GUIEditor = {
    gridlist = {},
    window = {},
    button = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
    function()
        GUIEditor.window[1] = guiCreateWindow(0.02, 0.20, 0.26, 0.53, "System Teleportow", true)
        guiWindowSetSizable(GUIEditor.window[1], false)

        GUIEditor.button[1] = guiCreateButton(0.55, 0.91, 0.39, 0.06, "Exit", true, GUIEditor.window[1])
        guiSetFont(GUIEditor.button[1], "clear-normal")
        guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA")
        GUIEditor.gridlist[1] = guiCreateGridList(0.05, 0.05, 0.89, 0.84, true, GUIEditor.window[1])
        guiGridListAddColumn(GUIEditor.gridlist[1], "Teleporty", 0.9)
        guiGridListAddRow(GUIEditor.gridlist[1])
        guiGridListSetItemText(GUIEditor.gridlist[1], 0, 1, "-", false, false)
        guiSetAlpha(GUIEditor.gridlist[1], 0.80)
        GUIEditor.button[2] = guiCreateButton(10, 230, 60, 14, "Teleport", false, GUIEditor.window[1])
        guiSetFont(GUIEditor.button[2], "clear-normal")
        guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFAAAAAA")    
    end
)


Podpis
Moje skrypty i mapy:
-Baza by Zuraw [SAMP]
-RC Vehicles enter by Zuraw [SAMP]
-Neony by zuraw [SAMP]
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-01-31, 19:35


luki123luki123

Place Game






Wiek: 28
Na forum: 5416 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6103

Respekt: 611
Respekt: 611Respekt: 611

local player = getLocalPlayer()


tabela = {
{ 2500.5952, -1669.4454, 13.3532, "Witamy w Los Santos!" }, -- Teleport LS
{ 2140.8190, 986.2273, 10.8203, "Witamy w Las Venturas!" }, -- Teleport LV
{ -2041.2288, 136.2675, 28.8359 "Witamy w San Fierro!" }, -- Teleport SF
{ 1945.4160, -2305.6423, 15.0583, "Witamy na Lotnisku w Los Santos!" }, -- Teleport LS LOT
{ -1642.9013671875, 1203.9830322266, 7.25, "Witamy przed Salonem w San Fierro!" }, -- Teleport SF Salon
{ 428.4866, 2533.7695, 16.5045, "Witamy na Pustyni!" }, -- Pustynia
{ 776.6111, -2834.7358, 4.2433, "Witamy na Wyspie!" }, -- Wyspa
{ -924.3400, 2019.7234, 60.9141, "Witamy na Tamie!" }, -- Tama
{ 836.2119, -2057.7136, 12.8671, "Witamy na Molo!"}, -- Molo
{ -841.3732, -1940.7094, 12.5643, "Witamy na Bagnach!" }, -- Bagno
{ 2294.0693, 558.9081, 7.7813, "Witamy w Porcie!" }, -- Port
{ -2301.9609, -1648.8076, 483.6195, "Witamy na G?rze Chilliad!" }, -- G?ra  CHILLIAD
{ 2041.7806, 856.4257, 790.5769, "Witamy na Dragu!" }, -- Drag
{ 2071.7295, 284.0156, 403.1366, "Witamy na Wyskoku!" }, -- Wyskok
{ 2160.729469, -4034.18310, 5.2526798, "Witamy na Torze!" } -- Tor
}

GUIEditor = {
    gridlist = {},
    window = {},
    button = {}
}

        GUIEditor.window[1] = guiCreateWindow(0.02, 0.20, 0.26, 0.53, "System Teleportow", true)
        guiWindowSetSizable(GUIEditor.window[1], false)
        guiSetVisible(GUIEditor.window[1], false)

        GUIEditor.button[1] = guiCreateButton(0.37, 0.91, 0.26, 0.06, "Exit", true, GUIEditor.window[1])
        guiSetFont(GUIEditor.button[1], "clear-normal")
        guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA")
        GUIEditor.button[2] = guiCreateButton(10, 230, 60, 14, "Teleport", false, GUIEditor.window[1])
        guiSetFont(GUIEditor.button[2], "clear-normal")
        guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFAAAAAA")   
        GUIEditor.gridlist[1] = guiCreateGridList(0.05, 0.05, 0.89, 0.84, true, GUIEditor.window[1])
        local Kolumna1 = guiGridListAddColumn(GUIEditor.gridlist[2],"X",0.5)
        local Kolumna2 = guiGridListAddColumn(GUIEditor.gridlist[2],"Y",0.5)
        local Kolumna3 = guiGridListAddColumn(GUIEditor.gridlist[2],"Z",0.5)
        local Kolumna4 = guiGridListAddColumn(GUIEditor.gridlist[2],"Wiadomosc",0.5)
        guiSetAlpha(GUIEditor.gridlist[1], 0.80)

function open ()        
if guiGetVisible(GUIEditor.window[1]) == false then -- Patrzenie czy okno jest zamki?te
    guiGridListClear(GUIEditor.gridlist[1]) -- Od?wie?anie Listy
    showCursor(true) -- w?aczanie Kursora
    guiSetVisible(GUIEditor.window[1], true) -- pokazywanie okna gui
        for i=1,#tabela do -- Tworzenie p?tli
        xxD = tabela[i][1] -- pobieranie argumentu tabeli x
        yxD = tabela[i][2] -- pobieranie argumentu tabeli y
        zxD = tabela[i][3] -- pobieranie argumentu tabeli z
        wxD = tabela[i][4] -- pobieranie argumentu tabeli wiadomosci
        local row = guiGridListAddRow(GUIEditor.gridlist[1]) -- Tworzenie row listy
        guiGridListSetItemText(GUIEditor.gridlist[1], row, Kolumna1, xxD, false, false) -- Dodawanie do listy pozycji x
        guiGridListSetItemText(GUIEditor.gridlist[1], row, Kolumna2, yxD, false, false) -- Dodawanie do listy pozycji y
        guiGridListSetItemText(GUIEditor.gridlist[1], row, Kolumna3, zxD, false, false) -- Dodawanie do listy pozycji z
        guiGridListSetItemText(GUIEditor.gridlist[1], row, Kolumna4, wxD, false, false) -- Dodawanie do listy wiadomosc
        end
end
end
bindKey("F2", "down", open )

function klik ()
if (source == GUIEditor.button[2]) then -- spawdza czy klik??es na button.
local x = guiGridListGetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), Kolumna1) -- pobieranie pozycji x    
local y = guiGridListGetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), Kolumna2) -- pobieranie pozycji y    
local z = guiGridListGetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), Kolumna3) -- pobieranie pozycji z
local w = guiGridListGetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), Kolumna4) -- pobieranie wiadomosci     
triggerServerEvent("Teleport", getRootElement(), x, y, z, w, player) -- Tworzenie Tigger na strone Serwer
end
end
addEventHandler("onClientGUIClick", GUIEditor.button[2], wylaczpanelurzadu, false) -- Tworzenie Eventu

function oknoclose ()
if (source == GUIEditor.button[1]) then -- spawdza czy klik??es na button.
showCursor(false) -- w?aczanie Kursora
guiSetVisible(GUIEditor.window[1], false) -- Zamykanie Okna
end
end
addEventHandler("onClientGUIClick", GUIEditor.button[1], oknoclose, false)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-01-31, 20:58


zuraw13







Wiek: 27
Na forum: 5214 dni
Posty: 95
Nick w MP: zuraw113

Piwa: 191

Respekt: 50

Jak klikam teleport, to nie teleportuje i nie wypisuje wiadomo?ci.

Da?o by si? zrobi? tak, aby w gui by?a tylko nazwa, a dzi?ki niej po klikni?ciu teleport pobiera pozycje i wiadomo??.

Kod:
local player = getLocalPlayer()

tabela = {
{ 2500.5952, -1669.4454, 13.3532, "Witamy w Los Santos!", "Los Santos" }, -- Teleport LS
{ 2140.8190, 986.2273, 10.8203, "Witamy w Las Venturas!", "Las Venturas" }, -- Teleport LV
{ -2041.2288, 136.2675, 28.8359, "Witamy w San Fierro!", "San Fierro" }, -- Teleport SF
{ 1945.4160, -2305.6423, 15.0583, "Witamy na Lotnisku w Los Santos!", "Lotnisko w Los Santos" }, -- Teleport LS LOT
{ -1642.9013671875, 1203.9830322266, 7.25, "Witamy przed Salonem w San Fierro!", "Salon w San Fierro" }, -- Teleport SF Salon
{ 428.4866, 2533.7695, 16.5045, "Witamy na Pustyni!", "Pustynia" }, -- Pustynia
{ 776.6111, -2834.7358, 4.2433, "Witamy na Wyspie!", "Wyspa" }, -- Wyspa
{ -924.3400, 2019.7234, 60.9141, "Witamy na Tamie!", "Tama" }, -- Tama
{ 836.2119, -2057.7136, 12.8671, "Witamy na Molo!", "Molo" }, -- Molo
{ -841.3732, -1940.7094, 12.5643, "Witamy na Bagnach!", "Bagna" }, -- Bagno
{ 2294.0693, 558.9081, 7.7813, "Witamy w Porcie!", "Port" }, -- Port
{ -2301.9609, -1648.8076, 483.6195, "Witamy na G?rze Chilliad!", "G?ra  Chilliad" }, -- G?ra  CHILLIAD
{ 2041.7806, 856.4257, 790.5769, "Witamy na Dragu!", "Drag" }, -- Drag
{ 2071.7295, 284.0156, 403.1366, "Witamy na Wyskoku!", "Wyskok" }, -- Wyskok
{ 2160.729469, -4034.18310, 5.2526798, "Witamy na Torze!", "Tor" } -- Tor
}

GUIEditor = {
    gridlist = {},
    window = {},
    button = {}
}

        GUIEditor.window[1] = guiCreateWindow(0.02, 0.20, 0.26, 0.53, "System Teleportow", true)
        guiWindowSetSizable(GUIEditor.window[1], false)
        guiSetVisible(GUIEditor.window[1], false)

        GUIEditor.button[1] = guiCreateButton(0.60, 0.91, 0.39, 0.06, "Exit", true, GUIEditor.window[1])
        guiSetFont(GUIEditor.button[1], "clear-normal")
        guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA")
        GUIEditor.button[2] = guiCreateButton(0.05, 0.91, 0.39, 0.06, "Teleport", true, GUIEditor.window[1])
        guiSetFont(GUIEditor.button[2], "clear-normal")
        guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFAAAAAA")   
        GUIEditor.gridlist[1] = guiCreateGridList(0.05, 0.05, 0.89, 0.84, true, GUIEditor.window[1])
        local Kolumna = guiGridListAddColumn(GUIEditor.gridlist[1],"Miejsce teleportacji",0.5)
        guiSetAlpha(GUIEditor.gridlist[1], 0.80)

function open ()        
if guiGetVisible(GUIEditor.window[1]) == false then -- Patrzenie czy okno jest zamki?te
    guiGridListClear(GUIEditor.gridlist[1]) -- Od?wie?anie Listy
    showCursor(true) -- w?aczanie Kursora
    guiSetVisible(GUIEditor.window[1], true) -- pokazywanie okna gui
        for i=1,#tabela do -- Tworzenie p?tli
        xxD = tabela[i][1] -- pobieranie argumentu tabeli x
        yxD = tabela[i][2] -- pobieranie argumentu tabeli y
        zxD = tabela[i][3] -- pobieranie argumentu tabeli z
        wxD = tabela[i][4] -- pobieranie argumentu tabeli wiadomosci
        nxD = tabela[i][5] -- pobieranie nazwy miejsca
        local row = guiGridListAddRow(GUIEditor.gridlist[1]) -- Tworzenie row listy
        guiGridListSetItemText(GUIEditor.gridlist[1], row, Kolumna, nxD, false, false) -- Dodawanie do listy nazw
        end
end
end
bindKey("F2", "down", open )

function klik ()
if (source == GUIEditor.button[2]) then -- spawdza czy klik??es na button.
local x = guiGridListGetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), Kolumna1) -- pobieranie pozycji x    
local y = guiGridListGetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), Kolumna2) -- pobieranie pozycji y    
local z = guiGridListGetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), Kolumna3) -- pobieranie pozycji z
local w = guiGridListGetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), Kolumna4) -- pobieranie wiadomosci  

triggerServerEvent("Teleport", getRootElement(), x, y, z, w, player) -- Tworzenie Tigger na strone Serwer
end
end
addEventHandler("onClientGUIClick", GUIEditor.button[2], wylaczpanelurzadu, false) -- Tworzenie Eventu

function oknoclose ()
if (source == GUIEditor.button[1]) then -- spawdza czy klik??es na button.
showCursor(false) -- w?aczanie Kursora
guiSetVisible(GUIEditor.window[1], false) -- Zamykanie Okna
end
end
addEventHandler("onClientGUIClick", GUIEditor.button[1], oknoclose, false)



Jakby co zrobi?em plik xml:
Kod:

<root>
<name="Los Santos" x="2500.5952" y="-1669.4454" z="13.3532" w="Witamy w Los Santos!"/>
<name="Las Venturas" x="2140.8190" y="986.2273" z="10.8203" w="Witamy w Las Venturas!"/>
<name="San Fierro" x="-2041.2288" y="136.2675" z="28.8359" w="Witamy w San Fierro!"/>
<name="Lotnisko w Los Santos" x="1945.4160" y="-2305.6423" z="15.0583" w="Witamy na Lotnisku w Los Santos!"/>
<name="Salon w San Fierro" x="-1642.9013671875" y="1203.9830322266" z="7.25" w="Witamy przed Salonem w San Fierro!"/>
<name="Pustynia" x="428.4866" y="2533.7695" z="16.5045" w="Witamy na Pustyni!"/>
<name="Wyspa" x="776.6111" y="-2834.7358" z="4.2433" w="Witamy na Wyspie!"/>
<name="Tama" x="-924.3400" y="2019.7234" z="60.9141" w="Witamy na Tamie!"/>
<name="Molo" x="836.2119" y="-2057.7136" z="12.8671" w="Witamy na Molo!"/>
<name="Bagna" x="-841.3732" y="-1940.7094" z="12.5643" w="Witamy na Bagnach!"/>
<name="Port" x="2294.0693" y="558.9081" z="7.7813" w="Witamy w Porcie!"/>
<name="G?ra Chilliad" x="-2301.9609" y="-1648.8076" z="483.6195" w="Witamy na G?rze Chilliad!"/>
<name="Drag" x="2041.7806" y="856.4257" z="790.5769" w="Witamy na Dragu!"/>
<name="Wyskok" x="2071.7295" y="284.0156" z="403.1366" w="Witamy na Wyskoku!"/>
<name="Tor" x="2160.729469" y="-4034.18310" z="5.2526798" w="Witamy na Torze!"/>
</root>


Podpis
Moje skrypty i mapy:
-Baza by Zuraw [SAMP]
-RC Vehicles enter by Zuraw [SAMP]
-Neony by zuraw [SAMP]
Ostatnio zmieniony przez zuraw13 2014-01-31, 22:08, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-01-31, 21:27


luki123luki123

Place Game






Wiek: 28
Na forum: 5416 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6103

Respekt: 611
Respekt: 611Respekt: 611

zuraw13, najpierw zaznacz na gridList jakos pozycje

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-01-31, 22:07


zuraw13







Wiek: 27
Na forum: 5214 dni
Posty: 95
Nick w MP: zuraw113

Piwa: 191

Respekt: 50

Zaznaczy?em i nie tepa

Podpis
Moje skrypty i mapy:
-Baza by Zuraw [SAMP]
-RC Vehicles enter by Zuraw [SAMP]
-Neony by zuraw [SAMP]
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-01-31, 23:00


luki123luki123

Place Game






Wiek: 28
Na forum: 5416 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6103

Respekt: 611
Respekt: 611Respekt: 611

zuraw13, Jutro ci napisz? posta o okolo godzinie 18

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-02-20, 23:27


zuraw13







Wiek: 27
Na forum: 5214 dni
Posty: 95
Nick w MP: zuraw113

Piwa: 191

Respekt: 50

Pomo?esz?

Podpis
Moje skrypty i mapy:
-Baza by Zuraw [SAMP]
-RC Vehicles enter by Zuraw [SAMP]
-Neony by zuraw [SAMP]
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-02-21, 10:47


luki123luki123

Place Game






Wiek: 28
Na forum: 5416 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6103

Respekt: 611
Respekt: 611Respekt: 611

Dalej z tym podaj kodzik :

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-02-22, 09:14


zuraw13







Wiek: 27
Na forum: 5214 dni
Posty: 95
Nick w MP: zuraw113

Piwa: 191

Respekt: 50

Naprawi?em

Podpis
Moje skrypty i mapy:
-Baza by Zuraw [SAMP]
-RC Vehicles enter by Zuraw [SAMP]
-Neony by zuraw [SAMP]
Postaw piwo autorowi tego posta
 

 
Tagi: teleport :: 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 » Teleport w Gui 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