Wysłany: 2018-08-07, 11:14
DylemaT929
Nikt
Wiek: 28 Na forum: 4041 dni Posty: 333
Nick w MP: dylemat929
Piwa : 3195
Tak jak w temacie mam znowu problem z zapisywaniem statystyk do bazy danych. Chodzi o to ?e wszystko si? zapisuje. Tylko jak by to uj?? jak kto? straci internet albo wyjdzie z serwera(przy ka?dym wyj?ciu zapisuje albo i nie zapisuje) to nie zapisuj? mu si? ale zeruj?. Teraz nagle pojawi? si? ten problem wcze?niej go naprawi?em.
Zas?b OGRPG.
Wysłany: 2018-08-07, 11:20
turbonet
Kradnę kody uważaj :)
Wiek: 28 Na forum: 2903 dni Posty: 30
Nick w MP: AJgorEx
Piwa : 464
Jakie? b??dy w db3?
Podpis
[lua]
Napisał bym tu coś ale nie umiem...
[/lua]
Wysłany: 2018-08-07, 11:21
DylemaT929
Nikt
Wiek: 28 Na forum: 4041 dni Posty: 333
Nick w MP: dylemat929
Piwa : 3195
"turbonet" napisał/a :
Brak jakichkolwiek. Przy ka?dym wyj?ciu z serwera mam zapis do bazy danych. Jak staje si? taki problem to zamiast "zapis" pokazuje si? "error" albo nie pokazuje ?e mu zapisa?o w logach
Wysłany: 2018-08-07, 11:22
turbonet
Kradnę kody uważaj :)
Wiek: 28 Na forum: 2903 dni Posty: 30
Nick w MP: AJgorEx
Piwa : 464
Masz modu??
Podpis
[lua]
Napisał bym tu coś ale nie umiem...
[/lua]
Wysłany: 2018-08-07, 11:23
eject
kurdebele
Wiek: 30 Na forum: 3659 dni Posty: 182
Nick w MP: EjecT
Piwa : 2456
Usu? wykonywanie savePlayer przy wyjsciu i zastosuj m?j kod zapisu wykonany dla eastcity
function hook_givePlayerMoney ( sourceResource , functionName , isAllowedByACL , luaFilename , luaLineNumber , ... )
local args = { ... }
local plr = args [ 1 ]
local money = args [ 2 ]
local monety = exports [ 'ogrpg-db' ]: dbGet ( "select * from ogrpg_users where id=?" , getElementData ( plr , "player:uid" ))
local ile = monety [ 1 ][ 'money' ] + money
exports [ 'ogrpg-db' ]: dbSet ( 'update ogrpg_users set money=? where id=?' , ile , getElementData ( plr , "player:uid" ))
end
addDebugHook ( "postFunction" , hook_givePlayerMoney , { "givePlayerMoney" })
function hook_takePlayerMoney ( sourceResource , functionName , isAllowedByACL , luaFilename , luaLineNumber , ... )
local args = { ... }
local plr = args [ 1 ]
local money = args [ 2 ]
local monety = exports [ 'ogrpg-db' ]: dbGet ( "select * from ogrpg_users where id=?" , getElementData ( plr , "player:uid" ))
local ile = monety [ 1 ][ 'money' ] - money
exports [ 'ogrpg-db' ]: dbSet ( 'update ogrpg_users set money=? where id=?' , ile , getElementData ( plr , "player:uid" ))
end
addDebugHook ( "postFunction" , hook_takePlayerMoney , { "takePlayerMoney" })
function hook_setPlayerMoney ( sourceResource , functionName , isAllowedByACL , luaFilename , luaLineNumber , ... )
local args = { ... }
local plr = args [ 1 ]
local money = args [ 2 ]
exports [ 'ogrpg-db' ]: dbSet ( 'update ogrpg_users set money=? where id=?' , money , getElementData ( plr , "player:uid" ))
end
addDebugHook ( "postFunction" , hook_setPlayerMoney , { "setPlayerMoney" })
function hook_setElementData ( sourceResource , functionName , isAllowedByACL , luaFilename , luaLineNumber , ... )
local args = {...}
if args [ 2 ] == "player:reputation" then
local ile = args [ 3 ]
local plr = args [ 1 ]
exports [ 'ogrpg-db' ]: dbSet ( 'update ogrpg_users set reputation=? where id=?' , ile , getElementData ( plr , "player:uid" ))
end
if args [ 2 ] == "player:workinjob" then
local ile = args [ 3 ]
local plr = args [ 1 ]
exports [ 'ogrpg-db' ]: dbSet ( 'update ogrpg_users set worker=? where id=?' , ile , getElementData ( plr , "player:uid" ))
end
if args [ 2 ] == "player:hours" then
local ile = args [ 3 ]
local plr = args [ 1 ]
exports [ 'ogrpg-db' ]: dbSet ( 'update ogrpg_users set hours=hours+? where id=?' , ile , getElementData ( plr , "player:uid" ))
end
if args [ 2 ] == "player:license:pjA" then
local ile = args [ 3 ]
local plr = args [ 1 ]
exports [ 'ogrpg-db' ]: dbSet ( 'update ogrpg_users set hours=? where id=?' , ile , getElementData ( plr , "player:uid" ))
end
if args [ 2 ] == "player:license:pjB" then
local ile = args [ 3 ]
local plr = args [ 1 ]
exports [ 'ogrpg-db' ]: dbSet ( 'update ogrpg_users set hours=? where id=?' , ile , getElementData ( plr , "player:uid" ))
end
if args [ 2 ] == "player:license:pjC" then
local ile = args [ 3 ]
local plr = args [ 1 ]
exports [ 'ogrpg-db' ]: dbSet ( 'update ogrpg_users set hours=? where id=?' , ile , getElementData ( plr , "player:uid" ))
end
if args [ 2 ] == "player:license:pjL" then
local ile = args [ 3 ]
local plr = args [ 1 ]
exports [ 'ogrpg-db' ]: dbSet ( 'update ogrpg_users set hours=? where id=?' , ile , getElementData ( plr , "player:uid" ))
end
end
addDebugHook ( "postFunction" , hook_setElementData , { "setElementData" })
Wysłany: 2018-08-07, 11:23
turbonet
Kradnę kody uważaj :)
Wiek: 28 Na forum: 2903 dni Posty: 30
Nick w MP: AJgorEx
Piwa : 464
XD Chcia?em da? m?j kod
Podpis
[lua]
Napisał bym tu coś ale nie umiem...
[/lua]
Wysłany: 2018-08-07, 11:25
DylemaT929
Nikt
Wiek: 28 Na forum: 4041 dni Posty: 333
Nick w MP: dylemat929
Piwa : 3195
"turbonet" napisał/a :
wszystkie modu?y mam. nie uwa?aj mnie za zielonego bo mam sw?j serwer to wiem co i jak. Tylko ten zapis jest okropny ;d co jest w saveplayers
[ Dodano : 2018-08-07, 11:45 ]
"eject" napisał/a :Usu? wykonywanie savePlayer przy wyjsciu i zastosuj m?j kod zapisu wykonany dla eastcity
function hook_givePlayerMoney ( sourceResource , functionName , isAllowedByACL , luaFilename , luaLineNumber , ... )
local args = { ... }
local plr = args [ 1 ]
local money = args [ 2 ]
local monety = exports [ 'ogrpg-db' ]: dbGet ( "select * from ogrpg_users where id=?" , getElementData ( plr , "player:uid" ))
local ile = monety [ 1 ][ 'money' ] + money
exports [ 'ogrpg-db' ]: dbSet ( 'update ogrpg_users set money=? where id=?' , ile , getElementData ( plr , "player:uid" ))
end
addDebugHook ( "postFunction" , hook_givePlayerMoney , { "givePlayerMoney" })
function hook_takePlayerMoney ( sourceResource , functionName , isAllowedByACL , luaFilename , luaLineNumber , ... )
local args = { ... }
local plr = args [ 1 ]
local money = args [ 2 ]
local monety = exports [ 'ogrpg-db' ]: dbGet ( "select * from ogrpg_users where id=?" , getElementData ( plr , "player:uid" ))
local ile = monety [ 1 ][ 'money' ] - money
exports [ 'ogrpg-db' ]: dbSet ( 'update ogrpg_users set money=? where id=?' , ile , getElementData ( plr , "player:uid" ))
end
addDebugHook ( "postFunction" , hook_takePlayerMoney , { "takePlayerMoney" })
function hook_setPlayerMoney ( sourceResource , functionName , isAllowedByACL , luaFilename , luaLineNumber , ... )
local args = { ... }
local plr = args [ 1 ]
local money = args [ 2 ]
exports [ 'ogrpg-db' ]: dbSet ( 'update ogrpg_users set money=? where id=?' , money , getElementData ( plr , "player:uid" ))
end
addDebugHook ( "postFunction" , hook_setPlayerMoney , { "setPlayerMoney" })
function hook_setElementData ( sourceResource , functionName , isAllowedByACL , luaFilename , luaLineNumber , ... )
local args = {...}
if args [ 2 ] == "player:reputation" then
local ile = args [ 3 ]
local plr = args [ 1 ]
exports [ 'ogrpg-db' ]: dbSet ( 'update ogrpg_users set reputation=? where id=?' , ile , getElementData ( plr , "player:uid" ))
end
if args [ 2 ] == "player:workinjob" then
local ile = args [ 3 ]
local plr = args [ 1 ]
exports [ 'ogrpg-db' ]: dbSet ( 'update ogrpg_users set worker=? where id=?' , ile , getElementData ( plr , "player:uid" ))
end
if args [ 2 ] == "player:hours" then
local ile = args [ 3 ]
local plr = args [ 1 ]
exports [ 'ogrpg-db' ]: dbSet ( 'update ogrpg_users set hours=hours+? where id=?' , ile , getElementData ( plr , "player:uid" ))
end
if args [ 2 ] == "player:license:pjA" then
local ile = args [ 3 ]
local plr = args [ 1 ]
exports [ 'ogrpg-db' ]: dbSet ( 'update ogrpg_users set hours=? where id=?' , ile , getElementData ( plr , "player:uid" ))
end
if args [ 2 ] == "player:license:pjB" then
local ile = args [ 3 ]
local plr = args [ 1 ]
exports [ 'ogrpg-db' ]: dbSet ( 'update ogrpg_users set hours=? where id=?' , ile , getElementData ( plr , "player:uid" ))
end
if args [ 2 ] == "player:license:pjC" then
local ile = args [ 3 ]
local plr = args [ 1 ]
exports [ 'ogrpg-db' ]: dbSet ( 'update ogrpg_users set hours=? where id=?' , ile , getElementData ( plr , "player:uid" ))
end
if args [ 2 ] == "player:license:pjL" then
local ile = args [ 3 ]
local plr = args [ 1 ]
exports [ 'ogrpg-db' ]: dbSet ( 'update ogrpg_users set hours=? where id=?' , ile , getElementData ( plr , "player:uid" ))
end
end
addDebugHook ( "postFunction" , hook_setElementData , { "setElementData" })
zmieni?em zobaczymy jak teraz b?dzie
Tagi: zapisywanie :: statystyk
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: