Liberty Unleashed

Scripting => Script Help => Topic started by: Motley on October 28, 2015, 08:47:06 pm

Title: God mode on certain skin ids
Post by: Motley on October 28, 2015, 08:47:06 pm
I would like to create a script for my server that on certain skin ids you cannot kill. basically say skin 0 Claude if you are 0 you can not kill. as well if you are with skin = hobos, gangs, pimps, hookers, etc. i really don't know how i should start this script. i should be able to create the script and copy and paste it over and over until complete .

Any help would be nice on configuring this script.

This is a main script i need on my server.

Thanks for reading
Title: Re: God mode on certain skin ids
Post by: [RU]Kewun on October 28, 2015, 09:02:32 pm
try something like IfPlayerSkin( == id );
player.Immune = true;
i dont know
Title: Re: God mode on certain skin ids
Post by: Motley on October 28, 2015, 09:19:17 pm
i feel like this would belong in the section of

 function onPlayerSkin

i will play around with this.

Thank you
Title: Re: God mode on certain skin ids
Post by: Motley on October 28, 2015, 09:36:06 pm
Wont work >:(. nothing but errors now i feel like your avatar, Luckily this is day one and i already have a suggestion maybe with your help and someone else i can figure this out.

Thank you.

ill Research God mode in the forums and see what i can use and modify the god mode with what you gave me.
Title: Re: God mode on certain skin ids
Post by: [RU]Kewun on October 29, 2015, 06:20:53 am
try
function onPlayerSkin( player, skin );
{
             ifPlayerSkin == 1;
             player.Immune = true;
}
works?
Title: Re: God mode on certain skin ids
Post by: rwwpl on October 29, 2015, 10:09:57 am
Code: [Select]
function onPlayerSkinChange( player, old, new )
{
     if (new == 1) player.Immune = true;
     else player.Immune = false;
     return 1;
}
Title: Re: God mode on certain skin ids
Post by: Motley on October 29, 2015, 01:32:32 pm
This is awesome thank you. Have not tested. only issue i did not realize is this should of been created as a class script. for instance if you are tonny cipriani then you should be immune to anyone else's skin related/gang related. but if not it's fine i can literally get it working and maybe modify it. Thanks so much rwwpl. Trevor you we're very close. i really appreciate your attempts to help me.
Title: Re: God mode on certain skin ids
Post by: Motley on October 29, 2015, 02:05:39 pm
function onPlayerSkinChange( player, old, new )
{
     if (new == 1) player.Immune = true;
     if (new == 5) player.Immune = true;
     else player.Immune = false;
     return 1;
}

something like this may work.
Title: Re: God mode on certain skin ids
Post by: [RU]Kewun on October 29, 2015, 03:06:17 pm
i know, im not a scripting master.
Title: Re: God mode on certain skin ids
Post by: Motley on October 29, 2015, 05:43:52 pm
okay the actual script works but in the spawn screen if you go to the skin that way it dosnt work, unless you type /skin even if you are that skin already... no clue to why this is like this. i will have to play with the actual script
Title: Re: God mode on certain skin ids
Post by: [RU]Kewun on October 29, 2015, 06:33:33 pm
player.Skin = skinid; maybe
Title: Re: God mode on certain skin ids
Post by: Theremin on October 30, 2015, 03:41:53 am
okay the actual script works but in the spawn screen if you go to the skin that way it dosnt work, unless you type /skin even if you are that skin already... no clue to why this is like this. i will have to play with the actual script

Because that function is triggered only when the player changes its skin and thus spawning with a skin isn't considered a "change". Try:
Code: [Select]
function onPlayerSpawn( player, spawn )
{
if (player.Skin == 1) player.Immune = true;
else player Immune = false;
}

This function is triggered when you leave the spawnscreen upon join, as well as everytime you die and respawn.
Title: Re: God mode on certain skin ids
Post by: Motley on November 01, 2015, 02:53:07 am
hmm appears this creates god mode instead on that player only way to be able to kill is threw head shot i will play with it more. i appreciate everyone's help.

Code: [Select]
function onPlayerSpawn( player, spawn )
{
if (player.Skin == 1) player.Immune = true;
else player Immune = false;
}

This function is triggered when you leave the spawnscreen upon join, as well as everytime you die and respawn.
Title: Re: God mode on certain skin ids
Post by: Theremin on November 01, 2015, 05:44:28 am
That's because the headshot.nut client script, overrides this server script, so you can either disable the headshot script, or making a godmode script through client, here is a topic (http://forum.liberty-unleashed.co.uk/index.php/topic,1691.0.html) which shows different ways of creating godmode through client, then you'd just need to add a way to check skin for it.
Title: Re: God mode on certain skin ids
Post by: Motley on November 01, 2015, 05:56:43 am
I really appreciate everything.

until i fix it completely ill just set message player on spawn to type there skin /skin of there selected player after each time killed to ensure that there team don't kill them.

until i find a way to do something like findplayerskin function with a timer.. idk something

 ill figure something out the main objective is complete.

Thanks to everyone

Ps im applauding everyone