Wysłany: 2017-09-06, 17:06
Krzemo1234
Wiek: 26 Na forum: 3751 dni Posty: 387
Nick w MP: Krzemo
Piwa : 16
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 ( el ) then 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'" , 255 , 255 , 255 ) exports [ "1" ]: outputNotificationBox ( el , "Pojazdy zosta?y ju? za?adowane!" , 255 , 0 , 0 ) 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 , z = 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
Wysłany: 2017-09-06, 18:17
Kalizman
Wiek: 23 Na forum: 3651 dni Posty: 1394
Piwa : 4619
Wysłany: 2017-09-06, 22:33
Krzemo1234
Wiek: 26 Na forum: 3751 dni Posty: 387
Nick w MP: Krzemo
Piwa : 16
local cFunc ={}
local cSetting ={}
NTSClient ={}
NTSClient . __index = NTSClient
--
addEvent ( 'onClientAddNotification' , true )
--
-- send to client - triggerClientEvent ( player , 'onClientAddNotification' , player , text , 'type' )
-- send to all clients - triggerClientEvent ( root , 'onClientAddNotification' , root , text , '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_x , bg_y = 937 , 186
local x = self . sx / 2 -( bg_x / self . zoom )/ 2
if self . count == 20 and self . nts [ 1 ] then
self . fadeOut = self . nts [ 1 ]
table . remove ( self . nts , 1 )
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.05 , 0 )
dxDrawImage ( x , self . pos_y , bg_x / self . zoom , bg_y / self . zoom , self . textures [ tostring ( self . fadeOut . type )], 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 * self . fadeOut . alpha ), true )
dxDrawText ( self . fadeOut . msg , x +( bg_x / 6.25 / self . zoom ), self . posTXT_y , x +( bg_x / 7 / self . zoom )+ bg_x / self . zoom - bg_x / 5 / self . zoom , self . posTXT_y +( bg_y / self . zoom ), tocolor ( 255 , 255 , 255 , 255 * self . fadeOut . alpha ), 0.5 , self . font1 , 'center' , 'center' , true , true , true )
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.05 , 1 )
dxDrawImage ( x , self . pos_y +(( i - 1 )* 150 )/ self . zoom , bg_x / self . zoom , bg_y / self . zoom , self . textures [ tostring ( v . type )], 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 * v . alpha ), true )
dxDrawText ( v . msg , x +( bg_x / 6.25 / self . zoom ), self . posTXT_y +(( i - 1 )* 150 )/ self . zoom , x +( bg_x / 7 / self . zoom )+ bg_x / self . zoom - bg_x / 5 / self . zoom , self . posTXT_y +( bg_y / self . zoom )+(( i - 1 )* 150 )/ self . zoom , tocolor ( 255 , 255 , 255 , 255 * v . alpha ), 0.5 , self . font1 , 'center' , 'center' , true , true , true )
end
end
function NTSClient : add ( msg , type )
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 ( snd , 0.3 )
end
function NTSClient : onAddNTS ( data , type )
if not data then return end
if not type then return end
NTSClass : add ( data , type )
end
-- wywolywanie klasy
function NTSClient : constructor (...)
self . count = 280
self . fadeOut = nil
self . nts ={}
local sx , sy = guiGetScreenSize ()
self . sx , self . sy = sx , sy
self . zoom = 2.4
self . lu_start = getTickCount ()
self . pos_y , self . posTXT_y = 6 / self . zoom , 4 / 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( data , type ) self : onAddNTS ( data , type ) end
addEventHandler ( 'onClientAddNotification' , root , self . funcAddNTS )
self . renderFunc =function() self : render () end
addEventHandler ( 'onClientRender' , root , self . renderFunc )
self . tick = 10
-- outputDebugString ( '[calling] NTSClient: constructor' )
end
NTSClass = NTSClient :new()
Podpis
Jeśli ci pomogłem zostaw zimne
Wysłany: 2017-09-06, 22:35
Cjalis
Wiek: 35 Na forum: 3543 dni Posty: 26
Nick w MP: Cejot
Piwa : 36
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")
Wysłany: 2017-09-06, 22:45
.RiV
Wiek: 25 Na forum: 3587 dni Posty: 554
Nick w MP: Split
Piwa : 2596
Wysłany: 2017-09-08, 16:18
Krzemo1234
Wiek: 26 Na forum: 3751 dni Posty: 387
Nick w MP: Krzemo
Piwa : 16
Nie dzia?a og?lnie te powiadomienia s? po stronie server jak co?
Podpis
Jeśli ci pomogłem zostaw zimne
Tagi: nie :: działają :: powiadomienia
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: