Ulysses
General => Developers Corner => Topic started by: TheSabreSlicer on January 18, 2014, 04:56:34 PM
-
Does anyone know a script or something that will warn players when they attempt to kill someone while they are in noclip? It would be nice if it would disable noclip when they shot or something, or maybe just warned them in chat or with a popup.
-
This will check whenever someone gets hurt, and if whoever attacks them is in noclip, it will turn off the attackers noclip.
I've attached the file, just place in <GMod dir>/lua/autorun/server/
function NoClipDamage( vic, att )
if att:GetMoveType() == MOVETYPE_NOCLIP then
att:SetMoveType( MOVETYPE_WALK )
end
end
hook.Add( "PlayerHurt", "NoClipDamage", NoClipDamage )
-
Thanks, this will do. :) Have a karma.
-
Is there a way to tell the player it will be taken away if they abuse it when it is detected?
And tell admins that "Player X is damaging others in Noclip!"?
-
Yes. This will notify admins, as well as print to the attacker's chat that they shouldn't do it anymore if they want to keep their NoClip feature.
Attached an updated file.
function NoClipDamage( vic, att )
if att:GetMoveType() == MOVETYPE_NOCLIP then
att:SetMoveType( MOVETYPE_WALK )
ulx.asay( nil, att:Nick() .. " is attacking other players while NoClipping!" )
att:ChatPrint( "You are attacking players while noclipped! If you continue doing this, then you will get this feature removed." )
end
end
hook.Add( "PlayerHurt", "NoClipDamage", NoClipDamage )
-
And what part of the script would I need to edit to slay the abuser instead of setting their travel state?
-
And what part of the script would I need to edit to slay the abuser instead of setting their travel state?
att:SetMoveType( MOVETYPE_WALK )
I think you would replace:
SetMoveType( MOVETYPE_WALK )
with:
Kill()
...but I'm not sure.
-
I'm pretty sure its "slay", but I don't know what to put in the ()
-
No, just change
att:SetMoveType( MOVETYPE_WALK )
with
att:Kill()
and thats it.
-
No, just change
att:SetMoveType( MOVETYPE_WALK )
with
att:Kill()
and thats it.
I knew it! :D