ULX

Author Topic: Gmod automatic AOD god (and message)  (Read 2712 times)

0 Members and 1 Guest are viewing this topic.

Offline Shadowmist

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Gmod automatic AOD god (and message)
« on: January 21, 2017, 12:52:51 PM »
Hello there, I was wondering if you guys have an idea on how to make it say "*player* has gone AOD!"

Here's my system for the godmode
Code: [Select]
if (SERVER) then

local adminondutyteams = { TEAM_ADMIN }

hook.Add("PlayerShouldTakeDamage", "godmodeAdminsss", function(ply)
if ( ply:IsPlayer() ) then
for i, v in ipairs(adminondutyteams) do
if ply:Team() == v then
return false
end
end
end
end

But does anyone have a clue how to make it so it says *playername* has gone aod!?
Would I have to make a PlayerSay hook that gets called when they go admin on duty? I am not sure how though.
Maybe
if Player:Team == TEAM_ADMIN then
AddChat( "v:Nick has gone AOD!" )
?????? Thank you.

Offline Shadowmist

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Re: Gmod automatic AOD god (and message)
« Reply #1 on: January 21, 2017, 02:52:26 PM »
I need to test this ingame but I believe I've found it.
Code: [Select]
concommand.Add( "Shadowfunc",
function shadowfunction()
local ply = LocalPlayer()
if ply:Team() == "TEAM_ADMIN" then
ply:GodEnable
else
print "You're not admin! You can NOT have godmode! HAHAHAH"
end
end
Lmao wait I forgot to add the addchat thing.. the point in making this post xD

Offline BlueNova

  • Full Member
  • ***
  • Posts: 113
  • Karma: 13
  • The most powerful force in the universe.
Re: Gmod automatic AOD god (and message)
« Reply #2 on: January 21, 2017, 08:29:30 PM »
This is just something I noticed.

But first thing when you have
Code: [Select]
print "You're not admin! You can NOT have godmode! HAHAHAH"
It prints in console. If you want an error print it's more like

Code: [Select]
ULib.tsayError( calling_ply, "You're not admin, you cannot have godmode!" )
Furthermore,

When you try to get someone's nickname it needs to be v:Nick()
Just doing v:Nick won't work (at least I won't think it will)

As for
Quote
But does anyone have a clue how to make it so it says *playername* has gone aod!?
Would I have to make a PlayerSay hook that gets called when they go admin on duty? I am not sure how though.
Maybe
if Player:Team == TEAM_ADMIN then
AddChat( "v:Nick has gone AOD!" )
?????? Thank you.

Perhaps adding the following instead

Code: [Select]
ulx.fancyLogAdmin( calling_ply, "#A has gone AOD!" )though DarkRP should have a default way to echo if someone changes class.

I haven't worked with DarkRP too much so this may not be 100% correct, but it's just stuff I noticed.



Edit: Ignore most of the above. I didn't see you were making hooks and the likes. What I wrote probably won't work but I'll leave it just in case it does.
« Last Edit: January 21, 2017, 09:16:56 PM by BlueNova »

Offline Shadowmist

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Re: Gmod automatic AOD god (and message)
« Reply #3 on: January 22, 2017, 03:45:18 AM »
I have some sort of idea now.
I've scrapped all of that.
Here's how the chat thing works:
Serverside is
Code: [Select]
util.AddNetworkString( "sf_name" )


concommand.Add( "Shadowfunc",
function aod()
local ply = LocalPlayer()
if ply:Team() == "TEAM_ADMIN" then
ply:GodEnable
else
print "You're not admin! You can NOT have godmode! HAHAHAH"
end
net.Start( "sf_name" )
net.WriteString( ply:Name )
net.Send( ply )
end )

clientside is
Code: [Select]
function HasGoneAod()
local name = net.ReadString()

chat.AddText( color( 0, 255, 255 ), name, "Has gone AOD! And have granted godmode upon themself.")
end