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

Wysłany: 2016-12-29, 18:54


GamerHD11







Wiek: 24
Na forum: 4261 dni
Posty: 259
Nick w MP: SzokoHD

Piwa: 23

Respekt: 50

Witam m?j problem polega na tym, ?e jak wyje?d?am z markeru to spami mi wiadomo?ciami, a maj? tylko raz wyskakiwa?. Nie wiem czym to jest spowodowane. Kto? pomo?e ?

function stacjaPociong(el)
if el ~= localPlayer then return end
local wyjazdtimer getTickCount()
if getElementData(source"stacja") == true then
if wyjazdtimer wjazdtimer >= 10000 then
wyjazdtimer 0
wjazdtimer 0
auto getPedOccupiedVehicle(localPlayer)
destroyElement(getElementData(source"blip"))
destroyElement(source)
rnd2 math.random(1#markery)
marker2 createMarker(markery[rnd2][1], markery[rnd2][2], markery[rnd2][3] - 1"checkpoint"40,10045)
setElementData(marker2"stacja"true)
blip2 createBlipAttachedTo(marker241)
random2 math.random(1020)
random3 math.random(110)
ludzie random2 random3
setElementData(auto"ludzie"getElementData(auto"ludzie") + ludzie)
outputChatBox("Do poci?gu wesz?o: "..random2..", a wysz?o: "..random3.." osoby."0180247)
outputChatBox("Jed? na nast?pn? stacj?: "..markery[rnd2][4]..""0180247)
else
outputChatBox("Wr?c do markera i poczekaj, a? ludzie wejd? do poci?gu !"0180247)
wyjazdtimer 0
wjazdtimer 0
removeEventHandler("onClientRender"getRootElement(), dx)
killTimer(timer)
end
end
end
addEventHandler("onClientMarkerLeave"getRootElement(), stacjaPociong)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-29, 19:02


Kalizman







Wiek: 23
Na forum: 3652 dni
Posty: 1394

Piwa: 4619

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

Nie wiem czy to co? zadzia?a ale daj zmienn? w outputChatBoxie czyli 'el' ;v

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-29, 19:08


xJakob







Wiek: 31
Na forum: 3662 dni
Posty: 164
Nick w MP: tylkoyolo

Piwa: 984

Respekt: 155,3
Respekt: 155,3Respekt: 155,3

Zr?b sobie na dystans to ?e jak odjedzie np: 600 metr?w to wyskakuje odjecha? za daleko i ?e musi wr?ci?


function odleglosc()
    local x,y,getElementPosition(localPlayer)
    local mx,my,mz getElementPosition(jobMarker)
    local distance getDistanceBetweenPoints3D(x,y,z,mx,my,mz)
    if distance 400 then
        outputChatBox("WRACAJ!!!!!!!!!")
    end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-29, 19:12


GamerHD11







Wiek: 24
Na forum: 4261 dni
Posty: 259
Nick w MP: SzokoHD

Piwa: 23

Respekt: 50

xJakob, ale mam zrobione, ?e jak wyjedzie si? z markera to, ?e resetuje counta. A tak to wszystko dzia?a tylko spami wiadomosciami.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-29, 19:17


_Haze

Peace Yo!






Wiek: 24
Na forum: 4184 dni
Posty: 1648
Nick w MP: Haze

Piwa: 2628

Respekt: 1020
Respekt: 1020

killTimer(timer) Co to za timer? Po tym kodzie moim zdaniem nie ma co si? powt?rzy? poza tym tw?j kod jest ma?o czytelny polecam tabowa?. Nie masz ?adnej p?tli albo timera albo co?? Poka? wi?cej kodu.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-29, 19:35


GamerHD11







Wiek: 24
Na forum: 4261 dni
Posty: 259
Nick w MP: SzokoHD

Piwa: 23

Respekt: 50

Nie posiadam ?adnej p?tli ani timera.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-29, 19:41


_Haze

Peace Yo!






Wiek: 24
Na forum: 4184 dni
Posty: 1648
Nick w MP: Haze

Piwa: 2628

Respekt: 1020
Respekt: 1020

to do czego s?u?y killTimer(timer) na samym dole kodu skoro nie ma ?adnego timera ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-29, 19:45


GamerHD11







Wiek: 24
Na forum: 4261 dni
Posty: 259
Nick w MP: SzokoHD

Piwa: 23

Respekt: 50

localPlayer getLocalPlayer()

function rozpocznijPrace()
if getElementData(localPlayer"maszynista") == true then return end
auto getPedOccupiedVehicle(localPlayer)
removeEventHandler("onClientRender"getRootElement(), GUI)
guiSetVisible(zacznijfalse)
guiSetVisible(zamknijfalse)
showCursor(false)
triggerServerEvent("zrespPociong"localPlayerlocalPlayer)
outputChatBox("Rozpoczale? prac? maszynisty. Musisz zawozi? pasa?er?w do zaznaczonych miejsc na mapie."0180247)
setElementData(localPlayer"maszynista"true)
rnd math.random(1#markery)
marker1 createMarker(markery[rnd][1], markery[rnd][2], markery[rnd][3] - 1"checkpoint"40010045)
setElementData(marker1"stacja"true)
blip createBlipAttachedTo(marker141)
setElementData(marker1"blip"blip)
end
addEventHandler("onClientGUIClick"zacznijrozpocznijPrace)

function dx()
dxDrawText("Wyjedz z markera kiedy tekst zniknie ..."screenW 0.1544screenH 0.3491screenW 0.8198screenH 0.5361tocolor(255255255255), 2.00/1920*screenW"bankgothic""center""center"falsefalsefalsefalsefalse)
end

    function pasaz()
    auto getPedOccupiedVehicle(localPlayer)
    if getElementData(auto"pociag") == true then
    ludzie getElementData(auto"ludzie") or 0
        dxDrawRectangle(screenW 0.7792screenH 0.3056screenW 0.2104screenH 0.1954tocolor(100198), false)
        dxDrawText("Pasazerowie:"screenW 0.7870screenH 0.3056screenW 0.9807screenH 0.3648tocolor(255255255255), 1.00/1920*screenW"bankgothic""center""center"falsefalsefalsefalsefalse)
        dxDrawRectangle(screenW 0.7849screenH 0.3630screenW 0.1995screenH 0.1287tocolor(313131122), false)
        dxDrawText(""..ludzie.." os."screenW 0.7854screenH 0.3639screenW 0.9844screenH 0.4917tocolor(255255255255), 1.50/1920*screenW"bankgothic""center""center"falsefalsefalsefalsefalse)
        end
    end
    addEventHandler("onClientRender"getRootElement(), pasaz)

function naliczCzas(el)
if el ~= localPlayer then return end
auto getPedOccupiedVehicle(el)
if not auto then return end
if getElementData(auto"pociag") ~= true then return end
if getElementData(source"stacja") == true then
wjazdtimer getTickCount()
outputChatBox("Pasa?erowie wchodz? do poci?gu, je?eli odjedziesz, b?dziesz musia? jeszcze raz poczeka? na zaludnienie si? pojazdu !"0180247)
addEventHandler("onClientRender"getRootElement(), dx)
setTimer(function()
removeEventHandler("onClientRender"getRootElement(), dx)
end100001)
end
end
addEventHandler("onClientMarkerHit"getRootElement(), naliczCzas)

function stacjaPociong(el)
if el ~= localPlayer then return end
local wyjazdtimer getTickCount()
if getElementData(source"stacja") == true then
if wyjazdtimer wjazdtimer >= 10000 then
wyjazdtimer 0
wjazdtimer 0
auto getPedOccupiedVehicle(localPlayer)
destroyElement(getElementData(source"blip"))
destroyElement(source)
rnd2 math.random(1#markery)
marker2 createMarker(markery[rnd2][1], markery[rnd2][2], markery[rnd2][3] - 1"checkpoint"40,10045)
setElementData(marker2"stacja"true)
blip2 createBlipAttachedTo(marker241)
random2 math.random(1020)
random3 math.random(110)
ludzie random2 random3
setElementData(auto"ludzie"getElementData(auto"ludzie") + ludzie)
outputChatBox("Do poci?gu wesz?o: "..random2..", a wysz?o: "..random3.." osoby."0180247)
outputChatBox("Jed? na nast?pn? stacj?: "..markery[rnd2][4]..""0180247)
else
outputChatBox("Wr?c do markera i poczekaj, a? ludzie wejd? do poci?gu !"0180247)
wyjazdtimer 0
wjazdtimer 0
removeEventHandler("onClientRender"getRootElement(), dx)
killTimer(timer)
end
end
end
addEventHandler("onClientMarkerLeave"getRootElement(), stacjaPociong)


[ Dodano: 2016-12-29, 19:49 ]
jest timer ale w innej funkcji.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-29, 20:34


FaydenFX.







Wiek: 27
Na forum: 4056 dni
Posty: 246
Nick w MP: faydn

Piwa: 11

Respekt: 45,3

Poka? ca?y kod.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-29, 23:01


GamerHD11







Wiek: 24
Na forum: 4261 dni
Posty: 259
Nick w MP: SzokoHD

Piwa: 23

Respekt: 50

marker createMarker(1733.51648, -1912.0606713.56204 1"cylinder"1.50012845)
--createBlipAttachedTo(marker38)
setElementData(localPlayer"maszynista"false)

screenWscreenH guiGetScreenSize()

markery = {
{813.64655, -1368.00684, -1.67093"LS Centrum"},
--{-1943.94128145.9158825.71094"Main San Fierro"},
--{741.147711985.386355.34257"North Las Venturas"},
--{2864.823731291.0180710.82031"East Las Venturas"},
}


function GUI()
        dxDrawLine((screenW 0.4156) - 1screenH 0.7306screenW 0.5849screenH 0.7306tocolor(000255), 1false)
        dxDrawLine(screenW 0.5849screenH 0.7306screenW 0.5849, (screenH 0.2694) - 1tocolor(000255), 1false)
        dxDrawRectangle(screenW 0.4156screenH 0.2694screenW 0.1693screenH 0.4611tocolor(000200), false)
        dxDrawImage(screenW 0.4177screenH 0.2741screenW 0.1651screenH 0.2176"alko.jpg")
        dxDrawText("Rodzaj: Maszynista", (screenW 0.4177) + 1, (screenH 0.4917) + 1, (screenW 0.5828) + 1, (screenH 0.5380) + 1tocolor(000255), 1.50/1920*screenW"sans""center""center"falsefalsefalsefalsefalse)
        dxDrawText("Rodzaj: Maszynista"screenW 0.4177screenH 0.4917screenW 0.5828screenH 0.5380tocolor(255255255255), 1.50/1920*screenW"sans""center""center"falsefalsefalsefalsefalse)
        dxDrawText("Wymagania: Brak", (screenW 0.4177) + 1, (screenH 0.5287) + 1, (screenW 0.5828) + 1, (screenH 0.5750) + 1tocolor(000255), 1.50/1920*screenW"sans""center""center"falsefalsefalsefalsefalse)
        dxDrawText("Wymagania: Brak"screenW 0.4177screenH 0.5287screenW 0.5828screenH 0.5750tocolor(255255255255), 1.50/1920*screenW"sans""center""center"falsefalsefalsefalsefalse)
        dxDrawText("Zarobki: 750 - 800 $", (screenW 0.4177) + 1, (screenH 0.5657) + 1, (screenW 0.5828) + 1, (screenH 0.6120) + 1tocolor(000255), 1.50/1920*screenW"sans""center""center"falsefalsefalsefalsefalse)
        dxDrawText("Zarobki: 750 - 800 $"screenW 0.4177screenH 0.5657screenW 0.5828screenH 0.6120tocolor(255255255255), 1.50/1920*screenW"sans""center""center"falsefalsefalsefalsefalse)
        dxDrawLine((screenW 0.4182) - 1screenH 0.6713screenW 0.5828screenH 0.6713tocolor(000255), 1false)
        dxDrawLine(screenW 0.5828screenH 0.6713screenW 0.5828, (screenH 0.6241) - 1tocolor(000255), 1false)
        dxDrawRectangle(screenW 0.4182screenH 0.6241screenW 0.1646screenH 0.0472tocolor(505050200), false)
        dxDrawLine((screenW 0.4182) - 1screenH 0.7213screenW 0.5828screenH 0.7213tocolor(000255), 1false)
        dxDrawLine(screenW 0.5828screenH 0.7213screenW 0.5828, (screenH 0.6741) - 1tocolor(000255), 1false)
        dxDrawRectangle(screenW 0.4182screenH 0.6741screenW 0.1646screenH 0.0472tocolor(505050200), false)
        dxDrawText("Zacznij Prace", (screenW 0.4182) + 1, (screenH 0.6231) + 1, (screenW 0.5828) + 1, (screenH 0.6713) + 1tocolor(000255), 2.00/1920*screenW"sans""center""center"falsefalsefalsefalsefalse)
        dxDrawText("Zacznij Prace"screenW 0.4182screenH 0.6231screenW 0.5828screenH 0.6713tocolor(255255255255), 2.00/1920*screenW"sans""center""center"falsefalsefalsefalsefalse)
        dxDrawText("Powrot", (screenW 0.4182) + 1, (screenH 0.6741) + 1, (screenW 0.5828) + 1, (screenH 0.7222) + 1tocolor(000255), 2.00/1920*screenW"sans""center""center"falsefalsefalsefalsefalse)
        dxDrawText("Powrot"screenW 0.4182screenH 0.6741screenW 0.5828screenH 0.7222tocolor(255255255255), 2.00/1920*screenW"sans""center""center"falsefalsefalsefalsefalse)
    end
    
zacznij guiCreateButton(0.420.620.160.05""true)
guiSetAlpha(zacznij0.00)
zamknij guiCreateButton(0.420.670.160.05""true)
guiSetAlpha(zamknij0.00)

guiSetVisible(zacznijfalse)
guiSetVisible(zamknijfalse)

function openGUI(el)
if el ~= localPlayer then return end
addEventHandler("onClientRender"getRootElement(), GUI)
guiSetVisible(zacznijtrue)
guiSetVisible(zamknijtrue)
showCursor(true)
end
addEventHandler("onClientMarkerHit"markeropenGUI)

function closeGUI()
removeEventHandler("onClientRender"getRootElement(), GUI)
guiSetVisible(zacznijfalse)
guiSetVisible(zamknijfalse)
showCursor(false)
end
addEventHandler("onClientGUIClick"zamknijcloseGUI)

localPlayer getLocalPlayer()

function rozpocznijPrace()
if getElementData(localPlayer"maszynista") == true then return end
auto getPedOccupiedVehicle(localPlayer)
removeEventHandler("onClientRender"getRootElement(), GUI)
guiSetVisible(zacznijfalse)
guiSetVisible(zamknijfalse)
showCursor(false)
triggerServerEvent("zrespPociong"localPlayerlocalPlayer)
outputChatBox("Rozpoczale? prac? maszynisty. Musisz zawozi? pasa?er?w do zaznaczonych miejsc na mapie."0180247)
setElementData(localPlayer"maszynista"true)
rnd math.random(1#markery)
marker1 createMarker(markery[rnd][1], markery[rnd][2], markery[rnd][3] - 1"checkpoint"40010045)
setElementData(marker1"stacja"true)
blip createBlipAttachedTo(marker141)
setElementData(marker1"blip"blip)
end
addEventHandler("onClientGUIClick"zacznijrozpocznijPrace)

function dx()
dxDrawText("Wyjedz z markera kiedy tekst zniknie ..."screenW 0.1544screenH 0.3491screenW 0.8198screenH 0.5361tocolor(255255255255), 2.00/1920*screenW"bankgothic""center""center"falsefalsefalsefalsefalse)
end

    function pasaz()
    auto getPedOccupiedVehicle(localPlayer)
    if getElementData(auto"pociag") == true then
    ludzie getElementData(auto"ludzie") or 0
        dxDrawRectangle(screenW 0.7792screenH 0.3056screenW 0.2104screenH 0.1954tocolor(100198), false)
        dxDrawText("Pasazerowie:"screenW 0.7870screenH 0.3056screenW 0.9807screenH 0.3648tocolor(255255255255), 1.00/1920*screenW"bankgothic""center""center"falsefalsefalsefalsefalse)
        dxDrawRectangle(screenW 0.7849screenH 0.3630screenW 0.1995screenH 0.1287tocolor(313131122), false)
        dxDrawText(""..ludzie.." os."screenW 0.7854screenH 0.3639screenW 0.9844screenH 0.4917tocolor(255255255255), 1.50/1920*screenW"bankgothic""center""center"falsefalsefalsefalsefalse)
        end
    end
    addEventHandler("onClientRender"getRootElement(), pasaz)

function naliczCzas(el)
if el ~= localPlayer then return end
auto getPedOccupiedVehicle(el)
if not auto then return end
if getElementData(auto"pociag") ~= true then return end
if getElementData(source"stacja") == true then
wjazdtimer getTickCount()
outputChatBox("Pasa?erowie wchodz? do poci?gu, je?eli odjedziesz, b?dziesz musia? jeszcze raz poczeka? na zaludnienie si? pojazdu !"0180247)
addEventHandler("onClientRender"getRootElement(), dx)
setTimer(function()
removeEventHandler("onClientRender"getRootElement(), dx)
end100001)
end
end
addEventHandler("onClientMarkerHit"getRootElement(), naliczCzas)

function stacjaPociong(el)
if el ~= localPlayer then return end
local wyjazdtimer getTickCount()
if getElementData(source"stacja") == true then
if wyjazdtimer wjazdtimer >= 10000 then
wyjazdtimer 0
wjazdtimer 0
auto getPedOccupiedVehicle(localPlayer)
destroyElement(getElementData(source"blip"))
destroyElement(source)
rnd2 math.random(1#markery)
marker2 createMarker(markery[rnd2][1], markery[rnd2][2], markery[rnd2][3] - 1"checkpoint"40,10045)
setElementData(marker2"stacja"true)
blip2 createBlipAttachedTo(marker241)
random2 math.random(1020)
random3 math.random(110)
ludzie random2 random3
setElementData(auto"ludzie"getElementData(auto"ludzie") + ludzie)
outputChatBox("Do poci?gu wesz?o: "..random2..", a wysz?o: "..random3.." osoby."0180247)
outputChatBox("Jed? na nast?pn? stacj?: "..markery[rnd2][4]..""0180247)
else
outputChatBox("Wr?c do markera i poczekaj, a? ludzie wejd? do poci?gu !"0180247)
wyjazdtimer 0
wjazdtimer 0
removeEventHandler("onClientRender"getRootElement(), dx)
killTimer(timer)
end
end
end
addEventHandler("onClientMarkerLeave"getRootElement(), stacjaPociong)


function exito(el)
if el ~= localPlayer then return end
auto getPedOccupiedVehicle(el)
if getElementData(auto"pociag") == true and getPedOccupiedVehicleSeat(el) == 0 then
destroyElement(blip)
destroyElement(marker1)
destroyElement(blip2)
destroyElement(marker2)
end
end
addEventHandler("onClientVehicleStartExit"getRootElement(), exito)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-29, 23:13


_Haze

Peace Yo!






Wiek: 24
Na forum: 4184 dni
Posty: 1648
Nick w MP: Haze

Piwa: 2628

Respekt: 1020
Respekt: 1020

Jaka wiadomo?? si? powtarza???

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-29, 23:24


GamerHD11







Wiek: 24
Na forum: 4261 dni
Posty: 259
Nick w MP: SzokoHD

Piwa: 23

Respekt: 50

No te :

outputChatBox("Do poci?gu wesz?o: "..random2..", a wysz?o: "..random3.." osoby."0180247)
outputChatBox("Jed? na nast?pn? stacj?: "..markery[rnd2][4]..""0180247)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-30, 00:40


marcin778

Krytyk serwerów MTA






Wiek: 24
Na forum: 4150 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4662

Respekt: 1436,8
Respekt: 1436,8

Ten killTimer nie wywala ci db? Nie ma nigdzie timera takiego.

Podpis
Moje prace: https://www.youtube.com/c...MuaWGHPp1mhlGnw

-- obecnie
-- obecnie
-- dawniej
-- dawniej
-- dawniej
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-30, 08:41


_Haze

Peace Yo!






Wiek: 24
Na forum: 4184 dni
Posty: 1648
Nick w MP: Haze

Piwa: 2628

Respekt: 1020
Respekt: 1020

Spr?buj usun?? getTickCounty i p??niej je znowu zr?b

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-30, 12:19


GamerHD11







Wiek: 24
Na forum: 4261 dni
Posty: 259
Nick w MP: SzokoHD

Piwa: 23

Respekt: 50

Zrobi?em tak i nie dzia?a ;(

[ Dodano: 2016-12-30, 21:50 ]
Znaczy og?lnie tak jak by ten event tworzy? si? kilka razy bo setElementData te? si? robi kilka razy, tak jakby jaka? p?tla by?a ale nigdzie jej nie ma.

Postaw piwo autorowi tego posta
 

 
Tagi: gettickcount
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