mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-12-24 17:50:37 +01:00
Updated fail mod
This commit is contained in:
parent
7c8a26fb14
commit
59a736fc23
@ -43,21 +43,21 @@ minetest.register_chatcommand("cookie", {
|
|||||||
local param = paramlist[1]
|
local param = paramlist[1]
|
||||||
local param2 = paramlist[2]
|
local param2 = paramlist[2]
|
||||||
if param == "help" or param == nil then
|
if param == "help" or param == nil then
|
||||||
core.chat_send_player(name,"CooKie recipe's help :")
|
minetest.chat_send_player(name,"CooKie recipe's help :")
|
||||||
core.chat_send_player(name,"/cookie <subcommand> | <playername>")
|
minetest.chat_send_player(name,"/cookie <subcommand> | <playername>")
|
||||||
core.chat_send_player(name,"Available subcommands :")
|
minetest.chat_send_player(name,"Available subcommands :")
|
||||||
core.chat_send_player(name," - help : show this help")
|
minetest.chat_send_player(name," - help : show this help")
|
||||||
core.chat_send_player(name," - view | view <playername> : View player's CooKies amount")
|
minetest.chat_send_player(name," - view | view <playername> : View player's CooKies amount")
|
||||||
return
|
return
|
||||||
elseif param == "settings" then
|
elseif param == "settings" then
|
||||||
if not minetest.get_player_privs(name)["server"] then
|
if not minetest.get_player_privs(name)["server"] then
|
||||||
core.chat_send_player(name,"You're not allowed to perform this command. (Missing privilege : server)")
|
minetest.chat_send_player(name,"You're not allowed to perform this command. (Missing privilege : server)")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
core.chat_send_player(name,"=== FP_DEBUG_LINES SENT ===")
|
minetest.chat_send_player(name,"=== FP_DEBUG_LINES SENT ===")
|
||||||
local send_admin = function(msg)
|
local send_admin = function(msg)
|
||||||
core.chat_send_player(name,msg)
|
minetest.chat_send_player(name,msg)
|
||||||
end
|
end
|
||||||
|
|
||||||
table.foreach(data,print)
|
table.foreach(data,print)
|
||||||
@ -69,14 +69,14 @@ minetest.register_chatcommand("cookie", {
|
|||||||
if data.cookies[name] then
|
if data.cookies[name] then
|
||||||
owncookies = data.cookies[name]
|
owncookies = data.cookies[name]
|
||||||
end
|
end
|
||||||
core.chat_send_player(name,"-CK- You own "..owncookies.." CooKies.")
|
minetest.chat_send_player(name,"-CK- You own "..owncookies.." CooKies.")
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
if data.cookies[param2] ~= nil and data.cookies[param2] > 0 then
|
if data.cookies[param2] ~= nil and data.cookies[param2] > 0 then
|
||||||
core.chat_send_player(name,"-CK- Player "..param2.." owns "..data.cookies[param2].." CooKies.")
|
minetest.chat_send_player(name,"-CK- Player "..param2.." owns "..data.cookies[param2].." CooKies.")
|
||||||
else
|
else
|
||||||
core.chat_send_player(name,"-CK- Player "..param2.." doesn't seem to own any CooKie.")
|
minetest.chat_send_player(name,"-CK- Player "..param2.." doesn't seem to own any CooKie.")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ minetest.register_chatcommand("cookie", {
|
|||||||
if name == param then
|
if name == param then
|
||||||
if minetest.get_player_privs(name)["baker"] == true then
|
if minetest.get_player_privs(name)["baker"] == true then
|
||||||
minetest.log("error",name.." tried to create a CooKie by giving to himself")
|
minetest.log("error",name.." tried to create a CooKie by giving to himself")
|
||||||
core.chat_send_player(name,"-CK- Congratulation, you failed. Don't try to cook for yourself, don't be selfish :p")
|
minetest.chat_send_player(name,"-CK- Congratulation, you failed. Don't try to cook for yourself, don't be selfish :p")
|
||||||
else
|
else
|
||||||
minetest.log("action",name.."cooked himself a CooKie")
|
minetest.log("action",name.."cooked himself a CooKie")
|
||||||
data.send_func(name,"-CK- You failed: It appears the name you entered is yours")
|
data.send_func(name,"-CK- You failed: It appears the name you entered is yours")
|
||||||
@ -99,14 +99,14 @@ minetest.register_chatcommand("cookie", {
|
|||||||
end
|
end
|
||||||
|
|
||||||
if not data.is_player_available(param) then
|
if not data.is_player_available(param) then
|
||||||
core.chat_send_player(name,"-CK- You failed: Sorry, "..param.." isn't online.")
|
minetest.chat_send_player(name,"-CK- You failed: Sorry, "..param.." isn't online.")
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Take, or not, cookies from name's account to give them to param
|
-- Take, or not, cookies from name's account to give them to param
|
||||||
if minetest.get_player_privs(name)["baker"] ~= true then
|
if minetest.get_player_privs(name)["baker"] ~= true then
|
||||||
if data.cookies[name] == nil or data.failpoints[name] == 0 then
|
if data.cookies[name] == nil or data.failpoints[name] == 0 then
|
||||||
core.chat_send_player(name,"You failed: You don't have enough CooKies.. Cook some!")
|
minetest.chat_send_player(name,"You failed: You don't have enough CooKies.. Cook some!")
|
||||||
return false
|
return false
|
||||||
elseif data.cookies[name] > 0 then
|
elseif data.cookies[name] > 0 then
|
||||||
data.cookies[name] = data.cookies[name] -1
|
data.cookies[name] = data.cookies[name] -1
|
||||||
@ -135,7 +135,7 @@ minetest.register_chatcommand("cookie", {
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
data.send_func(param,"Congratulations "..param..", you get a CooKie" .. message_reason)
|
data.send_func(param,"Congratulations "..param..", you get a CooKie" .. message_reason)
|
||||||
core.chat_send_player(name,"CooKie sent.")
|
minetest.chat_send_player(name,"CooKie sent.")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
@ -37,16 +37,16 @@ end
|
|||||||
|
|
||||||
-- Configuration application
|
-- Configuration application
|
||||||
|
|
||||||
data.send_func = function(name, msg) core.chat_send_player(name, msg) end
|
data.send_func = function(name, msg) minetest.chat_send_player(name, msg) end
|
||||||
|
|
||||||
if data.PUB_MSG then
|
if data.PUB_MSG then
|
||||||
data.send_func = function (name, msg) core.chat_send_all(msg) end
|
data.send_func = function (name, msg) minetest.chat_send_all(msg) end
|
||||||
end
|
end
|
||||||
|
|
||||||
data.is_player_available = minetest.get_player_by_name
|
data.is_player_available = minetest.get_player_by_name
|
||||||
|
|
||||||
if data.STRICT_PLAYER_CHECK == false then
|
if data.STRICT_PLAYER_CHECK == false then
|
||||||
print("REDEF!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
|
|
||||||
data.is_player_available = function (name)
|
data.is_player_available = function (name)
|
||||||
return (io.open(minetest.get_worldpath().."/players/"..name) ~= nil)
|
return (io.open(minetest.get_worldpath().."/players/"..name) ~= nil)
|
||||||
end
|
end
|
||||||
@ -85,25 +85,25 @@ minetest.register_chatcommand("fail", {
|
|||||||
local param = paramlist[1]
|
local param = paramlist[1]
|
||||||
local param2 = paramlist[2]
|
local param2 = paramlist[2]
|
||||||
if param == "version" then
|
if param == "version" then
|
||||||
core.chat_send_player(name,"-FP- Fail mod version: "..data.fp_version)
|
minetest.chat_send_player(name,"-FP- Fail mod version: "..data.fp_version)
|
||||||
return true
|
return true
|
||||||
elseif param == "help" or param == nil then
|
elseif param == "help" or param == nil then
|
||||||
core.chat_send_player(name,"Failpoints available help :")
|
minetest.chat_send_player(name,"Failpoints available help :")
|
||||||
core.chat_send_player(name,"/fail <subcommand> | <playername>")
|
minetest.chat_send_player(name,"/fail <subcommand> | <playername>")
|
||||||
core.chat_send_player(name,"Available subcommands :")
|
minetest.chat_send_player(name,"Available subcommands :")
|
||||||
core.chat_send_player(name," - help : show this help")
|
minetest.chat_send_player(name," - help : show this help")
|
||||||
core.chat_send_player(name," - version : show actual fail version")
|
minetest.chat_send_player(name," - version : show actual fail version")
|
||||||
core.chat_send_player(name," - view | view <playername> : View player's failpoints amount")
|
minetest.chat_send_player(name," - view | view <playername> : View player's failpoints amount")
|
||||||
return
|
return
|
||||||
elseif param == "settings" then
|
elseif param == "settings" then
|
||||||
if not minetest.get_player_privs(name)["server"] then
|
if not minetest.get_player_privs(name)["server"] then
|
||||||
core.chat_send_player(name,"You're not allowed to perform this command. (Missing privilege : server)")
|
minetest.chat_send_player(name,"You're not allowed to perform this command. (Missing privilege : server)")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
core.chat_send_player(name,"=== FP_DEBUG_LINES SENT ===")
|
minetest.chat_send_player(name,"=== FP_DEBUG_LINES SENT ===")
|
||||||
local send_admin = function(msg)
|
local send_admin = function(msg)
|
||||||
core.chat_send_player(name,msg)
|
minetest.chat_send_player(name,msg)
|
||||||
end
|
end
|
||||||
|
|
||||||
table.foreach(data,print)
|
table.foreach(data,print)
|
||||||
@ -115,14 +115,14 @@ minetest.register_chatcommand("fail", {
|
|||||||
if data.failpoints[name] then
|
if data.failpoints[name] then
|
||||||
ownfail = data.failpoints[name]
|
ownfail = data.failpoints[name]
|
||||||
end
|
end
|
||||||
core.chat_send_player(name,"-FP- You own "..ownfail.." FailPoints.")
|
minetest.chat_send_player(name,"-FP- You own "..ownfail.." FailPoints.")
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
if data.failpoints[param2] ~= nil and data.failpoints[param2] > 0 then
|
if data.failpoints[param2] ~= nil and data.failpoints[param2] > 0 then
|
||||||
core.chat_send_player(name,"-FP- Player "..param2.." owns "..data.failpoints[param2].." FailPoints.")
|
minetest.chat_send_player(name,"-FP- Player "..param2.." owns "..data.failpoints[param2].." FailPoints.")
|
||||||
else
|
else
|
||||||
core.chat_send_player(name,"-FP- Player "..param2.." doesn't seem to own any FailPoint.")
|
minetest.chat_send_player(name,"-FP- Player "..param2.." doesn't seem to own any FailPoint.")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
||||||
@ -145,14 +145,14 @@ minetest.register_chatcommand("fail", {
|
|||||||
end
|
end
|
||||||
|
|
||||||
if not data.is_player_available(param) then
|
if not data.is_player_available(param) then
|
||||||
core.chat_send_player(name,"-FP- You failed: Sorry, "..param.." isn't online.")
|
minetest.chat_send_player(name,"-FP- You failed: Sorry, "..param.." isn't online.")
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Take, or not, failpoints from name's account to give them to param
|
-- Take, or not, failpoints from name's account to give them to param
|
||||||
if minetest.get_player_privs(name)["fp_create"] ~= true then
|
if minetest.get_player_privs(name)["fp_create"] ~= true then
|
||||||
if data.failpoints[name] == nil or data.failpoints[name] == 0 then
|
if data.failpoints[name] == nil or data.failpoints[name] == 0 then
|
||||||
core.chat_send_player(name,"You failed: You don't have enough failpoints..")
|
minetest.chat_send_player(name,"You failed: You don't have enough failpoints..")
|
||||||
return false
|
return false
|
||||||
elseif data.failpoints[name] > 0 then
|
elseif data.failpoints[name] > 0 then
|
||||||
data.failpoints[name] = data.failpoints[name] -1
|
data.failpoints[name] = data.failpoints[name] -1
|
||||||
@ -181,7 +181,7 @@ minetest.register_chatcommand("fail", {
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
data.send_func(param,"Congratulations "..param..", you win a failpoint" .. message_reason)
|
data.send_func(param,"Congratulations "..param..", you win a failpoint" .. message_reason)
|
||||||
core.chat_send_player(name,"FP sent.")
|
minetest.chat_send_player(name,"FP sent.")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user