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

Wysłany: 2019-02-20, 17:09


smigi







Wiek: 23
Na forum: 3367 dni
Posty: 60
Nick w MP: smigi

Piwa: 2

Respekt: 50

witam pomoze ktos mi z tymi notyfikacjami storiesrpg na pysa 3.0

StoriesRPG


local sw,sh=guiGetScreenSize()

function sx(po)
    return (po/1680)*sw
end

function sy(po)
    return (po/1050)*sh
end 

local font=exports["srpg-gui"]:czcionka(sx(11))

local tick=getTickCount()

notyfikacje={}
time_noti=5000



addEventHandler("onClientRender"getRootElement(), function()
    for i,v in ipairs(notyfikacje) do
        if getTickCount() > v[3]+time_noti then
            table.remove(notyfikacje1)
        end
        local offsetY=(sy(78))*(i-1)
        dxDrawImage(sx(1287), sy(145)+offsetYsx(393), sy(73), "i/"..v[1]..".png"000tocolor(245245245245), true)
        dxDrawText(v[2], sx(1358), sy(145)+(offsetY*2), sx(1680), sy(213), tocolor(255255255255), 1.00font"center""center"falsetruetruefalsefalse)
    end
end)

function createAlert(typ,text,_)
    if not typ then
        typ="info"
    end
    
    table.insert(notyfikacje, {typ,text,getTickCount()})
    playSound("s/"..typ..".mp3")
    outputConsole("["..typ.."] "..text)
    if #notyfikacje > 4 then
        tick=getTickCount()
        table.remove(notyfikacje1)
    end
end
addEvent("createAlert"true)
addEventHandler("createAlert"rootcreateAlert)



autobusy
local swsh=guiGetScreenSize()
local wh=(sw/1680), (sh/1050)
local font=dxCreateFont("f.ttf"12)
local font2=dxCreateFont("f.ttf"10)
local font3=dxCreateFont("f.ttf"15)
local font4=dxCreateFont("f.ttf"14)
local menuJob=false
local potwierdzExit=false
local praca="Autobusy"
local bileciki=false
local bilecikii=false
local ileos=0
local jakibilet="?"
startTick=getTickCount()

