Wysłany: 2018-07-31, 11:38
BoomEq
Wiek: 35 Na forum: 3522 dni Posty: 101
Nick w MP: BoomEqqq
Piwa : 20
db3 :
Kod: s.lua:94: attempt to get length of local 'q' (a boolean value)
s:
function policja ( plr , cmd ,...)
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
local opis = table . concat ({ ... }, " " )
if not opis or ( string . len ( opis )) > 255 or ( string . len ( opis )) < 1 then outputChatBox ( "D?ugo?? opisu zdarzenia nie mo?e mie? mniej ni? 1 znak?w / wi?cej ni? 255 znak?w!" , plr , 255 , 0 , 0 ) return 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 )
lokalizacja = dokladne .. ", " .. miejsce
exports [ "ogrpg-db" ]: dbSet ( "insert into Zawiadomienia (data,uid,serial,miejsce,pozycja,typ,opis,nick) values(NOW(),?,?,?,?,?,?,?)" , uid , getPlayerSerial ( plr ), lokalizacja , toJSON ({ x , y , z }, true ), "LSPD" , string . gsub ( opis , '#%x%x%x%x%x%x' , '' ), getPlayerName ( plr ): gsub ( "#%x%x%x%x%x%x" , "" ))
id = exports [ "ogrpg-db" ]: dbGet ( "SELECT MAX(ID) as id FROM Zawiadomienia" )[ 1 ]. id
for i , v in ipairs ( getElementsByType ( "player" )) do
if getElementData ( v , "player:duty" )== "LSPD" 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:LSPD: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 , cmd ,...)
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
local opis = table . concat ({ ... }, " " )
if not opis or ( string . len ( opis )) > 255 or ( string . len ( opis )) < 10 then outputChatBox ( "D?ugo?? opisu zdarzenia nie mo?e mie? mniej ni? 10 znak?w / wi?cej ni? 255 znak?w!" , plr , 255 , 0 , 0 ) return 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 )
lokalizacja = dokladne .. ", " .. miejsce
exports [ "ogrpg-db" ]: dbSet ( "insert into Zawiadomienia (data,uid,serial,miejsce,pozycja,typ,opis,nick) values(NOW(),?,?,?,?,?,?,?)" , uid , getPlayerSerial ( plr ), lokalizacja , toJSON ({ x , y , z }, true ), "LVFD" , string . gsub ( opis , '#%x%x%x%x%x%x' , '' ), getPlayerName ( plr ): gsub ( "#%x%x%x%x%x%x" , "" ))
id = exports [ "ogrpg-db" ]: dbGet ( "SELECT MAX(ID) as id FROM Zawiadomienia" )[ 1 ]. id
for i , v in ipairs ( getElementsByType ( "player" )) do
if getElementData ( v , "player:duty" )== "LVFD" 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:LVFD: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 , cmd ,...)
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
local opis = table . concat ({ ... }, " " )
if not opis or ( string . len ( opis )) > 255 or ( string . len ( opis )) < 10 then outputChatBox ( "D?ugo?? opisu zdarzenia nie mo?e mie? mniej ni? 10 znak?w / wi?cej ni? 255 znak?w!" , plr , 255 , 0 , 0 ) return 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 )
lokalizacja = dokladne .. ", " .. miejsce
exports [ "ogrpg-db" ]: dbSet ( "insert into Zawiadomienia (data,uid,serial,miejsce,pozycja,typ,opis,nick) values(NOW(),?,?,?,?,?,?,?)" , uid , getPlayerSerial ( plr ), lokalizacja , toJSON ({ x , y , z }, true ), "SAMD" , string . gsub ( opis , '#%x%x%x%x%x%x' , '' ), getPlayerName ( plr ): gsub ( "#%x%x%x%x%x%x" , "" ))
id = exports [ "ogrpg-db" ]: dbGet ( "SELECT MAX(ID) as id FROM Zawiadomienia" )[ 1 ]. id
for i , v in ipairs ( getElementsByType ( "player" )) do
if getElementData ( v , "player:duty" )== "LVMD" 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:LVMD: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 )
function zgloszenia ( plr )
if not getElementData ( plr , "player:duty" ) then return end
local q = exports [ "ogrpg-db" ]: dbSet ( "select * from Zawiadomienia where typ = ? and (TIMEDIFF(now(),data)/60) < 15" , getElementData ( plr , "player:duty" ))
if #q < 1 then outputChatBox("Do twojej frakcji nie wys?ano ?adnego zg?oszenia w ci?gu 15 minut!", plr, 255, 0, 0) return end
triggerClientEvent ( plr , "ZAWIADOMIENIA:SHOWLIST" , plr , q , getElementData ( plr , "player:duty" ))
end
addCommandHandler ( "zgloszenia" , zgloszenia )
function taxi ( 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 [ "ogrpg-db" ]: dbSet ( "insert into Zawiadomienia values(null,NOW(),?,?,?,?,?,0,0)" , uid , getPlayerSerial ( plr ), miejsce , toJSON ({ x , y , z }, true ), "TAXI" )
id = exports [ "ogrpg-db" ]: dbGet ( "SELECT MAX(ID) as id FROM Zawiadomienia" )[ 1 ]. id
for i , v in ipairs ( getElementsByType ( "player" )) do
if getElementData ( v , "player:duty" )== "TAXI" then
outputChatBox ( getPlayerName ( plr ): gsub ( "#%x%x%x%x%x%x" , "" ).. " wezwa? pomoc drogow?, jed? do " .. dokladne .. " (" .. miejsce .. "). (ID: " .. tostring ( id ).. ")" , v , 255 , 64 , 0 )
triggerClientEvent ( v , "ZAWIADOMIENIA:TAXI:pokaz" , resourceRoot , x , y , z , id )
end
end
setElementData ( plr , "antySpamzgloszenia" , getTickCount ())
outputChatBox ( "Wezwa?e? TAXI! Wkr?tce si? tu kto? pojawi!" , plr , 255 , 64 , 0 )
end
addCommandHandler ( "taxi" , taxi )
iloscKasy ={
[ "LSPD" ]= 100 ,
[ "LVFD" ]= 100 ,
[ "LVMD" ]= 100 ,
[ "TAXI" ]= 100 ,
}
function odebranoZawiadomienie ( id )
co = getElementData ( client , "player:duty" )
ilosckasy = iloscKasy [ co ]
givePlayerMoney ( client , ilosckasy )
outputChatBox ( "Otrzyma?e? " .. ilosckasy .. " PLN za odebranie zg?oszenia!" , client , 0 , 255 , 0 )
uid = getElementData ( client , 'player:uid' )
exports [ "ogrpg-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:LSPD:usun" , resourceRoot , id )
end
end
end
addEvent ( "ZAWIADOMIENIA:Odebrane" , true )
addEventHandler ( "ZAWIADOMIENIA:Odebrane" , resourceRoot , odebranoZawiadomienie )
function deleteZawiadomienie ( id )
exports [ "ogrpg-db" ]: dbSet ( "delete from Zawiadomienia where id=?" , id )
end
addEvent ( "ZAWIADOMIENIA:deletedbid" , true )
addEventHandler ( "ZAWIADOMIENIA:deletedbid" , root , deleteZawiadomienie )
function odpowiedzZawiadomienie ( odpowiadajacy , ...)
local text = table . concat ({ ... }, " " )
outputChatBox ( "Odpowied? od gracza " .. getPlayerName ( odpowiadajacy ): gsub ( "#%x%x%x%x%x%x" , "" ).. " (" .. odpowiadajacy : getData ( "player:duty" ).. "): " .. text .. "" , client , 0 , 255 , 0 )
outputChatBox ( "Odpowied? do gracza " .. getPlayerName ( client ): gsub ( "#%x%x%x%x%x%x" , "" ).. ": " .. text .. "" , odpowiadajacy , 0 , 255 , 0 )
end
addEvent ( "ZAWIADOMIENIA:odp" , true )
addEventHandler ( "ZAWIADOMIENIA:odp" , root , odpowiedzZawiadomienie )
94 linijka:
if #q < 1 then outputChatBox("Do twojej frakcji nie wys?ano ?adnego zg?oszenia w ci?gu 15 minut!", plr, 255, 0, 0) return end
Wysłany: 2018-07-31, 12:19
Query
SyndicateMTA
Wiek: 24 Na forum: 3072 dni Posty: 319
Nick w MP: Query
Piwa : 5257
spr?buj tak:
if #q < 15 then outputChatBox("Do twojej frakcji nie wys?ano ?adnego zg?oszenia w ci?gu 15 minut!", plr, 255, 0, 0) return end
Wysłany: 2018-07-31, 12:29
Adaskokieblasko
Wiek: 23 Na forum: 2954 dni Posty: 101
Piwa : 18
Spr?buj zamieni? linijk? wy?ej na t?
local q = exports [ "ogrpg-db" ]: dbSet ( "select * from Zawiadomienia where typ = ? and (TIMEDIFF(now(),data)/60) < 15" , getElementData ( plr , "player:duty" ))
Wysłany: 2018-07-31, 15:12
BoomEq
Wiek: 35 Na forum: 3522 dni Posty: 101
Nick w MP: BoomEqqq
Piwa : 20
Teraz takie cos wyskakuje :
Kod: c.lua:198: bad argument #1 to ?pairs' (table expected, got boolean)
client :
local screenW , screenH = guiGetScreenSize ()
mojeW , mojeH = 1366 , 768
sW , sH = guiGetScreenSize ()
w , h = ( sW / mojeW ), ( sH / mojeH )
sx , sy = guiGetScreenSize ()
function isMouseIn ( psx , psy , pssx , pssy , abx , aby )
if not isCursorShowing () then return end
cx , cy = getCursorPosition ()
cx , cy = cx * sx , cy * sy
if cx >= psx and cx <= psx + pssx and cy >= psy and cy <= psy + pssy then
return true , cx , cy
else
return false
end
end
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:LSPD:pokaz" , true )
addEventHandler ( "ZAWIADOMIENIA:LSPD:pokaz" , resourceRoot , function( x , y , z , id )
nowyCel ( x , y , z , id , "LSPD" , 41 )
end )
addEvent ( "ZAWIADOMIENIA:LSPD:usun" , true )
addEventHandler ( "ZAWIADOMIENIA:LSPD:usun" , resourceRoot , function( id )
destroyElement ( cele [ id ][ 1 ])
destroyElement ( cele [ id ][ 2 ])
cele [ id ]= nil
end )
addEvent ( "ZAWIADOMIENIA:LVFD:pokaz" , true )
addEventHandler ( "ZAWIADOMIENIA:LVFD:pokaz" , resourceRoot , function( x , y , z , id )
nowyCel ( x , y , z , id , "LVFD" , 41 )
end )
addEvent ( "ZAWIADOMIENIA:LVFD:usun" , true )
addEventHandler ( "ZAWIADOMIENIA:LVFD: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:LVMD:pokaz" , true )
addEventHandler ( "ZAWIADOMIENIA:LVMD:pokaz" , resourceRoot , function( x , y , z , id )
nowyCel ( x , y , z , id , "LVMD" , 41 )
end )
addEvent ( "ZAWIADOMIENIA:LVMD:usun" , true )
addEventHandler ( "ZAWIADOMIENIA:LVMD:usun" , resourceRoot , function( id )
destroyElement ( cele [ id ][ 1 ])
destroyElement ( cele [ id ][ 2 ])
cele [ id ]= nil
end )
function render ()
if not frakcja then return end
dxDrawRectangle ( 326 * w , 245 * h , 715 * w , 279 * h , tocolor ( 0 , 0 , 0 , 170 ), false )
dxDrawText ( "Lista zg?osze?:\nFrakcja: " .. frakcja .. "" , 325 * w , 251 , 1041 * w , 284 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , dxfont0_1 , "center" , "bottom" , false , false , false , false , false )
dxDrawLine (( 334 - 1 )* w , ( 475 - 1 )* h , ( 334 - 1 )* w , 514 * h , tocolor ( 54 , 57 , 55 , 200 ), 1 , false )
dxDrawLine ( 500 * w , ( 475 - 1 )* h , ( 334 - 1 )* w , ( 475 - 1 )* h , tocolor ( 54 , 57 , 55 , 200 ), 1 , false )
dxDrawLine (( 334 - 1 )* w , 514 * h , 500 * w , 514 * h , tocolor ( 54 , 57 , 55 , 200 ), 1 , false )
dxDrawLine ( 500 * w , 514 * h , 500 * w , ( 475 - 1 )* h , tocolor ( 54 , 57 , 55 , 200 ), 1 , false )
dxDrawRectangle ( 334 * w , 475 * h , 166 * w , 39 * h , tocolor ( 0 , 0 , 0 , 200 ), false )
dxDrawLine (( 600 - 1 )* w , ( 475 - 1 )* h , ( 600 - 1 )* w , 514 * h , tocolor ( 54 , 57 , 55 , 200 ), 1 , false )
dxDrawLine ( 766 * w , ( 475 - 1 )* h , ( 600 - 1 )* w , ( 475 - 1 )* h , tocolor ( 54 , 57 , 55 , 200 ), 1 , false )
dxDrawLine (( 600 - 1 )* w , 514 * h , 766 * w , 514 * h , tocolor ( 54 , 57 , 55 , 200 ), 1 , false )
dxDrawLine ( 766 * w , 514 * h , 766 * w , ( 475 - 1 )* h , tocolor ( 54 , 57 , 55 , 200 ), 1 , false )
dxDrawRectangle ( 600 * w , 475 * h , 166 * w , 39 * h , tocolor ( 0 , 0 , 0 , 200 ), false )
dxDrawLine (( 865 - 1 )* w , ( 475 - 1 )* h , ( 865 - 1 )* w , 514 * h , tocolor ( 54 , 57 , 55 , 200 ), 1 , false )
dxDrawLine ( 1031 * w , ( 475 - 1 )* h , ( 865 - 1 )* w , ( 475 - 1 )* h , tocolor ( 54 , 57 , 55 , 200 ), 1 , false )
dxDrawLine (( 865 - 1 )* w , 514 * h , 1031 * w , 514 * h , tocolor ( 54 , 57 , 55 , 200 ), 1 , false )
dxDrawLine ( 1031 * w , 514 * h , 1031 * w , ( 475 - 1 )* h , tocolor ( 54 , 57 , 55 , 200 ), 1 , false )
dxDrawRectangle ( 865 * w , 475 * h , 166 * w , 39 * h , tocolor ( 0 , 0 , 0 , 200 ), false )
if isMouseIn ( 334 * w , 475 * h , 166 * w , 39 * h ) then
dxDrawRectangle ( 334 * w , 514 * h , 166 * w , 2 * h , tocolor ( 36 , 175 , 178 , 170 ), false )
else
dxDrawRectangle ( 334 * w , 514 * h , 166 * w , 2 * h , tocolor ( 255 , 255 , 255 , 170 ), false )
end
if isMouseIn ( 600 * w , 475 * h , 166 * w , 39 * h ) then
dxDrawRectangle ( 600 * w , 514 * h , 166 * w , 2 * h , tocolor ( 36 , 175 , 178 , 170 ), false )
else
dxDrawRectangle ( 600 * w , 514 * h , 166 * w , 2 * h , tocolor ( 255 , 255 , 255 , 170 ), false )
end
if isMouseIn ( 865 * w , 475 * h , 166 * w , 39 * h ) then
dxDrawRectangle ( 865 * w , 514 * h , 166 * w , 2 * h , tocolor ( 36 , 175 , 178 , 170 ), false )
else
dxDrawRectangle ( 865 * w , 514 * h , 166 * w , 2 * h , tocolor ( 255 , 255 , 255 , 170 ), false )
end
dxDrawText ( "Wy?lij odpowied?" , 334 * w , 475 * h , 500 * w , 514 * h , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , dxfont0_1 , "center" , "center" , false , false , false , false , false )
dxDrawText ( "Usu? zg?oszenie" , 600 * w , 475 * h , 766 * w , 514 * h , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , dxfont0_1 , "center" , "center" , false , false , false , false , false )
dxDrawText ( "Zamknij" , 865 * w , 475 * h , 1031 * w , 514 * h , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , dxfont0_1 , "center" , "center" , false , false , false , false , false )
--
if editing then
dxDrawRectangle ( 556 * w , 94 * h , 254 * w , 107 * h , tocolor ( 0 , 0 , 0 , 200 ), false )
dxDrawRectangle ( 556 * w , 94 * h , 254 * w , 16 * h , tocolor ( 36 , 175 , 178 , 200 ), true )
dxDrawText ( "Wy?lij odpowied?" , 556 * w , 94 * h , 810 * w , 110 * h , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , dxfont0_1 , "center" , "center" , false , false , true , false , false )
dxDrawRectangle ( 560 * w , 171 * h , 80 * w , 25 * h , tocolor ( 0 , 0 , 0 , 200 ), true )
dxDrawText ( "Zatwierd?" , 560 * w , 173 * h , 640 * w , 191 * h , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , dxfont0_1 , "center" , "center" , false , false , true , false , false )
dxDrawRectangle ( 726 * w , 171 * h , 80 * w , 25 * h , tocolor ( 0 , 0 , 0 , 200 ), true )
dxDrawText ( "Anuluj" , 726 * w , 173 * h , 806 * w , 191 * h , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , dxfont0_1 , "center" , "center" , false , false , true , false , false )
dxDrawText ( "Odpowied?:" , 560 * w , 115 * h , 711 * w , 135 * h , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , dxfont0_1 , "left" , "center" , false , false , true , false , false )
end
end
function getPlayerFromUID ( uid )
for i , v in ipairs ( getElementsByType ( "player" )) do
if v : getData ( "player:uid" ) == uid then
return v
end
end
end
function click ( btn , state )
if btn == "left" and state == "down" then
if isMouseIn ( 865 * w , 475 * h , 166 * w , 39 * h ) then
removeEventHandler ( "onClientRender" , root , render )
removeEventHandler ( "onClientClick" , root , click )
gridlist : destroy ()
dxfont0_1 = nil
showCursor ( false )
elseif isMouseIn ( 600 * w , 475 * h , 166 * w , 39 * h ) then
local selectedRow = guiGridListGetSelectedItem ( gridlist )
if not selectedRow or selectedRow < 0 then return end
local dbid = guiGridListGetItemText ( gridlist , selectedRow , 5 )
guiGridListRemoveRow ( gridlist , selectedRow )
triggerServerEvent ( "ZAWIADOMIENIA:deletedbid" , localPlayer , dbid )
outputChatBox ( "Usuni?to zg?oszenie UID: " .. dbid .. "" , 0 , 255 , 0 )
elseif isMouseIn ( 334 * w , 475 * h , 166 * w , 39 * h ) then
if not isElement ( editinggui ) then
local selectedRow = guiGridListGetSelectedItem ( gridlist )
if not selectedRow or selectedRow < 0 then return end
local uid = guiGridListGetItemText ( gridlist , selectedRow , 6 )
if getPlayerFromUID ( tonumber ( uid )) then
editinggui = guiCreateEdit ( 560 * w , 140 * h , 216 * w , 21 * h , "" , false )
editing = true
else
outputChatBox ( "Ten gracz opu?ci? serwer!" , 255 , 0 , 0 )
return
end
end
elseif isMouseIn ( 560 * w , 171 * h , 80 * w , 25 * h ) and editing then
local text = guiGetText ( editinggui )
if string . len ( text ) < 1 then return end
local selectedRow = guiGridListGetSelectedItem ( gridlist )
if not selectedRow or selectedRow < 0 then return end
local uid = guiGridListGetItemText ( gridlist , selectedRow , 6 )
if getPlayerFromUID ( tonumber ( uid )) then
triggerServerEvent ( "ZAWIADOMIENIA:odp" , getPlayerFromUID ( tonumber ( uid )), localPlayer , text )
editing = false
editinggui : destroy ()
else
outputChatBox ( "Ten gracz opu?ci? serwer!" , 255 , 0 , 0 )
editing = false
editinggui : destroy ()
return
end
elseif isMouseIn ( 726 * w , 171 * h , 80 * w , 25 * h ) and editing then
editing = false
editinggui : destroy ()
end
end
end
addEvent ( "ZAWIADOMIENIA:SHOWLIST" , true )
addEventHandler ( "ZAWIADOMIENIA:SHOWLIST" , localPlayer , function( q , duty )
frakcja = duty
if not isElement ( gridlist ) then
gridlist = guiCreateGridList ( 332 * w , 288 * h , 703 * w , 179 * h , false )
guiGridListAddColumn ( gridlist , "Zg?aszaj?cy:" , 0.3 )
guiGridListAddColumn ( gridlist , "Opis zdarzenia:" , 0.2 )
guiGridListAddColumn ( gridlist , "Data:" , 0.2 )
guiGridListAddColumn ( gridlist , "Lokalizacja:" , 0.2 )
guiGridListAddColumn ( gridlist , "DBID:" , 0.1 )
guiGridListAddColumn ( gridlist , "UID:" , 0 )
dxfont0_1 = dxCreateFont ( ":PanelLogowanie/font/1.ttf" , 10 )
addEventHandler ( "onClientRender" , root , render )
addEventHandler ( "onClientClick" , root , click )
editing = false
showCursor ( true )
for i , v in ipairs ( q ) do
local row = guiGridListAddRow ( gridlist )
if getPlayerFromUID ( v [ "uid" ]) then
guiGridListSetItemText ( gridlist , row , 1 , v [ "nick" ].. " - ID: (" .. getPlayerFromUID ( v [ "uid" ]): getData ( "id" ).. ")" , false , false )
else
guiGridListSetItemText ( gridlist , row , 1 , v [ "nick" ], false , false )
end
if getPlayerFromUID ( v [ "uid" ]) then
guiGridListSetItemColor ( gridlist , row , 1 , 0 , 255 , 0 )
else
guiGridListSetItemColor ( gridlist , row , 1 , 255 , 0 , 0 )
end
guiGridListSetItemText ( gridlist , row , 2 , v [ "opis" ], false , false )
guiGridListSetItemText ( gridlist , row , 3 , v [ "data" ], false , false )
guiGridListSetItemText ( gridlist , row , 4 , v [ "miejsce" ], false , false )
guiGridListSetItemText ( gridlist , row , 5 , v [ "ID" ], false , false )
guiGridListSetItemText ( gridlist , row , 6 , v [ "uid" ], false , false )
end
end
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 )
linijka 198 :
[ Dodano : 2018-08-02, 13:58 ]
@ref
Tagi: zawiadomienia
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: