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

Wysłany: 2017-09-06, 17:06


Krzemo1234







Wiek: 26
Na forum: 3751 dni
Posty: 387
Nick w MP: Krzemo

Piwa: 16

Respekt: 40

Witam gdy naciskam rozpocznij nie ma ?adnych powiadomie? zrobi?em to samo co na autobusach tylko tam dzia?a

ss: https://imgur.com/a/vZL3X


Kod:

local function hit_marker(el,md)
    if getElementType(el) ~= "player" or not md then return end
    if getElementData(source,"start_job"then
    
            if getElementData(el,"player:license:pjC") ~= 1 then
        triggerEvent("onClientAddNotification"el"Aby tu pracowa? musisz mie? zdane prawo jazdy kat. C!""error")        
        return
    end        
    
        if getElementData(el,"player:srp") < 250 then
        triggerEvent("onClientAddNotification"el"Aby tu pracowa? musisz mie? 250SP!""error")            
        return
    end        
    
        if getPedOccupiedVehicle(elthen return end
        triggerClientEvent(el,"show_gui",resourceRoot,source)
    elseif getElementData(source,"get_vehicles"then
        if not getElementData(el,"packer_job"then return end
        local veh getPedOccupiedVehicle(el)
        if veh then
            if getElementData(veh,"loaded") or getElementModel(veh) ~= 578 then exports["1"]:outputNotificationBox (el"Jed? do punktu oznaczonego blipem 'C'"255255255exports["1"]:outputNotificationBox (el"Pojazdy zosta?y ju? za?adowane!"25500) return end
            setElementFrozen(veh,true)
            toggleControl(el,"enter_exit",false)
            triggerEvent("onClientAddNotification"el"Trwa ?adowanie pojazd?w""error")
            setTimer(function(plr,veh)
                local x,y,getElementPosition(veh)
                local rx,ry,rz getElementRotation(veh)
                load_vehicles(veh,x,y,z,rx,ry,rz)
                triggerEvent("onClientAddNotification"el"Ruszaj do punktu oznaczonego blipem""error")
                triggerEvent("onClientAddNotification"el"Pojazdy za?adowane!""error")
                setElementFrozen(veh,false)
                setElementData(veh,"loaded",true)
                toggleControl(plr,"enter_exit",true)
                triggerClientEvent(plr,"transport_started",resourceRoot)
            end,5000,1,el,veh)
        end
    end
end
addEventHandler("onMarkerHit",resourceRoot,hit_marker)


Podpis
Jeśli ci pomogłem zostaw zimne :piwo:
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-09-06, 18:17


Kalizman







Wiek: 23
Na forum: 3651 dni
Posty: 1394

Piwa: 4619

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

Pokaz kod powiadomie?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-09-06, 22:33


Krzemo1234







Wiek: 26
Na forum: 3751 dni
Posty: 387
Nick w MP: Krzemo

Piwa: 16

Respekt: 40


local cFunc={}
local cSetting={}

NTSClient={}
NTSClient.__index=NTSClient

--
addEvent('onClientAddNotification'true)
--

-- send to client triggerClientEvent(player'onClientAddNotification'playertext'type')
-- send to all clients triggerClientEvent(root'onClientAddNotification'roottext'type')

function NTSClient:new(...)
    local obj=setmetatable({}, {__index=self})
    if obj.constructor then
        obj:constructor(...)
    end
    return obj
end

function NTSClient:render()
    local now getTickCount() 
    if now >= self.tick then 
        self.tick getTickCount()+10
        self.count self.count-2
    end 
    
    local bg_xbg_y=937186
    local x=self.sx/2-(bg_x/self.zoom)/2
    
    if self.count==20 and self.nts[1then
        self.fadeOut=self.nts[1]
        table.remove(self.nts1)
    end
    if self.count<=20 and self.count>0 then
        self.pos_y=6/self.zoom+self.count/self.zoom
        self.posTXT_y=4/self.zoom+self.count/self.zoom
    elseif self.count==0 then
        self.pos_y=6/self.zoom
        self.posTXT_y=4/self.zoom
        self.count=280
    end
    
    if self.fadeOut then
        self.fadeOut.alpha=math.max(self.fadeOut.alpha-0.050)
        dxDrawImage(xself.pos_ybg_x/self.zoombg_y/self.zoomself.textures[tostring(self.fadeOut.type)], 000tocolor(255255255255*self.fadeOut.alpha), true)
        dxDrawText(self.fadeOut.msgx+(bg_x/6.25/self.zoom), self.posTXT_yx+(bg_x/7/self.zoom)+bg_x/self.zoom-bg_x/5/self.zoomself.posTXT_y+(bg_y/self.zoom), tocolor(255255255255*self.fadeOut.alpha), 0.5self.font1'center''center'truetruetrue)
        if self.fadeOut.alpha==0 then
            self.fadeOut=nil
        end
    end
    
    for i,v in pairs(self.nts) do
        if i>2 then return end
        
        v.alpha=math.min(v.alpha+0.051)
        dxDrawImage(xself.pos_y+((i-1)*150)/self.zoombg_x/self.zoombg_y/self.zoomself.textures[tostring(v.type)], 000tocolor(255255255255*v.alpha), true)
        dxDrawText(v.msgx+(bg_x/6.25/self.zoom), self.posTXT_y+((i-1)*150)/self.zoomx+(bg_x/7/self.zoom)+bg_x/self.zoom-bg_x/5/self.zoomself.posTXT_y+(bg_y/self.zoom)+((i-1)*150)/self.zoomtocolor(255255255255*v.alpha), 0.5self.font1'center''center'truetruetrue)
    end
end

function NTSClient:add(msgtype)
    if #self.nts==0 then
        self.count=280
    end
    
    outputConsole("["..string.upper(type).."] "..msg)
    table.insert(self.nts, {
        msg=msg, 
        type=type,
        alpha=0,
        tick=getTickCount()
    })
    -- ZAKOMENTOWANO DO STARTU SERWERA!
    local snd=playSound('s/' ..type.. '.mp3')
    setSoundVolume(snd0.3)
end

function NTSClient:onAddNTS(datatype)
    if not data then return end
    if not type then return end
    
    NTSClass:add(datatype)
end

-- wywolywanie klasy
function NTSClient:constructor(...)
    self.count=280
    self.fadeOut=nil
    self.nts={}
    
    local sx,sy=guiGetScreenSize()
    self.sxself.sy=sxsy
    self.zoom=2.4

    self.lu_start=getTickCount()
    self.pos_yself.posTXT_y=6/self.zoom4/self.zoom
    
    -- notifications textures
    self.textures={
        ['warning']=dxCreateTexture('i/nts_warning.png''dxt5'false'wrap'),
        ['error']=dxCreateTexture('i/nts_error.png''dxt5'false'wrap'),
        ['success']=dxCreateTexture('i/nts_success.png''dxt5'false'wrap'),
        ['info']=dxCreateTexture('i/nts_info.png''dxt5'false'wrap'),
    }
    --
    
    -- font
    self.font=dxCreateFont('f/myriad_prop.ttf'20)
    self.font1=dxCreateFont('f/archivo_narrow.ttf'20) 
    --
    
    self.funcAddNTS=function(datatypeself:onAddNTS(datatypeend
    addEventHandler('onClientAddNotification'rootself.funcAddNTS)
    
    self.renderFunc=function() self:render() end
    addEventHandler('onClientRender'rootself.renderFunc)

    self.tick 10 
    --outputDebugString('[calling] NTSClient: constructor')
end
NTSClass=NTSClient:new()


Podpis
Jeśli ci pomogłem zostaw zimne :piwo:
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-09-06, 22:35


Cjalis







Wiek: 35
Na forum: 3543 dni
Posty: 26
Nick w MP: Cejot

Piwa: 36

Respekt: 70

Je?eli si? nie myl? to widz? tutaj kod na prac? po stronie "client",
     triggerEvent("onClientAddNotification","Aby tu pracowa? musisz mie? zdane prawo jazdy kat. C!""error")  



spr?buj tak ( usu? po prostu "el")

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-09-06, 22:45


.RiV







Wiek: 25
Na forum: 3588 dni
Posty: 554
Nick w MP: Split

Piwa: 2596

Respekt: 597,8
Respekt: 597,8

"Cjalis" napisał/a:

Je?eli si? nie myl? to widz? tutaj kod na prac? po stronie "client",
     triggerEvent("onClientAddNotification","Aby tu pracowa? musisz mie? zdane prawo jazdy kat. C!""error")  



spr?buj tak ( usu? po prostu "el")


Nie wypisuj bzdur. Przeczytaj warto?ci jakie musz? si? znale??.

Required Arguments
eventNameThe name of the event you wish to trigger
baseElementThe element you wish to trigger the event onSee event system for information on how this works.

Optional Arguments
argument1The first argument that the event handler expects should be added after the baseElement variable.


Czyli jako baseElement dajesz
"Aby tu pracowa? musisz mie? zdane prawo jazdy kat. C!"


I to nie jest klient, wi?c trigger si? nie wykona.

A co do autora tematu. Na pocz?tku kodu zamie? to:
if getElementType(el) ~= "player" or not md then return end


na
if getElementType(el) ~= "player" then return end


Nie jestem pewny w 100% czy to zadzia?a, gdy? trzy miesi?ce temu mia?em styczno?? z LUA.

Podpis

Autor OGRPG, na scenie MTA od 2012 roku.




Użytkownik: 08.08.2016
GTAO Member: 06.02.2017
Support-Team: 17.06.2017 & 01.06.2019 - 18.11.2019
Moderator: 14.01.2018 - 09.08.2018

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-09-08, 16:18


Krzemo1234







Wiek: 26
Na forum: 3751 dni
Posty: 387
Nick w MP: Krzemo

Piwa: 16

Respekt: 40

Nie dzia?a og?lnie te powiadomienia s? po stronie server jak co?

Podpis
Jeśli ci pomogłem zostaw zimne :piwo:
Postaw piwo autorowi tego posta
 

 
Tagi: nie :: działają :: powiadomienia
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Odpowiedz do tematu

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