Wysłany: 2019-02-20, 17:09
smigi
Wiek: 23 Na forum: 3367 dni Posty: 60
Nick w MP: smigi
Piwa : 2
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 ( notyfikacje , 1 )
end
local offsetY =( sy ( 78 ))*( i - 1 )
dxDrawImage ( sx ( 1287 ), sy ( 145 )+ offsetY , sx ( 393 ), sy ( 73 ), "i/" .. v [ 1 ].. ".png" , 0 , 0 , 0 , tocolor ( 245 , 245 , 245 , 245 ), true )
dxDrawText ( v [ 2 ], sx ( 1358 ), sy ( 145 )+( offsetY * 2 ), sx ( 1680 ), sy ( 213 ), tocolor ( 255 , 255 , 255 , 255 ), 1.00 , font , "center" , "center" , false , true , true , false , false )
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 ( notyfikacje , 1 )
end
end
addEvent ( "createAlert" , true )
addEventHandler ( "createAlert" , root , createAlert )
autobusy local sw , sh = guiGetScreenSize ()
local w , h =( 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 isMouseIn ( x , y , width , height )
if ( not isCursorShowing ( ) ) then
return false
end
local sx , sy = guiGetScreenSize ( )
local cx , cy = getCursorPosition ( )
local cx , cy = ( cx * sx ), ( cy * sy )
if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + 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 ( bus , v , false )
end
end )
jobMarker = createMarker (- 2089.61 , 84.02 , 35.31 - 1 , "cylinder" , 0.8 , 0 , 255 , 0 , 0 )
setElementData ( jobMarker , "icon" , "job" )
addEventHandler ( "onClientRender" , getRootElement (), function()
if bilecikii == true then
dxDrawRectangle ( 0 * w , 0 * h , 1680 * w , 1050 * h , tocolor ( 8 , 7 , 7 , 148 ), false )
if isMouseIn ( 186 * w , 443 * h , 316 * w , 138 * h ) then
dxDrawImage ( 186 * w , 443 * h , 316 * w , 138 * h , "i/hovernormalny.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
else
dxDrawImage ( 186 * w , 443 * h , 316 * w , 138 * h , "i/normalny.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
end
if isMouseIn ( 1208 * w , 443 * h , 316 * w , 138 * h ) then
dxDrawImage ( 1208 * w , 443 * h , 316 * w , 138 * h , "i/hoverulgowy.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
else
dxDrawImage ( 1208 * w , 443 * h , 316 * w , 138 * h , "i/ulgowy.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
end
dxDrawText ( "Klient prosi o bilet " .. jakibilet , 664 * w , 396 * h , 1043 * w , 739 * h , tocolor ( 255 , 255 , 255 , 255 ), 1.00 * w , font3 , "center" , "center" , false , false , false , false , false )
end
if potwierdzExit == true then
dxDrawImage ( 667 * w , 427 * h , 349 * w , 181 * h , "i/bg_potwierdz.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
if isMouseIn ( 677 * w , 558 * h , 88 * w , 40 * h ) then
dxDrawImage ( 677 * w , 558 * h , 88 * w , 40 * h , "i/tak.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 200 ), false )
else
dxDrawImage ( 677 * w , 558 * h , 88 * w , 40 * h , "i/tak.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
end
if isMouseIn ( 918 * w , 558 * h , 88 * w , 40 * h ) then
dxDrawImage ( 918 * w , 558 * h , 88 * w , 40 * h , "i/nie.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 200 ), false )
else
dxDrawImage ( 918 * w , 558 * h , 88 * w , 40 * h , "i/nie.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
end
dxDrawText ( "Jeste? pewny/a ?e chcesz zako?czy? prace?" , 694 * w , 451 * h , 989 * w , 543 * h , tocolor ( 255 , 255 , 255 , 255 ), 1.00 * w , font , "center" , "center" , false , false , false , false , false )
end
if menuJob == true then
dxDrawImage ( 549 * w , 345 * h , 578 * w , 362 * h , "i/bg.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
dxDrawImage ( 865 * w , 378 * h , 229 * w , 132 * h , "i/jobimg.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false ) -- zdj pracy
if isMouseIn ( 574 * w , 643 * h , 101 * w , 38 * h ) then
dxDrawImage ( 574 * w , 643 * h , 101 * w , 38 * h , "i/btn.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 200 ), false )
else
dxDrawImage ( 574 * w , 643 * h , 101 * w , 38 * h , "i/btn.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
end
if isMouseIn ( 737 * w , 643 * h , 101 * w , 38 * h ) then
dxDrawImage ( 737 * w , 643 * h , 101 * w , 38 * h , "i/btn.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 200 ), false )
else
dxDrawImage ( 737 * w , 643 * h , 101 * w , 38 * h , "i/btn.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
end
dxDrawText ( "Twoje statystyki" , 916 * w , 528 * h , 1047 * w , 554 * h , tocolor ( 255 , 255 , 255 , 255 ), 1.00 * w , font3 , "center" , "center" , false , false , true , false , false )
dxDrawText ( "Zaliczonych przystank?w: #70DB93" .. getElementData ( localPlayer , "player:topautobusy" ), 873 * w , 564 * h , 1091 * w , 681 * h , tocolor ( 255 , 255 , 255 , 255 ), 1.00 * w , font2 , "center" , "top" , false , false , true , true , false )
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 * w , 396 * h , 847 * w , 558 * h , tocolor ( 255 , 255 , 255 , 255 ), 1.00 * w , font2 , "center" , "center" , false , true , false , false , false )
dxDrawText ( "Rozpocznij" , 573 * w , 643 * h , 675 * w , 681 * h , tocolor ( 255 , 255 , 255 , 255 ), 1.00 * w , font2 , "center" , "center" , false , false , false , false , false )
dxDrawText ( "Zamknij" , 736 * w , 643 * h , 838 * w , 681 * h , tocolor ( 255 , 255 , 255 , 255 ), 1.00 * w , font2 , "center" , "center" , false , false , false , false , false )
end
end )
function endJobExitVeh ()
setElementData ( localPlayer , "player:job" , false )
triggerServerEvent ( "autobus:delete" , localPlayer )
unbindKey ( "F" )
unbindKey ( "enter" )
setTimer (function()
setElementPosition ( localPlayer , - 2089.64 , 87.49 , 35.32 )
end , 200 , 1 )
if przystanek and isElement ( przystanek ) then
destroyElement ( przystanek )
przystanek = nil
end
if przystanekTarget and isElement ( przystanekTarget ) then
destroyElement ( przystanekTarget )
przystanekTarget = nil
przystanekTarget = 0
end
if blip and isElement ( blip ) then
destroyElement ( blip )
blip = nil
end
end
function endJob ()
setElementData ( localPlayer , "player:job" , false )
triggerServerEvent ( "autobus:delete" , localPlayer )
unbindKey ( "F" )
unbindKey ( "enter" )
setTimer (function()
end , 200 , 1 )
if przystanek and isElement ( przystanek ) then
destroyElement ( przystanek )
przystanek = nil
end
if przystanekTarget and isElement ( przystanekTarget ) then
destroyElement ( przystanekTarget )
przystanekTarget = nil
przystanekTarget = 0
end
if blip and isElement ( blip ) then
destroyElement ( blip )
blip = nil
end
end
function hitPrzystanek ( el , md )
if el ~= localPlayer or not md then return end
local maxTarget = #przystanki
if przystanekTarget > maxTarget and getPedOccupiedVehicle ( el ) then return end
if przystanekTarget == maxTarget and not getPedOccupiedVehicle ( el ) then 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 ( przystanek ) then
destroyElement ( przystanek )
przystanek = nil
end
if blip and isElement ( blip ) then
destroyElement ( blip )
blip = nil
end
przystanekTarget = przystanekTarget + 1
przystanek = createMarker ( przystanki [ przystanekTarget ][ 1 ], przystanki [ przystanekTarget ][ 2 ], przystanki [ przystanekTarget ][ 3 ]- 0.95 , "cylinder" , 2 , 255 , 255 , 255 , 0 )
blip = createBlip ( przystanki [ przystanekTarget ][ 1 ], przystanki [ przystanekTarget ][ 2 ], przystanki [ przystanekTarget ][ 3 ], 41 )
setElementData ( przystanek , "icon" , "busprzystanek" )
addEventHandler ( "onClientMarkerHit" , przystanek , hitPrzystanek )
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()
end , 200 , 1 )
if przystanek and isElement ( przystanek ) then
destroyElement ( przystanek )
przystanek = nil
end
if przystanekTarget and isElement ( przystanekTarget ) then
destroyElement ( przystanekTarget )
przystanekTarget = nil
przystanekTarget = 0
end
if blip and isElement ( blip ) then
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 ( el ) then 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 * w , 643 * h , 101 * w , 38 * h ) then
startEndJob ()
if menuJob == true then
menuJob = false
clickJob = false
showCursor ( false )
end
elseif isMouseIn ( 737 * w , 643 * h , 101 * w , 38 * h ) then
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 * w , 558 * h , 88 * w , 40 * h ) then
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 * w , 558 * h , 88 * w , 40 * h ) then
showCursor ( false )
potwierdzExit = false
end
end
if bileciki and btn == "left" and state == "down" then
if isMouseIn ( 186 * w , 443 * h , 316 * w , 138 * h ) then
if jakibilet ~= "normalny" then
triggerEvent ( "createAlert" , localPlayer , "error" , "Poda?e? z?y bilet klientowi!" )
fadeCamera ( false , 1.0 , 0 , 0 , 0 )
bilecikii = false
bileciki = false
setTimer (function()
fadeCamera ( true , 1.0 , 0 , 0 , 0 )
bilecikii = true
bileciki = true
randomBilet ()
ileos = ileos - 1
if ileos == 0 then bileciki = false bilecikii = false showCursor ( false ) setElementFrozen ( getPedOccupiedVehicle ( localPlayer ), false ) showPrzystanek () triggerServerEvent ( "autobusy:topkazapis" , localPlayer , 1 ) end
end , 1000 , 1 )
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 ( false , 1.0 , 0 , 0 , 0 )
bilecikii = false
bileciki = false
setTimer (function()
fadeCamera ( true , 1.0 , 0 , 0 , 0 )
bilecikii = true
bileciki = true
randomBilet ()
ileos = ileos - 1
if ileos == 0 then bileciki = false bilecikii = false showCursor ( false ) setElementFrozen ( getPedOccupiedVehicle ( localPlayer ), false ) showPrzystanek () triggerServerEvent ( "autobusy:topkazapis" , localPlayer , 1 ) end
end , 1000 , 1 )
elseif isMouseIn ( 1208 * w , 443 * h , 316 * w , 138 * h ) then
if jakibilet ~= "ulgowy" then
triggerEvent ( "createAlert" , localPlayer , "error" , "Poda?e? z?y bilet klientowi!" )
fadeCamera ( false , 1.0 , 0 , 0 , 0 )
bilecikii = false
bileciki = false
setTimer (function()
fadeCamera ( true , 1.0 , 0 , 0 , 0 )
bilecikii = true
bileciki = true
randomBilet ()
ileos = ileos - 1
if ileos == 0 then bileciki = false bilecikii = false showCursor ( false ) setElementFrozen ( getPedOccupiedVehicle ( localPlayer ), false ) showPrzystanek () triggerServerEvent ( "autobusy:topkazapis" , localPlayer , 1 ) end
end , 1000 , 1 )
return
end
triggerServerEvent ( "job:wyplata" , localPlayer , "Autobusy" )
fadeCamera ( false , 1.0 , 0 , 0 , 0 )
bilecikii = false
bileciki = false
setTimer (function()
fadeCamera ( true , 1.0 , 0 , 0 , 0 )
bilecikii = true
bileciki = true
randomBilet ()
ileos = ileos - 1
if ileos == 0 then bileciki = false bilecikii = false showCursor ( false ) setElementFrozen ( getPedOccupiedVehicle ( localPlayer ), false ) showPrzystanek () triggerServerEvent ( "autobusy:topkazapis" , localPlayer , 1 ) end
end , 1000 , 1 )
end
end
end )
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
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
Wysłany: 2019-02-20, 18:19
smigi
Wiek: 23 Na forum: 3367 dni Posty: 60
Nick w MP: smigi
Piwa : 2
Adis.exe ,
mam normalnie notyfikacje ale mi tam nie pokazuje napis?w
Wysłany: 2019-02-20, 18:36
Query
SyndicateMTA
Wiek: 24 Na forum: 3071 dni Posty: 319
Nick w MP: Query
Piwa : 5257
zle eksport
Ostatnio zmieniony przez Query 2019-02-20, 18:46, w całości zmieniany 1 raz
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
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
Wysłany: 2019-02-20, 18:46
Query
SyndicateMTA
Wiek: 24 Na forum: 3071 dni Posty: 319
Nick w MP: Query
Piwa : 5257
Adis.exe , mogl to tez triggerem wykona? ;v
Wysłany: 2019-02-20, 18:55
smigi
Wiek: 23 Na forum: 3367 dni Posty: 60
Nick w MP: smigi
Piwa : 2
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
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
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
Tagi: notyfiakcje
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: