Sup
Just tried this:
ChatCommands = {}
function AddChatCommand(cmd, callback)
for k,v in pairs(ChatCommands) do
if cmd == v.cmd then return end
end
table.insert(ChatCommands, {cmd = cmd, callback = callback})
end
function ChatCommandSay(ply, text)
for k, v in pairs(ChatCommands) do
if string.lower(v.cmd) == string.Explode(" ", string.lower(text))[1] then
return v.callback(ply, "" .. string.sub(text, string.len(v.cmd) + 2, string.len(text)))
end
end
end
hook.Add("PlayerSay", "ChatCommandSay", ChatCommandSay)
function SetKarma(ply, args)
args = string.Explode(" " ,args)
if args[1] != nil then
playerz = FindPlayer(args[1])
end
if playerz == nil then
ply:PrintMessage(HUD_PRINTTALK, "User Not Found")
elseif args[2] == nil then
ply:PrintMessage(HUD_PRINTTALK, "No Amount Entered")
elseif tonumber(args[2]) > 1000 then
ply:PrintMessage(HUD_PRINTTALK, "Not Allowed To Be Set Over 1000")
elseif playerz != nil and args[2] != nil and tonumber(args[2]) <= 1000 then
if not ValidEntity(ply) or ply:IsSuperAdmin() or ply:IsAdmin() then
playerz:SetLiveKarma(args[2])
ply:PrintMessage(HUD_PRINTTALK, "You Have Changed A Users Karma")
playerz:PrintMessage(HUD_PRINTTALK, "Your Karma has been set to " .. args[2])
else
ply:PrintMessage(HUD_PRINTTALK, "Failed To Set Karma. Check That You Are Admin.")
end
end
end
AddChatCommand("!karma", SetKarma)
And I cannot fix it, no errors are given and its really fucking me over >:(