HEATEX
Wiek: 25 Na forum: 2251 dni Posty: 109
Nick w MP: HEATEX
Piwa : 1336
Witam mam problem z zawiadomieniami otoz jak wpisuje /997 /998 /999 nic sie nie dziele skrypt z paczki pystories
[ Dodano : 2020-05-07, 21:31 ]
s.lua
function policja ( plr )
uid = getElementData ( plr , 'player:sid' )
if not uid then return end
if getElementData ( plr , "player:faction" ) 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 [ "pystories-db" ]: dbSet ( "insert into Zawiadomienia values(null,NOW(),?,?,?,?,?,0,0)" , uid , getPlayerSerial ( plr ), miejsce , toJSON ({ x , y , z }, true ), "PDSA" )
id = exports [ "pystories-db" ]: dbGet ( "SELECT MAX(ID) as id FROM Zawiadomienia" )[ 1 ]. id
for i , v in ipairs ( getElementsByType ( "player" )) do
if getElementData ( v , "player:faction" )== "SAPD" 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:sid' )
if not uid then return end
if getElementData ( plr , "player:faction" ) 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 [ "pystories-db" ]: dbSet ( "insert into Zawiadomienia values(null,NOW(),?,?,?,?,?,0,0)" , uid , getPlayerSerial ( plr ), miejsce , toJSON ({ x , y , z }, true ), "SAFD" )
id = exports [ "pystories-db" ]: dbGet ( "SELECT MAX(ID) as id FROM Zawiadomienia" )[ 1 ]. id
for i , v in ipairs ( getElementsByType ( "player" )) do
if getElementData ( v , "player:faction" )== "SAFD" 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:sid' )
if not uid then return end
if getElementData ( plr , "player:faction" ) 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 [ "pystories-db" ]: dbSet ( "insert into Zawiadomienia values(null,NOW(),?,?,?,?,?,0,0)" , uid , getPlayerSerial ( plr ), miejsce , toJSON ({ x , y , z }, true ), "SAMD" )
id = exports [ "pystories-db" ]: dbGet ( "SELECT MAX(ID) as id FROM Zawiadomienia" )[ 1 ]. id
for i , v in ipairs ( getElementsByType ( "player" )) do
if getElementData ( v , "player:faction" )== "SAMD" 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 ={
[ "SAPD" ]= 75000 ,
[ "SAFD" ]= 70000 ,
[ "SAMD" ]= 80000 ,
[ "TSA" ]= 35000 ,
[ "RASA" ]= 35000 ,
}
function odebranoZawiadomienie ( id )
co = getElementData ( client , "player:faction" )
ilosckasy = iloscKasy [ co ]
givePlayerMoney ( client , ilosckasy )
outputChatBox ( "Otrzyma?e? " .. ilosckasy .. "pln a odebranie zg?oszenia!" , client , 0 , 255 , 0 )
uid = getElementData ( client , 'player:sid' )
exports [ "pystories-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:faction" )== 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 )
c.lua
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 , 12 )
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:faction" ) 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 )