Welcome, Guest. Please login or register.
Did you miss your activation email?
September 20, 2024, 04:40:09 AM
Home Help Login Register
News: Zombie Master 2 discussion

Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: Karma
Pages: [1]
Author Topic: Karma  (Read 3788 times)
Anonymous
Poster

Posts: 126


« on: November 08, 2011, 11:47:55 PM »

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 >:(

Anonymous
Poster

Posts: 126


« Reply #1 on: November 22, 2011, 09:47:29 PM »

Bumped

Pages: [1]
Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: Karma « previous next »
Jump to:  


Login with username, password and session length

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines
Page created in 0.009 seconds with 18 queries.