function isMouseInxywidthheight )
    if ( not isCursorShowing( ) ) then
        return false
    end
    local sxsy guiGetScreenSize ( )
    local cxcy getCursorPosition ( )
    local cxcy = ( cx sx ), ( cy sy )
    if ( cx >= and cx <= width ) and ( cy >= and cy <= height then
        return true
    else
        return false
    end
end


przystanki={
{-2122.41,112.63,35.17},
{-2169.59,-26.66,35.17},
{-2260.83,-96.63,35.17},
{-2334.27,-187.85,35.17},
{-2369.71,15.27,35.16},
{-2249.44,274.71,35.16},
{-2224.04,482.04,35.02},
{-2192.46,562.47,35.02},
{-2007.88,409.30,35.02},
{-2086.54,322.91,35.02},
{-2149.06,229.84,35.17},
{-2086.71,62.46,34.56},
}

local przystanek
local przystanekTarget
local blip


addEvent("autobusy:kolizja"true)
addEventHandler("autobusy:kolizja"getRootElement(), function(v)
    for i,bus in ipairs(getElementsByType("vehicle")) do
            setElementCollidableWith(busvfalse)
    end
end)

jobMarker=createMarker(-2089.6184.0235.31-1"cylinder"0.8025500)
setElementData(jobMarker,"icon""job")

addEventHandler("onClientRender"getRootElement(), function()
    
    if bilecikii == true then
        dxDrawRectangle(0*w0*h1680*w1050*htocolor(877148), false)

        if isMouseIn(186*w443*h316*w138*hthen
            dxDrawImage(186*w443*h316*w138*h"i/hovernormalny.png"000tocolor(255255255255), false)
        else
            dxDrawImage(186*w443*h316*w138*h"i/normalny.png"000tocolor(255255255255), false)
        end

        if isMouseIn(1208*w443*h316*w138*hthen
            dxDrawImage(1208*w443*h316*w138*h"i/hoverulgowy.png"000tocolor(255255255255), false)
        else
            dxDrawImage(1208*w443*h316*w138*h"i/ulgowy.png"000tocolor(255255255255), false)
        end


        dxDrawText("Klient prosi o bilet "..jakibilet664*w396*h1043*w739*htocolor(255255255255), 1.00*wfont3"center""center"falsefalsefalsefalsefalse)
    end
    
    if potwierdzExit == true then
        dxDrawImage(667*w427*h349*w181*h"i/bg_potwierdz.png"000tocolor(255255255255), false)
        if isMouseIn(677*w558*h88*w40*hthen
            dxDrawImage(677*w558*h88*w40*h"i/tak.png"000tocolor(255255255200), false)
        else
            dxDrawImage(677*w558*h88*w40*h"i/tak.png"000tocolor(255255255255), false)
        end
        
        if isMouseIn(918*w558*h88*w40*hthen
            dxDrawImage(918*w558*h88*w40*h"i/nie.png"000tocolor(255255255200), false)
        else
            dxDrawImage(918*w558*h88*w40*h"i/nie.png"000tocolor(255255255255), false)
        end
        
        dxDrawText("Jeste? pewny/a ?e chcesz zako?czy? prace?"694*w451*h989*w543*htocolor(255255255255), 1.00*wfont"center""center"falsefalsefalsefalsefalse)
    end
    
    if menuJob == true then
        dxDrawImage(549*w345*h578*w362*h"i/bg.png"000tocolor(255255255255), false)
        
        dxDrawImage(865*w378*h229*w132*h"i/jobimg.png"000tocolor(255255255255), false) -- zdj pracy
    
        
        if isMouseIn(574*w643*h101*w38*hthen
            dxDrawImage(574*w643*h101*w38*h"i/btn.png"000tocolor(255255255200), false)
        else
            dxDrawImage(574*w643*h101*w38*h"i/btn.png"000tocolor(255255255255), false)
        end
        
        if isMouseIn(737*w643*h101*w38*hthen
            dxDrawImage(737*w643*h101*w38*h"i/btn.png"000tocolor(255255255200), false)
        else
            dxDrawImage(737*w643*h101*w38*h"i/btn.png"000tocolor(255255255255), false)
        end
    
        
        dxDrawText("Twoje statystyki"916*w528*h1047*w554*htocolor(255255255255), 1.00*wfont3"center""center"falsefalsetruefalsefalse)
        dxDrawText("Zaliczonych przystank?w: #70DB93"..getElementData(localPlayer,"player:topautobusy"), 873*w564*h1091*w681*htocolor(255255255255), 1.00*wfont2"center""top"falsefalsetruetruefalse)
        dxDrawText(praca.."\n\nOpis\nCelem tej pracy jest przewo?enie os?b\nz przystanku na przystanek, oraz sprzedawanie im\nbilet?w.\n\nZarobki: Gracz: 1600-4600|Premium: 2500-6000"564*w396*h847*w558*htocolor(255255255255), 1.00*wfont2"center""center"falsetruefalsefalsefalse)
        dxDrawText("Rozpocznij"573*w643*h675*w681*htocolor(255255255255), 1.00*wfont2"center""center"falsefalsefalsefalsefalse)
        dxDrawText("Zamknij"736*w643*h838*w681*htocolor(255255255255), 1.00*wfont2"center""center"falsefalsefalsefalsefalse)
    end
end)


function endJobExitVeh()
    setElementData(localPlayer"player:job"false)
    triggerServerEvent("autobus:delete"localPlayer)
    unbindKey("F")
    unbindKey("enter")
    setTimer(function()
    setElementPosition(localPlayer, -2089.6487.4935.32)
    end2001)
    if przystanek and isElement(przystanekthen
        destroyElement(przystanek)
        przystanek nil
    end
    if przystanekTarget and isElement(przystanekTargetthen
        destroyElement(przystanekTarget)
        przystanekTarget nil
        przystanekTarget 0

    end
    if blip and isElement(blipthen
        destroyElement(blip)
        blip=nil
    end
end

function endJob()
    setElementData(localPlayer"player:job"false)
    triggerServerEvent("autobus:delete"localPlayer)
    unbindKey("F")
    unbindKey("enter")
    setTimer(function()
    end2001)
    if przystanek and isElement(przystanekthen
        destroyElement(przystanek)
        przystanek nil
    end
    if przystanekTarget and isElement(przystanekTargetthen
        destroyElement(przystanekTarget)
        przystanekTarget nil
        przystanekTarget 0

    end
        if blip and isElement(blipthen
        destroyElement(blip)
        blip=nil
    end
end


function hitPrzystanek(elmd)
    if el ~= localPlayer or not md then return end
    local maxTarget #przystanki
    if przystanekTarget maxTarget and getPedOccupiedVehicle(elthen return end
    if przystanekTarget == maxTarget and not getPedOccupiedVehicle(elthen return end
    local sx,sy,sz=getElementVelocity(getPedOccupiedVehicle(el))
    local km math.ceil(((sx^2+sy^2+sz^2)^(0.5))*155)
    if km 20 then return end
    
    if przystanekTarget == #przystanki then
        endJob()
        triggerEvent("createAlert"el"info""Zako?czy?e?/a? prace.")
    else
        setElementFrozen(getPedOccupiedVehicle(el), true)
        ileos=math.random(1,4)
        randomBilet()
        bilecikii=true
        bileciki=true
        showCursor(true)
    end
end


function showPrzystanek()
    if przystanek and isElement(przystanekthen
        destroyElement(przystanek)
        przystanek=nil
    end
    if blip and isElement(blipthen 
        destroyElement(blip)
        blip=nil
    end
    
    przystanekTarget=przystanekTarget+1
    przystanek=createMarker(przystanki[przystanekTarget][1], przystanki[przystanekTarget][2], przystanki[przystanekTarget][3]-0.95"cylinder"22552552550)
    blip=createBlip(przystanki[przystanekTarget][1], przystanki[przystanekTarget][2], przystanki[przystanekTarget][3], 41)
    setElementData(przystanek,"icon","busprzystanek")
    addEventHandler("onClientMarkerHit"przystanekhitPrzystanek)
end

addEvent("transport:unbindKeys"true)
addEventHandler("transport:unbindKeys"getRootElement(), function()
    unbindKey("f")
    unbindKey("enter")
end)

addEvent("autobusy:endJob"true)
addEventHandler("autobusy:endJob"getRootElement(), function()
    setElementData(localPlayer"player:job"false)
    triggerServerEvent("autobus:delete"localPlayer)
    unbindKey("F")
    unbindKey("enter")
    setTimer(function()
    end2001)
    if przystanek and isElement(przystanekthen
        destroyElement(przystanek)
        przystanek nil
    end
    if przystanekTarget and isElement(przystanekTargetthen
        destroyElement(przystanekTarget)
        przystanekTarget nil
        przystanekTarget 0

    end
        if blip and isElement(blipthen
        destroyElement(blip)
        blip=nil
    end
end)

function startEndJob()
    triggerServerEvent("autobusy:sprawdzPrawko"localPlayer)
    if getElementData(localPlayer,"player:license:pjC") ~= 1 then triggerEvent("createAlert",localPlayer,"error","Nie posiadasz prawa jazdy kat.C!") return end
    if getElementData(localPlayer,"player:block:prawko"then triggerEvent("createAlert"localPlayer"error""Posiadasz zawieszone prawa jazdy kat. A /B /C.") return end
        if not getElementData(localPlayer,"player:job"then
            setElementData(localPlayer,"player:job"praca)
            triggerServerEvent("autobusy:start"localPlayer)
            triggerEvent("createAlert",localPlayer,"success","Rozpocz??e?/a? prac?.")
            przystanekTarget=0
            showPrzystanek()
            bindKey("F""down"exitGUI)
            bindKey("enter""down"exitGUI)
        else
            exports["srpg-noti"]:createAlert("error""Jeste? ju? gdzie? zatrudniony!")
        end
end

function exitGUI()
    if potwierdzExit==false then
    potwierdzExit=true
    showCursor(true,false)
    end
end

addEventHandler("onClientMarkerHit"jobMarker, function(el)
    if el ~= localPlayer then return end
    if isPedInVehicle(elthen return end
    if getElementData(el,"admin:devmode") == true then return end
    if menuJob == false then
        menuJob=true
        clickJob=true
        showCursor(true)
    end
end)

function randomBilet()
        bilet=math.random(1,2)
        if bilet == 1 then
            jakibilet="normalny"
        elseif bilet == 2 then
            jakibilet="ulgowy"
        end
end


addEventHandler("onClientClick"getRootElement(), function(btn,state)
    if clickJob and btn == "left" and state == "down" then
        if isMouseIn(574*w643*h101*w38*hthen
            startEndJob()
            if menuJob == true then
                menuJob=false
                clickJob=false
                showCursor(false)
            end
        elseif isMouseIn(737*w643*h101*w38*hthen
            if menuJob == true then
                menuJob=false
                clickJob=false
                showCursor(false)
            end
        end
    end
    if potwierdzExit and btn == "left" and state == "down" then
        if isMouseIn(677*w558*h88*w40*hthen
            endJobExitVeh()
            showCursor(false)
            if bileciki == true then
                bileciki=false
            end
            potwierdzExit=false
            exports["srpg-noti"]:createAlert("info""Zako?czy?e?/a? prace.")
        elseif isMouseIn(918*w558*h88*w40*hthen
            showCursor(false)
            potwierdzExit=false
        end
    end
    if bileciki and btn == "left" and state == "down" then
        if isMouseIn(186*w443*h316*w138*hthen
            if jakibilet ~= "normalny" then 
                triggerEvent("createAlert"localPlayer"error""Poda?e? z?y bilet klientowi!")
                fadeCamera(false1.0000)
                bilecikii=false
                bileciki=false
                setTimer(function()
                    fadeCamera(true1.0000)
                    bilecikii=true
                    bileciki=true
                    randomBilet()
                    ileos=ileos-1
                    if ileos == 0 then bileciki=false  bilecikii=false showCursor(falsesetElementFrozen(getPedOccupiedVehicle(localPlayer), falseshowPrzystanek() triggerServerEvent("autobusy:topkazapis"localPlayer1end
                end10001)
                return
            end
                triggerServerEvent("job:wyplata"localPlayer"Autobusy")
                if getElementData(localPlayer,"player:premium"then
                    repkalos=math.random(3,8)
                else
                    repkalos=math.random(2,8)
                end
                if repkalos == 6 then
                if getElementData(localPlayer,"player:premium"then
                    ilerepki=math.random(2,6)
                else
                    ilerepki=math.random(1,3)
                end
                    setElementData(localPlayer,"player:reputation",getElementData(localPlayer,"player:reputation")+ilerepki)
                    triggerEvent("createAlert"localPlayer,"success","Otrzyma?e? "..ilerepki.." RP, za godn? podziwu prace.")
                end
                fadeCamera(false1.0000)
                bilecikii=false
                bileciki=false 
                setTimer(function()
                    fadeCamera(true1.0000)
                    bilecikii=true
                    bileciki=true
                    randomBilet()
                    ileos=ileos-1
                    if ileos == 0 then bileciki=false  bilecikii=false showCursor(falsesetElementFrozen(getPedOccupiedVehicle(localPlayer), falseshowPrzystanek() triggerServerEvent("autobusy:topkazapis"localPlayer1end
                end10001)
        elseif isMouseIn(1208*w443*h316*w138*hthen
            if jakibilet ~= "ulgowy" then 
                triggerEvent("createAlert"localPlayer"error""Poda?e? z?y bilet klientowi!") 
                fadeCamera(false1.0000)
                bilecikii=false
                bileciki=false
                setTimer(function()
                    fadeCamera(true1.0000)
                    bilecikii=true
                    bileciki=true
                    randomBilet()
                    ileos=ileos-1
                    if ileos == 0 then bileciki=false  bilecikii=false showCursor(falsesetElementFrozen(getPedOccupiedVehicle(localPlayer), falseshowPrzystanek() triggerServerEvent("autobusy:topkazapis"localPlayer1end
                end10001)
                return
            end
                triggerServerEvent("job:wyplata"localPlayer"Autobusy")
                fadeCamera(false1.0000)
                bilecikii=false
                bileciki=false
                setTimer(function()
                    fadeCamera(true1.0000)
                    bilecikii=true
                    bileciki=true
                    randomBilet()
                    ileos=ileos-1
                    if ileos == 0 then bileciki=false  bilecikii=false showCursor(falsesetElementFrozen(getPedOccupiedVehicle(localPlayer), falseshowPrzystanek() triggerServerEvent("autobusy:topkazapis"localPlayer1end
                end10001)
        end
    end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-20, 18:12


Adis.exe

LUA Developer






Wiek: 23
Na forum: 3498 dni
Posty: 292
Nick w MP: Adiś.exe

Piwa: 997

Respekt: 110,3
Respekt: 110,3

Wyt?umacz dok?adnie o co ci chodzi

Podpis

KONTAKT:
GG: 60968224
Discord: Adiś.exe#3828

Użytkownik: 05.11.2016
GTAO Member: 20.02.2019
Support-Team: 25.07.2018
Support-Team: 19.01.2019
Test Mod: 08.02.2019

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-20, 18:19


smigi







Wiek: 23
Na forum: 3367 dni
Posty: 60
Nick w MP: smigi

Piwa: 2

Respekt: 50

Adis.exe,
mam normalnie notyfikacje ale mi tam nie pokazuje napis?w

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-20, 18:36


Query

SyndicateMTA






Wiek: 24
Na forum: 3071 dni
Posty: 319
Nick w MP: Query

Piwa: 5257

Respekt: 141
Respekt: 141

zle eksport

Podpis
Ostatnio zmieniony przez Query 2019-02-20, 18:46, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-20, 18:41


Adis.exe

LUA Developer






Wiek: 23
Na forum: 3498 dni
Posty: 292
Nick w MP: Adiś.exe

Piwa: 997

Respekt: 110,3
Respekt: 110,3

smigi, na przysz?o?? wklejaj kawa?ek kodu z kt?rym masz problem a nie ca?y kod ;)
zamiast triggerowa? te noyfikacje to je zaexportuj, czyli tam gdzie chcesz ?eby wywo?a?a si? notyfikacja dajesz:

exports['nazwa_zasobu_z_noyfikacjami']:createAlert("info""tre??")


nie zapomnij r?wnie? wpisa? exportu w met? skryptu z notyfikacjami:

Kod:

<export function="createAlert" type="client" cache="false" />


Podpis

KONTAKT:
GG: 60968224
Discord: Adiś.exe#3828

Użytkownik: 05.11.2016
GTAO Member: 20.02.2019
Support-Team: 25.07.2018
Support-Team: 19.01.2019
Test Mod: 08.02.2019

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-20, 18:46


Query

SyndicateMTA






Wiek: 24
Na forum: 3071 dni
Posty: 319
Nick w MP: Query

Piwa: 5257

Respekt: 141
Respekt: 141

Adis.exe, mogl to tez triggerem wykona? ;v

Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-20, 18:55


smigi







Wiek: 23
Na forum: 3367 dni
Posty: 60
Nick w MP: smigi

Piwa: 2

Respekt: 50

Adis.exe, dzieki sprawdze czy dzia?a

[ Dodano: 2019-02-20, 19:09 ]
Adis.exe, cos nie dzia?? najlepiej jak ty bys to zrobi? i mi podes?a? ca?y kod

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-21, 19:05


Adis.exe

LUA Developer






Wiek: 23
Na forum: 3498 dni
Posty: 292
Nick w MP: Adiś.exe

Piwa: 997

Respekt: 110,3
Respekt: 110,3

Query, niby tak, lecz ja zawsze je?eli chodzi o notyfikacje korzystam z export?w.


smigi, pomagamy na forum ;) Co? w debugu wyskoczy?o ?

Podpis

KONTAKT:
GG: 60968224
Discord: Adiś.exe#3828

Użytkownik: 05.11.2016
GTAO Member: 20.02.2019
Support-Team: 25.07.2018
Support-Team: 19.01.2019
Test Mod: 08.02.2019

Postaw piwo autorowi tego posta
 

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