Mazeusz
Wiek: 30 Na forum: 2673 dni Posty: 52
Nick w MP: Mazeusz*
Witam, korzystam z paczki yp i gdy wzywam frakcje to gracz kt?ry dojedzie na miejsce nie mo?e odebra? zg?oszenia.
Server
function policja ( plr )
uid = getElementData ( plr , 'player:uid' )
if not uid then return end
if getElementData ( plr , "player:duty" ) then
return outputChatBox ( "Nie mo?esz tego zrobi?!" , plr , 255 , 0 , 0 )
end
a =( getElementData ( plr , "antySpamzgloszenia" ) or 0 )+ 60000
b = getTickCount ()
if a > b then
return outputChatBox ( "Nie tak szybko! Poczekaj chwile z tymi zawiadomieniami (Poczekaj: " .. math . floor (( a - b )/ 1000 ).. "s)" , plr , 255 , 0 , 0 )
end
x , y , z = getElementPosition ( plr )
miejsce = getZoneName ( x , y , z )
dokladne = getZoneName ( x , y , z , true )
exports [ "tiyl-db" ]: dbSet ( "insert into Zawiadomienia values(null,NOW(),?,?,?,?,?,0,0)" , uid , getPlayerSerial ( plr ), miejsce , toJSON ({ x , y , z }, true ), "PDSA" )
id = exports [ "tiyl-db" ]: dbGet ( "SELECT MAX(ID) as id FROM Zawiadomienia" )[ 1 ]. id
for i , v in ipairs ( getElementsByType ( "player" )) do
if getElementData ( v , "player:duty" )== "PDSA" then
outputChatBox ( getPlayerName ( plr ): gsub ( "#%x%x%x%x%x%x" , "" ).. " wezwa? Policj?, jed? do " .. dokladne .. " (" .. miejsce .. ") (ID: " .. tostring ( id ).. ")" , v , 0 , 0 , 255 )
triggerClientEvent ( v , "ZAWIADOMIENIA:SAPD:pokaz" , resourceRoot , x , y , z , id )
end
end
setElementData ( plr , "antySpamzgloszenia" , getTickCount ())
outputChatBox ( "Wezwa?e? policj?! Wkr?tce si? tu zjawi jaki? patrol!" , plr , 0 , 255 , 0 )
end
addCommandHandler ( "997" , policja )
function strazpozarna ( plr )
uid = getElementData ( plr , 'player:uid' )
if not uid then return end
if getElementData ( plr , "player:duty" ) then
return outputChatBox ( "Nie mo?esz tego zrobi?!" , plr , 255 , 0 , 0 )
end
a =( getElementData ( plr , "antySpamzgloszenia" ) or 0 )+ 60000
b = getTickCount ()
if a > b then
return outputChatBox ( "Nie tak szybko! Poczekaj chwile z tymi zawiadomieniami (Poczekaj: " .. math . floor (( a - b )/ 1000 ).. "s)" , plr , 255 , 0 , 0 )
end
x , y , z = getElementPosition ( plr )
miejsce = getZoneName ( x , y , z )
dokladne = getZoneName ( x , y , z , true )
exports [ "tiyl-db" ]: dbSet ( "insert into Zawiadomienia values(null,NOW(),?,?,?,?,?,0,0)" , uid , getPlayerSerial ( plr ), miejsce , toJSON ({ x , y , z }, true ), "FDSA" )
id = exports [ "tiyl-db" ]: dbGet ( "SELECT MAX(ID) as id FROM Zawiadomienia" )[ 1 ]. id
for i , v in ipairs ( getElementsByType ( "player" )) do
if getElementData ( v , "player:duty" )== "FDSA" then
outputChatBox ( getPlayerName ( plr ): gsub ( "#%x%x%x%x%x%x" , "" ).. " wezwa? Stra? po?arn?, jed? do " .. dokladne .. " (" .. miejsce .. ") (ID: " .. tostring ( id ).. ")" , v , 0 , 255 , 0 )
triggerClientEvent ( v , "ZAWIADOMIENIA:SAFD:pokaz" , resourceRoot , x , y , z , id )
end
end
setElementData ( plr , "antySpamzgloszenia" , getTickCount ())
outputChatBox ( "Wezwa?e? stra? po?arn?! Wkr?tce si? tu kto? pojawi!" , plr , 0 , 255 , 0 )
end
addCommandHandler ( "998" , strazpozarna )
function pogotowie ( plr )
uid = getElementData ( plr , 'player:uid' )
if not uid then return end
if getElementData ( plr , "player:duty" ) then
return outputChatBox ( "Nie mo?esz tego zrobi?!" , plr , 255 , 0 , 0 )
end
a =( getElementData ( plr , "antySpamzgloszenia" ) or 0 )+ 60000
b = getTickCount ()
if a > b then
return outputChatBox ( "Nie tak szybko! Poczekaj chwile z tymi zawiadomieniami (Poczekaj: " .. math . floor (( a - b )/ 1000 ).. "s)" , plr , 255 , 0 , 0 )
end
x , y , z = getElementPosition ( plr )
miejsce = getZoneName ( x , y , z )
dokladne = getZoneName ( x , y , z , true )
exports [ "tiyl-db" ]: dbSet ( "insert into Zawiadomienia values(null,NOW(),?,?,?,?,?,0,0)" , uid , getPlayerSerial ( plr ), miejsce , toJSON ({ x , y , z }, true ), "MASA" )
id = exports [ "tiyl-db" ]: dbGet ( "SELECT MAX(ID) as id FROM Zawiadomienia" )[ 1 ]. id
for i , v in ipairs ( getElementsByType ( "player" )) do
if getElementData ( v , "player:duty" )== "MASA" then
outputChatBox ( getPlayerName ( plr ): gsub ( "#%x%x%x%x%x%x" , "" ).. " wezwa? Pogotowie, jed? do " .. dokladne .. " (" .. miejsce .. ") (ID: " .. tostring ( id ).. ")" , v , 255 , 0 , 0 )
triggerClientEvent ( v , "ZAWIADOMIENIA:MDSA:pokaz" , resourceRoot , x , y , z , id )
end
end
setElementData ( plr , "antySpamzgloszenia" , getTickCount ())
outputChatBox ( "Wezwa?e? pogotowie! Wkr?tce si? tu kto? pojawi!" , plr , 0 , 255 , 0 )
end
addCommandHandler ( "999" , pogotowie )
iloscKasy ={
[ "PDSA" ]= 55000 ,
[ "FDSA" ]= 55000 ,
[ "MASA" ]= 55000 ,
[ "TSA" ]= 55000 ,
[ "RASA" ]= 55000 ,
}
function odebranoZawiadomienie ( id )
co = getElementData ( client , "player:duty" )
ilosckasy = iloscKasy [ co ]
givePlayerMoney ( client , ilosckasy )
outputChatBox ( "Otrzyma?e? " .. ilosckasy .. "pln a odebranie zg?oszenia!" , client , 0 , 255 , 0 )
uid = getElementData ( client , 'player:uid' )
exports [ "tiyl-db" ]: dbSet ( "update Zawiadomienia set odebral=?,odebral_data=now() where ID=?" , uid , id )
x , y , z = getElementPosition ( client )
miejsce = getZoneName ( x , y , z )
dokladne = getZoneName ( x , y , z , true )
tekst = getPlayerName ( client ): gsub ( "#%x%x%x%x%x%x" , "" ).. " dojecha? na miejsce ( " .. dokladne .. ", " .. miejsce .. " ) zg?oszenia ID: " .. id
for i , v in ipairs ( getElementsByType ( "player" )) do
if getElementData ( v , "player:duty" )== co then
outputChatBox ( tekst , v , 0 , 255 , 0 )
triggerClientEvent ( v , "ZAWIADOMIENIA:SAPD:usun" , resourceRoot , id )
end
end
end
addEvent ( "ZAWIADOMIENIA:Odebrane" , true )
addEventHandler ( "ZAWIADOMIENIA:Odebrane" , resourceRoot , odebranoZawiadomienie )
Klient
cele ={}
function nowyCel ( x , y , z , id , frakcja , blip )
col = createColSphere ( x , y , z , 25 )
setElementData ( col , "zawiadomienie" , true , false )
setElementData ( col , "frakcja" , frakcja , false )
setElementData ( col , "id" , id , false )
blip = createBlipAttachedTo ( col , blip )
cele [ id ]={ col , blip }
end
addEvent ( "ZAWIADOMIENIA:SAPD:pokaz" , true )
addEventHandler ( "ZAWIADOMIENIA:SAPD:pokaz" , resourceRoot , function( x , y , z , id )
nowyCel ( x , y , z , id , "SAPD" , 41 )
end )
addEvent ( "ZAWIADOMIENIA:SAPD:usun" , true )
addEventHandler ( "ZAWIADOMIENIA:SAPD:usun" , resourceRoot , function( id )
destroyElement ( cele [ id ][ 1 ])
destroyElement ( cele [ id ][ 2 ])
cele [ id ]= nil
end )
addEvent ( "ZAWIADOMIENIA:SAFD:pokaz" , true )
addEventHandler ( "ZAWIADOMIENIA:SAFD:pokaz" , resourceRoot , function( x , y , z , id )
nowyCel ( x , y , z , id , "SAFD" , 41 )
end )
addEvent ( "ZAWIADOMIENIA:SAFD:usun" , true )
addEventHandler ( "ZAWIADOMIENIA:SAFD:usun" , resourceRoot , function( id )
destroyElement ( cele [ id ][ 1 ])
destroyElement ( cele [ id ][ 2 ])
cele [ id ]= nil
end )
addEvent ( "ZAWIADOMIENIA:TAXI:pokaz" , true )
addEventHandler ( "ZAWIADOMIENIA:TAXI:pokaz" , resourceRoot , function( x , y , z , id )
nowyCel ( x , y , z , id , "TAXI" , 41 )
end )
addEvent ( "ZAWIADOMIENIA:TAXI:usun" , true )
addEventHandler ( "ZAWIADOMIENIA:TAXI:usun" , resourceRoot , function( id )
destroyElement ( cele [ id ][ 1 ])
destroyElement ( cele [ id ][ 2 ])
cele [ id ]= nil
end )
addEvent ( "ZAWIADOMIENIA:MDSA:pokaz" , true )
addEventHandler ( "ZAWIADOMIENIA:MDSA:pokaz" , resourceRoot , function( x , y , z , id )
nowyCel ( x , y , z , id , "SAMD" , 41 )
end )
addEvent ( "ZAWIADOMIENIA:MDSA:usun" , true )
addEventHandler ( "ZAWIADOMIENIA:MDSA:usun" , resourceRoot , function( id )
destroyElement ( cele [ id ][ 1 ])
destroyElement ( cele [ id ][ 2 ])
cele [ id ]= nil
end )
addEvent ( "ZAWIADOMIENIA:SARH:pokaz" , true )
addEventHandler ( "ZAWIADOMIENIA:SARH:pokaz" , resourceRoot , function( x , y , z , id )
nowyCel ( x , y , z , id , "SARH" , 41 )
end )
addEvent ( "ZAWIADOMIENIA:SARH:usun" , true )
addEventHandler ( "ZAWIADOMIENIA:SARH:usun" , resourceRoot , function( id )
destroyElement ( cele [ id ][ 1 ])
destroyElement ( cele [ id ][ 2 ])
cele [ id ]= nil
end )
function onClientColShapeHit ( theElement , matchingDimension )
if ( theElement == localPlayer ) then
if getElementData ( source , "frakcja" )== getElementData ( localPlayer , "player:duty" ) then
id = getElementData ( source , "id" )
destroyElement ( cele [ id ][ 1 ])
destroyElement ( cele [ id ][ 2 ])
triggerServerEvent ( "ZAWIADOMIENIA:Odebrane" , getRootElement (), id )
end
end
end
addEventHandler ( "onClientColShapeHit" , resourceRoot , onClientColShapeHit )