Author Topic: godmode for admin..  (Read 1877 times)

Maximom

  • Newbie
  • *
  • Posts: 31
  • Karma: +5/-6
  • C.R.C colonel
    • View Profile
godmode for admin..
« on: May 18, 2013, 09:02:45 am »
hi, how i can get a godmode script for the server on a lan ???
C.r.c member

Benedani

  • Newbie
  • *
  • Posts: 17
  • Karma: +2/-0
    • View Profile
Re: godmode for admin..
« Reply #1 on: July 03, 2015, 11:17:05 pm »
Make a client script.
In it:
Code: [Select]
local godmode = false;

function onClientRender() {
local plr = FindLocalPlayer();
if (godmode)
{
plr.Health = 100;
plr.Armour = 100;
}
}

function onClientCommand ( szCommand, szParams )
{
if (szCommand == "godmode")
{
if (godmode) {
godmode = false;
Message("Godmode turned off");
}
else {
godmode = true;
Message("Godmode turned on");
}
}
return 1;
}
Note: this will glitch it when your car explodes while you're inside it. It will register the death twice, instead of not dying. This is only good for water accidents, pvp matches, etc

If you want to make it admin only, then here's the script for that:
Code: [Select]
local godmode = false;
local isadmin = false;

function onClientRender() {
local plr = FindLocalPlayer();
if (godmode)
{
plr.Health = 100;
plr.Armour = 100;
}
}

function onClientSpawn( pClass )
{
local player = FindLocalPlayer();
if (player.Name == "yournamehere")
{
IsAdmin = true;
}
}

function onClientCommand ( szCommand, szParams )
{
if (szCommand == "godmode")
{
if (IsAdmin)
{
if (godmode) {
godmode = false;
Message("Godmode turned off");
}
else {
godmode = true;
Message("Godmode turned on");
}
}
}
return 1;
}
« Last Edit: July 03, 2015, 11:21:36 pm by Benedani »

rwwpl

  • Full Member
  • ***
  • Posts: 126
  • Karma: +18/-6
  • LU-DM Team
    • View Profile
    • LU-DM Team
Re: godmode for admin..
« Reply #2 on: July 04, 2015, 01:15:13 am »
Nice bump...

This is a good example for god mode...

Code: [Select]
// The following events protect the player from getting hurt while they are in free view mode.
function onClientShot( attacker, weapon, bodypart )
{
if ( pCamera.IsEnabled() ) return 0;
return 1;
}

function onClientHurt( entity )
{
if ( pCamera.IsEnabled() ) return 0;
return 1;
}

Ankris

  • Full Member
  • ***
  • Posts: 110
  • Karma: +29/-44
    • View Profile
Re: godmode for admin..
« Reply #3 on: July 04, 2015, 01:19:11 pm »
pls

Code: [Select]
god_mode <- false;
function onClientHurt(entity) { if (god_mode) { return 0; } }
function onClientShot(attacker, weapon, part) { if (god_mode) { return 0; } }
function onClientCommand(command, text) { if (command == "god") { if (god_mode) { god_mode = false; }else{ god_mode = true; } } }

[RU]Kewun

  • Full Member
  • ***
  • Posts: 126
  • Karma: +11/-21
  • C.R.C Marshal
    • View Profile
Re: godmode for admin..
« Reply #4 on: July 06, 2015, 08:12:33 am »
xdddd
edit: best example is from benedani,cuz uses admin
Fear the wrath of god!


Vortrex

  • Full Member
  • ***
  • Posts: 267
  • Karma: +54/-73
    • View Profile
Re: godmode for admin..
« Reply #5 on: July 07, 2015, 06:00:09 am »
This is an alternative to Ankris's snippet.

Code: [Select]
vulnerable <- true;
function onClientHurt(entity) { return vulnerable; }
function onClientShot(attacker, weapon, part) { return vulnerable; }
function onClientCommand(command, text) { if(command == "god") { vulnerable = !vulnerable; } }

PerikiyoXD

  • Newbie
  • *
  • Posts: 16
  • Karma: +3/-2
  • DUUH DO IT NOW!
    • View Profile
Re: godmode for admin..
« Reply #6 on: July 08, 2015, 06:13:37 pm »
The "var = !var" switch is very handy

 

© Liberty Unleashed Team.