Wysłany: 2018-08-06, 17:06
CloakeR
Leniwiec
Wiek: 22 Na forum: 3091 dni Posty: 26
Nick w MP: CloakeR
Piwa : 3
Wi?c, pr?buje przenie?? system wzywania z ITS 2017 na Pystories 3.0
Wi?c typowo "elementdaty" zosta?y zmienione na odpowiadaj?ce byciu na "s?u?bie" w frakcji, jak i te? rozwi?za?em problem z "font'em". tylko zacz?? pojawia? si? nowy problem, polegaj?cy na tym ?e nie pojawiaj? si? zg?oszenia (mimo tego ?e s? zapisywane w bazie danych) jak i te? pojawia si? b??d w DS3:
Kod: ERROR: (?cie?ka skryptu)\iyw_zawiadomienia\c.lua:209: bad argument #1 od 'ipars' (table expected, got boolean)
tak wygl?da kawa?ek kodu gdzie wyst?puje b??d:
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 , "SID:" , 0 )
dxfont0_1 = dxCreateFont ( ":pystories-logging/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 [ "sid" ]) then
guiGridListSetItemText ( gridlist , row , 1 , v [ "nick" ].. " - ID: (" .. getPlayerFromUID ( v [ "sid" ]): getData ( "id" ).. ")" , false , false )
else
guiGridListSetItemText ( gridlist , row , 1 , v [ "nick" ], false , false )
end
if getPlayerFromUID ( v [ "sid" ]) 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 [ "sid" ], false , false )
end
end
end )
Sam nie potrafi? doj?? do wyst?powania b??du, wi?c prosz? o pomoc w naprawie kodu,
PS: Skrypt pochodzi od strony "client'a"
Wysłany: 2018-08-06, 17:30
nanKy
Wiek: 22 Na forum: 3866 dni Posty: 498
Nick w MP: nanky
Piwa : 1773
Podaj kod ze strony serwera zasobu.
Wysłany: 2018-08-06, 17:43
CloakeR
Leniwiec
Wiek: 22 Na forum: 3091 dni Posty: 26
Nick w MP: CloakeR
Piwa : 3
Prosz?
function policja ( plr , cmd ,...)
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
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 [ "pystories-db" ]: dbSet ( "insert into Zawiadomienia (data,uid,serial,miejsce,pozycja,typ,opis,nick) values(NOW(),?,?,?,?,?,?,?)" , uid , getPlayerSerial ( plr ), lokalizacja , toJSON ({ x , y , z }, true ), "Policja" , string . gsub ( opis , '#%x%x%x%x%x%x' , '' ), getPlayerName ( plr ): gsub ( "#%x%x%x%x%x%x" , "" ))
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" )== "Policja" 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:Policja: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: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
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 [ "pystories-db" ]: dbSet ( "insert into Zawiadomienia (data,uid,serial,miejsce,pozycja,typ,opis,nick) values(NOW(),?,?,?,?,?,?,?)" , uid , getPlayerSerial ( plr ), lokalizacja , toJSON ({ x , y , z }, true ), "PSP" , string . gsub ( opis , '#%x%x%x%x%x%x' , '' ), getPlayerName ( plr ): gsub ( "#%x%x%x%x%x%x" , "" ))
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" )== "PSP" 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:FDSA: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: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
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 [ "pystories-db" ]: dbSet ( "insert into Zawiadomienia (data,uid,serial,miejsce,pozycja,typ,opis,nick) values(NOW(),?,?,?,?,?,?,?)" , uid , getPlayerSerial ( plr ), lokalizacja , toJSON ({ x , y , z }, true ), "PR" , string . gsub ( opis , '#%x%x%x%x%x%x' , '' ), getPlayerName ( plr ): gsub ( "#%x%x%x%x%x%x" , "" ))
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" )== "PR" 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 )
function zgloszenia ( plr )
if not getElementData ( plr , "player:faction" ) then return end
local q = exports [ "pystories-db" ]: dbSet ( "select * from Zawiadomienia where typ = ? and (TIMEDIFF(now(),data)/60) < 15" , getElementData ( plr , "player:faction" ))
--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:faction" ))
end
addCommandHandler ( "zgloszenia" , zgloszenia )
function sarh ( 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 ), "PD" )
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" )== "PD" 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:SARH:pokaz" , resourceRoot , x , y , z , id )
end
end
setElementData ( plr , "antySpamzgloszenia" , getTickCount ())
outputChatBox ( "Wezwa?e? PD! Wkr?tce si? tu kto? pojawi!" , plr , 255 , 64 , 0 )
end
addCommandHandler ( "900" , sarh )
iloscKasy ={
[ "Policja" ]= 200 ,
[ "PSP" ]= 200 ,
[ "PR" ]= 200 ,
[ "PD" ]= 300 ,
}
function odebranoZawiadomienie ( id )
co = getElementData ( client , "player:faction" )
ilosckasy = iloscKasy [ co ]
givePlayerMoney ( client , ilosckasy )
outputChatBox ( "Otrzyma?e? " .. ilosckasy .. " PLN za 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:Policja:usun" , resourceRoot , id )
end
end
end
addEvent ( "ZAWIADOMIENIA:Odebrane" , true )
addEventHandler ( "ZAWIADOMIENIA:Odebrane" , resourceRoot , odebranoZawiadomienie )
function deleteZawiadomienie ( id )
exports [ "pystories-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:faction" ).. "): " .. 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 )
Wysłany: 2018-08-06, 17:48
Mikołajj
Wiek: 22 Na forum: 2885 dni Posty: 303
Nick w MP: Mikołaj
Piwa : 132
Zamiast 'ipars' daj 'ipairs'
Wysłany: 2018-08-06, 18:01
CloakeR
Leniwiec
Wiek: 22 Na forum: 3091 dni Posty: 26
Nick w MP: CloakeR
Piwa : 3
Wi?c, zamieni?em "ipairs' na 'ipars', a potem 'ipars', na 'ipairs'. i przy ka?dej czynno?ci, ?adnych zmian, taki sam b??d w tej samej linijce.
Podpis
세상은 불이 붙을거야.
Kontakt:
Discord - CloakeR#4935
Wysłany: 2018-08-06, 22:10
Eitho
Wiek: 24 Na forum: 3489 dni Posty: 330
Nick w MP: Eitho
Piwa : 746
function zgloszenia ( plr )
if not getElementData ( plr , "player:faction" ) then return end
local q = exports [ "pystories-db" ]: dbSet ( "select * from Zawiadomienia where typ = ? and (TIMEDIFF(now(),data)/60) < 15" , getElementData ( plr , "player:faction" ))
--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:faction" ))
end
addCommandHandler ( "zgloszenia" , zgloszenia )
zamie? na
function zgloszenia ( plr )
if not getElementData ( plr , "player:faction" ) then return end
local q = exports [ "pystories-db" ]: dbGet ( "select * from Zawiadomienia where typ = ? and (TIMEDIFF(now(),data)/60) < 15" , getElementData ( plr , "player:faction" ))
if not q or #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:faction" ))
end
addCommandHandler ( "zgloszenia" , zgloszenia )
i napisz czy dzia?a
Więcej szczegółów
Wystawiono 1 piw(a):CloakeR
Wysłany: 2018-08-08, 12:30
CloakeR
Leniwiec
Wiek: 22 Na forum: 3091 dni Posty: 26
Nick w MP: CloakeR
Piwa : 3
Wi?c dzi?kuje Eitho za pomoc, gdy? skrypt po takowej zmianie znowu zacz?? dzia?a?, pojawiaj? si? zg?oszenia z bazy danych jak i wi?kszo?? funkcji dzia?a, wi?c mo?na zamkn?? temat.
Podpis
세상은 불이 붙을거야.
Kontakt:
Discord - CloakeR#4935
Tagi: ds3: :: bad :: argument :: ipars :: (table :: expected :: got :: boolean
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: