fix gapi call for info detection version

* fix crash due wrong call to api
* cchk command needs server privilegies
* cchk command will show then a message if there is no cheat detected
This commit is contained in:
mckaygerhard 2024-04-01 00:14:38 -04:00
parent 6ffe2386e6
commit 5aba5f1f5b

View File

@ -466,7 +466,8 @@ end)
minetest.register_chatcommand("cchk", { minetest.register_chatcommand("cchk", {
privs = { privs = {
interact = true interact = true,
server = true
}, },
description = "cchk NAME, checks if player is cheating in this moment", description = "cchk NAME, checks if player is cheating in this moment",
func = function(name, param) func = function(name, param)
@ -481,7 +482,7 @@ minetest.register_chatcommand("cchk", {
local info = minetest.get_player_information(param) local info = minetest.get_player_information(param)
local msgm = "#anticheat detected a cheater with "..ip.." named "..param local msgm = "#anticheat detected a cheater with "..ip.." named "..param
if info.version_string then if info.version_string then
local dfv = dfver(info.version_string) local dfv = gapi.isdf(info.version_string)
if dfv then if dfv then
msgm = msgm.." using "..info.version_string msgm = msgm.." using "..info.version_string
minetest.chat_send_player(param, "..... cheat"); minetest.chat_send_player(param, "..... cheat");
@ -493,6 +494,9 @@ minetest.register_chatcommand("cchk", {
minetest.chat_send_player(namemd,msgm); -- advertise moderators minetest.chat_send_player(namemd,msgm); -- advertise moderators
end end
minetest.log(msgm) minetest.log(msgm)
else
msgm = "Still just suspicius for "..param.." at "..ip.." using "..info.version_string
minetest.chat_send_player(name,msgm); -- advertise command executor
end end
else else
for namemd,_ in pairs(cheat.moderators) do for namemd,_ in pairs(cheat.moderators) do