Currently the developers are putting their own money into JC2-MP to keep the servers online.

Please take a few seconds of your time and disable your AdBlock plugin for our website.

Ad revenue is not going to developers, it is used purely for covering our hosting costs.

 

You are also free to donate, which removes all ads from our website!

Patch 0.3 was just released! Full changelog here: https://t.co/4A50m6IKen

2 years ago

Advertisement
August 24, 2019, 12:08:13 am

Author Topic: Cain's Admin Commands and Functions  (Read 2816 times)

Cain

  • Donator
  • Newbie
  • *****
  • Posts: 40
    • View Profile
Cain's Admin Commands and Functions
« on: December 17, 2013, 03:21:25 am »
Released!

http://jc-mp.co.uk/admin.zip

Available Commands:
/kill
/kill <player> (ADMIN)
/kick <player> (ADMIN)
/setmoney <player> <amount> (ADMIN)
/forcepassenger <player> (ADMIN)
/ptphere <player> (ADMIN)
/repair (Cost $300)
/killcar (Cost $100)
/id
/ptp <player>

Open admin.lua and replace Steam ID with your ID
« Last Edit: December 17, 2013, 03:34:49 pm by Cain »

Varacka

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Cain's Admin Commands and Functions
« Reply #1 on: December 17, 2013, 08:28:55 am »
Gives an error about global args and a nil value.

Edit:

00:29:53 | [error] | Failed to run file admincommands.lua in module admincommand
s: ...2mp\jc2mp\scripts\admincommands\server\admincommands.lua:1: attempt to ind
ex global 'args' (a nil value)
00:29:53 | [error] | Callstack:

Is the error
« Last Edit: December 17, 2013, 08:34:12 am by Varacka »

Cain

  • Donator
  • Newbie
  • *****
  • Posts: 40
    • View Profile
Re: Cain's Admin Commands and Functions
« Reply #2 on: December 17, 2013, 03:07:17 pm »
I'll work on a full release soon. Writing more commands as we speak.

Chemich

  • Jr. Member
  • **
  • Posts: 86
    • View Profile
Re: Cain's Admin Commands and Functions
« Reply #3 on: December 17, 2013, 03:25:23 pm »
I'll work on a full release soon. Writing more commands as we speak.

When you do the full release please write a commands list for us lua noobs. ^^
could use all the help i can get with running a server

Cain

  • Donator
  • Newbie
  • *****
  • Posts: 40
    • View Profile
Re: Cain's Admin Commands and Functions
« Reply #4 on: December 17, 2013, 03:35:02 pm »
Released, check OP.

Homerunnerd

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Cain's Admin Commands and Functions
« Reply #5 on: March 02, 2014, 07:49:59 pm »
Love the script, although I'm noticing that admin's chat is not logged by the server. Is there a way to turn this on?
Thanks for releasing this!

JasonMRC

  • Donator
  • Hero Member
  • *****
  • Posts: 601
    • View Profile
Re: Cain's Admin Commands and Functions
« Reply #6 on: March 02, 2014, 11:31:22 pm »
Love the script, although I'm noticing that admin's chat is not logged by the server. Is there a way to turn this on?
Thanks for releasing this!
That is because Admin chat is a Chat:Broadcast, which does not naturally go into the server console.
Code: Lua
  1. print(adminPrefix .. args.player:GetName() .. ": " .. text)
Add this just below the Chat:Broadcast command for player chat. It is at the bottom of server/admin.lua
Should work, if not post the code around the Chat:Broadcast.

Homerunnerd

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Cain's Admin Commands and Functions
« Reply #7 on: March 03, 2014, 02:26:14 am »
Love the script, although I'm noticing that admin's chat is not logged by the server. Is there a way to turn this on?
Thanks for releasing this!
That is because Admin chat is a Chat:Broadcast, which does not naturally go into the server console.
Code: Lua
  1. print(adminPrefix .. args.player:GetName() .. ": " .. text)
Add this just below the Chat:Broadcast command for player chat. It is at the bottom of server/admin.lua
Should work, if not post the code around the Chat:Broadcast.

Did not seem to work. When I applied the code you sent (see below), it was removed as an admin from chat (and could no longer access admin commands)

Code: [Select]
if(isAdmin(args.player)) then
local text = args.text
if string.sub(text, 1, 1) ~= "/" then
print(adminPrefix .. args.player:GetName() .. ": " .. text), Color(255, 48, 48))
return false

end

end

JasonMRC

  • Donator
  • Hero Member
  • *****
  • Posts: 601
    • View Profile
Re: Cain's Admin Commands and Functions
« Reply #8 on: March 03, 2014, 03:43:14 am »
Love the script, although I'm noticing that admin's chat is not logged by the server. Is there a way to turn this on?
Thanks for releasing this!
That is because Admin chat is a Chat:Broadcast, which does not naturally go into the server console.
Code: Lua
  1. print(adminPrefix .. args.player:GetName() .. ": " .. text)
Add this just below the Chat:Broadcast command for player chat. It is at the bottom of server/admin.lua
Should work, if not post the code around the Chat:Broadcast.

Did not seem to work. When I applied the code you sent (see below), it was removed as an admin from chat (and could no longer access admin commands)

Code: [Select]
if(isAdmin(args.player)) then
local text = args.text
if string.sub(text, 1, 1) ~= "/" then
print(adminPrefix .. args.player:GetName() .. ": " .. text), Color(255, 48, 48))
return false

end

end
Uhhh, it looks like you removed the normal Chat:Broadcast. I said to add the print, not overwrite.

Here, I'll just add it to the code:
Code: [Select]
if(isAdmin(args.player)) then
local text = args.text
if string.sub(text, 1, 1) ~= "/" then
Chat:Broadcast(adminPrefix .. args.player:GetName() .. ": " .. text, Color(255, 48, 48))
print(adminPrefix .. args.player:GetName() .. ": " .. text)
return false
end
end
Replace the code you posted with this code and it should work fine.

Homerunnerd

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Cain's Admin Commands and Functions
« Reply #9 on: March 03, 2014, 05:36:33 am »
Love the script, although I'm noticing that admin's chat is not logged by the server. Is there a way to turn this on?
Thanks for releasing this!
That is because Admin chat is a Chat:Broadcast, which does not naturally go into the server console.
Code: Lua
  1. print(adminPrefix .. args.player:GetName() .. ": " .. text)
Add this just below the Chat:Broadcast command for player chat. It is at the bottom of server/admin.lua
Should work, if not post the code around the Chat:Broadcast.

Did not seem to work. When I applied the code you sent (see below), it was removed as an admin from chat (and could no longer access admin commands)

Code: [Select]
if(isAdmin(args.player)) then
local text = args.text
if string.sub(text, 1, 1) ~= "/" then
print(adminPrefix .. args.player:GetName() .. ": " .. text), Color(255, 48, 48))
return false

end

end
Uhhh, it looks like you removed the normal Chat:Broadcast. I said to add the print, not overwrite.

Here, I'll just add it to the code:
Code: [Select]
if(isAdmin(args.player)) then
local text = args.text
if string.sub(text, 1, 1) ~= "/" then
Chat:Broadcast(adminPrefix .. args.player:GetName() .. ": " .. text, Color(255, 48, 48))
print(adminPrefix .. args.player:GetName() .. ": " .. text)
return false
end
end
Replace the code you posted with this code and it should work fine.

Ah silly me. Thanks that worked perfectly!