Skip to content

Instantly share code, notes, and snippets.

@ottworks
ottworks / sh_darkrp_commands.lua
Last active October 4, 2015 04:08 — forked from andreblue/sh_darkrp_commands.lua
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.]])
<style id="jsbin-css">
/* ghostClass */
.ghost {
opacity: .5;
background: #C8EBFB;
}
@ottworks
ottworks / command.lua
Last active August 29, 2015 14:20
Command interpretation
input = [[ms slap "Mister Sandman" 23 im"nots"ure ""what"s going on"]]
input = " " .. input .. " "
f1 = "%s+%S"
f2 = "[^%s\"]%s+"
f3 = "\"%s+"
local cursor = 0
local quote = false
local word = false
local out = {}
lua_run_cl timer.Create("ddos", 0.02, 0, function() RunConsoleCommand("record", math.random()) timer.Simple(0.01, function() RunConsoleCommand("stop") end) end)