Wysłany: 2019-10-04, 18:01
Matikmontana
Modern Stories
Wiek: 22 Na forum: 2473 dni Posty: 423
Nick w MP: Mazeusz*
Piwa : 1015
Dzie? dobry wiecz?r. Mam skrypt na zawiadomienie frakcji ale gdy chce odebra? zg?oszenie komend? odbierz to nie dodaje kasy i nie znika blip.
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 )
S
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 ( "Nast?pne zg?oszenie mo?esz napisa? za: " .. 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 ( "Nast?pne zg?oszenie mo?esz napisa? za: " .. 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 ( "Nast?pne zg?oszenie mo?esz napisa? za: " .. 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" ]= 35000 ,
[ "FDSA" ]= 35000 ,
[ "MASA" ]= 35000 ,
[ "TSA" ]= 35000 ,
[ "RASA" ]= 35000 ,
}
function odebranoZawiadomienie ( id )
addCommandHandler ( "odbierz" , resourceRoot , odebranoZawiadomienie )
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 )
addCommandHandler ( "odbierz" , resourceRoot , odebranoZawiadomienie )
end
end
end
addEvent ( "ZAWIADOMIENIA:Odebrane" , true )
addEventHandler ( "ZAWIADOMIENIA:Odebrane" , resourceRoot , odebranoZawiadomienie )
addCommandHandler ( "odbierz" , resourceRoot , odebranoZawiadomienie )
Wysłany: 2019-10-04, 18:49
Wilq
Wiek: 24 Na forum: 4428 dni Posty: 3410
Piwa : 739
Co? w tej linijce masz nie tak:
addCommandHandler ( "odbierz" , resourceRoot , odebranoZawiadomienie )
Pami?taj te?, ?e to jest strona servera. Je?li wykonujesz komend? to w funkcji nie zdefiniowa?e? gracza. Jest to pierwszy argument tej?e funkcji, a u?ywasz tam tylko zmiennej 'client'.
Wysłany: 2019-10-04, 18:57
DylemaT929
Nikt
Wiek: 28 Na forum: 4041 dni Posty: 333
Nick w MP: dylemat929
Piwa : 3195
Tutaj masz co innego
nowyCel ( x , y , z , id , "SAPD" , 41 )
a tu co innnego dlatego ci nie kasuje i kasy nie dostajesz (Tutaj mi chodzi o skr?t frakcji)
if getElementData ( v , "player:duty" )== "PDSA" then
Wysłany: 2020-05-07, 21:54
HEATEX
Wiek: 25 Na forum: 2250 dni Posty: 109
Nick w MP: HEATEX
Piwa : 1336
ok teraz niby dziala ale i tak nadal nic sie nie wyswietla tylko jak jestem na sluzbie frakcji to sie wyswietla ze nie mozesz tego zrobic
Wysłany: 2020-05-07, 22:15
TheSebaPL
Mod-team
Wiek: 21 Na forum: 3098 dni Posty: 964
Piwa : 3102
HEATEX , jako? dzia?a w jakim sensie ? Jakie? b??dy /debugscript 3 czy to nie spe?nia twoich oczekiwa?.
Wysłany: 2020-05-07, 22:35
HEATEX
Wiek: 25 Na forum: 2250 dni Posty: 109
Nick w MP: HEATEX
Piwa : 1336
zamykam naprawilem wystarczylo usunac pare linijek skryptu
Tagi: zawiadomienie :: frakcji
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: