Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
illuna
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Illuna-Minetest
illuna
Commits
69dc1478
Commit
69dc1478
authored
8 years ago
by
Milan
Browse files
Options
Downloads
Patches
Plain Diff
add arrest command
parent
05e23068
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
commands.lua
+67
-0
67 additions, 0 deletions
commands.lua
with
67 additions
and
0 deletions
commands.lua
+
67
−
0
View file @
69dc1478
...
...
@@ -68,6 +68,9 @@ end)
-- Commands, originally by Grailtest @0-afflatus
command
=
{}
-- Notices
function
command
.
send_notice
(
target
,
text
)
local
player
=
minetest
.
get_player_by_name
(
target
)
if
not
player
then
...
...
@@ -114,3 +117,67 @@ minetest.register_chatcommand("notice", {
end
,
})
-- Arrest
local
court
=
{
x
=
13
,
y
=
35
,
z
=-
11
}
local
court_admin
=
{
x
=
35
,
y
=
24
,
z
=-
11
}
local
prison
=
{
x
=
0
,
y
=-
2015
,
z
=
0
}
local
prison_admin
=
{
x
=
19
,
y
=-
2015
,
z
=
19
}
function
command
:
is_in
(
context
,
search_term
)
for
k
,
value
in
ipairs
(
context
)
do
if
value
==
search_term
then
return
k
end
end
return
false
end
function
command
:
player_exists
(
name
)
local
privs
=
minetest
.
get_player_privs
(
name
);
if
(
not
(
privs
))
then
return
false
;
else
return
true
;
end
end
function
command
:
arrest
(
playername
)
local
perp
=
minetest
.
get_player_by_name
(
playername
)
if
perp
then
--minetest.set_player_privs(perp, {shout = true})
perp
:
setpos
(
court
)
else
return
false
;
end
return
true
;
end
function
command
:
make_arrest
(
adminname
)
local
judge
=
minetest
.
get_player_by_name
(
adminname
)
judge
:
setpos
(
court_admin
)
return
true
;
end
minetest
.
register_chatcommand
(
"arrest"
,
{
params
=
"<player>"
,
privs
=
{
basic_privs
=
true
,
},
description
=
"Arrest a player. (removes all privs but shout)"
,
func
=
function
(
name
,
param
)
local
perps
=
string
.
split
(
param
,
" "
)
local
perp
=
perps
[
1
]
or
"Suspect"
minetest
.
chat_send_player
(
name
,
"You arrest "
..
perp
)
if
not
command
:
player_exists
(
perp
)
then
return
false
,
"Player "
..
perp
..
" does not exist."
end
--local privs = minetest.get_player_privs(perp)
-- arrest function
command
:
make_arrest
(
name
)
if
not
command
:
arrest
(
perp
)
then
return
false
,
"You fail to arrest "
..
perp
end
minetest
.
log
(
"action"
,
name
..
" arrested "
..
perp
)
minetest
.
chat_send_player
(
name
,
"Player "
..
perp
..
" arrested. Revoked all but shout."
)
end
,
})
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment