Post: Know if a player has been knifed?
12-22-2015, 01:41 PM #1
seanhellen
Are you high?
(adsbygoogle = window.adsbygoogle || []).push({}); Hi all. I am building a gamemode atm and I was wondering if there was a way of knowing when a player has been hit...in my case knifed.

I want to freeze a player when they are knifed (not kill...everyone has godmode) and un-frozen when knifed again. I can do the freezing bit, but dont know how to see if a person has been knifed.
I have had a good look through the zeroy scripts but cant see anything that would work.

Any ideas?
Thanks

The following 2 users say thank you to seanhellen for this useful post:

FourzerotwoFAILS, HiddenHour
12-23-2015, 12:12 AM #11
seanhellen
Are you high?
Yeah, was just thinking i could do a thread for something like;
    
if(player gethealth() <= 200)
Player freeze


With other variables too, but since knife only will be used, I can do that i think. Thinking bout it, this would mean i wouldnt need godmode too :yes:

Originally posted by FourzerotwoFAILS View Post
There might be a way. The game monitors how a player was killed in order to display the proper logo in the killfeed.


Im hoping so, just cant find it lol...hoping its not part of the weapon scripts (damage inflicted, attacker, victim, etc)
Last edited by seanhellen ; 12-23-2015 at 12:17 AM.
12-23-2015, 12:18 AM #12
Originally posted by seanhellen View Post
Yeah, was just thinking i could do a thread for something like;
    
if(player gethealth() <= 200)
Player freeze


With other variables too, but since knife only will be used, I can do that i think. Thinking bout it, this would mean i wouldnt need godmode too :yes:


This could cause a potential bug in the gamemode though. The person that is "it" could just double knife a player and kill them. Or a player could be frozen or unfrozen by someone that is not "it"
12-23-2015, 12:24 AM #13
seanhellen
Are you high?
Yeah I have 3 check atm...team check, health and another which ive forgottem lol. and i can set the health to a huge number so a few knife attacks wont do anything...or give godmode to the frozen

Ps its going to be a tdm mode...1st team to tag all the opposing team wins. Knife an enemy to freeze him, knife a friendly to unfreeze him
Last edited by seanhellen ; 12-23-2015 at 12:28 AM.
12-23-2015, 02:43 AM #14
Originally posted by seanhellen View Post
Yeah I have 3 check atm...team check, health and another which ive forgottem lol. and i can set the health to a huge number so a few knife attacks wont do anything...or give godmode to the frozen

Ps its going to be a tdm mode...1st team to tag all the opposing team wins. Knife an enemy to freeze him, knife a friendly to unfreeze him


Sounds good man. Let me know if you need help with anything Winky Winky
12-23-2015, 09:14 AM #15
seanhellen
Are you high?
Will do FourzerotwoFAILS Thanks Winky Winky

***EDIT***
Ok, the health thing didn't work...doesn't matter what I set the health to, 1 knife kills the player. Am starting to wonder if the damage is a percentage...i.e knife attack is 100% damage.

Also, I have a foreach loop for all the players in the game and inside is a give knife command. The problem is that the spinning-knife-in-the-hand animation does it everytime someone spawns - so it goes mad at 1st spawn whilst everyone gets in, then it spins every time someone dies and respawns - although this is a minor thing as no-one dies in the tag gamemode.

Dont know how I'm gonna do the health thing though....:(
Last edited by seanhellen ; 12-23-2015 at 10:21 AM.
12-24-2015, 01:24 AM #16
Patrick
League Champion
Originally posted by seanhellen View Post
Will do FourzerotwoFAILS Thanks Winky Winky

***EDIT***
Ok, the health thing didn't work...doesn't matter what I set the health to, 1 knife kills the player. Am starting to wonder if the damage is a percentage...i.e knife attack is 100% damage.

Also, I have a foreach loop for all the players in the game and inside is a give knife command. The problem is that the spinning-knife-in-the-hand animation does it everytime someone spawns - so it goes mad at 1st spawn whilst everyone gets in, then it spins every time someone dies and respawns - although this is a minor thing as no-one dies in the tag gamemode.

Dont know how I'm gonna do the health thing though....:(


Just do the radius bro, that is what i would do.
12-24-2015, 12:44 PM #17
I'm pretty sure you can't get a return from a knife unless that player was killed, change godmode to self.health to 9999 which is semi-god and monitor if after the knife button is pressed, any of the players will get a decrease in health, you'll have to everyone lightweight unless they can lose health with falling damage, hope it helps:

add me on skype, I have a couple more ideas: wasborntostandout

    OnplayerSpawned()
StartMonitor();

StartMonitor()
{
self.health = 9999;
MonitorKnife();
}

MonitorKnife()
{
self endon("death");
for(;Winky Winky
{
if(Self meleebuttonpressed())
{
wait 0.01;
foreach(player in level.players)
{
if(player.health < 9999)
{
// do whatever you want with him here
}
}
}
}
}

The following user thanked Conditional for this useful post:

seanhellen
12-24-2015, 02:07 PM #18
Loz
Vault dweller
Originally posted by seanhellen View Post
snip


enjoy

    
waitForKnifeDamage()
{
self endon("disconnect");

for(;Winky Winky
{
self waittill("damage", damage, attacker, direction_vec, point, type, modelname, tagname, partname, weaponname);
if(isSubStr(weaponname, "knife"))
{
if(type == "MOD_MELEE")
{
if(!self areControlsFrozen())
self freezeControls(true);
else
self freezeControls(false);
}
}
}
}


EDIT:
loop high health instead of using enableInvulnerability() for godmode
Last edited by Loz ; 12-24-2015 at 02:12 PM.

The following 6 users say thank you to Loz for this useful post:

Conditional, FourzerotwoFAILS, itsSorrow, Patrick, seanhellen, Terrorize 420
12-24-2015, 03:54 PM #19
seanhellen
Are you high?
thanks guys - will try these :yes:

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo