Skip to content

Instantly share code, notes, and snippets.

@ottworks
Forked from andreblue/sh_darkrp_commands.lua
Last active October 4, 2015 04:08
Show Gist options
  • Save ottworks/7651f94cc8389217f645 to your computer and use it in GitHub Desktop.
Save ottworks/7651f94cc8389217f645 to your computer and use it in GitHub Desktop.
A simple set of commands for use with maestro admin mod to do some common darkrp commands. Fixed up the code.
maestro.command("addmoney", {"player:target", "number"}, function(caller, targets, num)
if #targets == 0 then
return true, "Query matched no players."
end
for i = 1, #targets do
local ply = targets[i]
ply:addMoney(num)
end
return false, "added $%2 to %1's wallet"
end, [[Gives a player money.]])
maestro.command("setmoney", {"player:target", "number"}, function(caller, targets, num)
if #targets == 0 then
return true, "Query matched no players."
end
for i = 1, #targets do
local ply = targets[i]
ply:addMoney(-ply:getDarkRPVar("money"))
ply:addMoney(num)
end
return false, "set %1's wallet to $%2"
end, [[Sets a player's wallet amount.]])
maestro.command("arrest", {"player:target", "number:optional"}, function(caller, targets, num)
if #targets == 0 then
return true, "Query matched no players."
end
if num == nil then
num = GAMEMODE.Config.jailtimer
end
for i = 1, #targets do
local ply = targets[i]
if not ply:isArrested() then
ply:arrest(num, caller)
end
end
return false, " arrested %1"
end, [[Arrests the player.]])
maestro.command("unarrest", {"player:target"}, function(caller, targets)
if #targets == 0 then
return true, "Query matched no players."
end
for i = 1, #targets do
local ply = targets[i]
if ply:isArrested() then
ply:unArrest(caller)
end
end
return false, " released %1 from jail"
end, [[Releases the player.]])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment