Liberty Unleashed

Scripting => Script Help => Topic started by: Maximom on May 18, 2013, 08:02:45 am

Title: godmode for admin..
Post by: Maximom on May 18, 2013, 08:02:45 am
hi, how i can get a godmode script for the server on a lan ???
Title: Re: godmode for admin..
Post by: Benedani on July 03, 2015, 10: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;
}
Title: Re: godmode for admin..
Post by: rwwpl on July 04, 2015, 12: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;
}
Title: Re: godmode for admin..
Post by: Ankris on July 04, 2015, 12: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; } } }
Title: Re: godmode for admin..
Post by: [RU]Kewun on July 06, 2015, 07:12:33 am
xdddd
edit: best example is from benedani,cuz uses admin
Title: Re: godmode for admin..
Post by: Vortrex on July 07, 2015, 05: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; } }
Title: Re: godmode for admin..
Post by: PerikiyoXD on July 08, 2015, 05:13:37 pm
The "var = !var" switch is very handy