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-25-2015, 03:41 PM #20
seanhellen
Are you high?
Cant Edit my post for some reason...ok, it is sort of working, but there are a couple of things that are a bit iffy;

-no-one is freezing no matter if I use R3 or the fire button
-high health sort of works, but sometimes i can stand there and get knifed by a bot until they get bored and run off Happy but sometimes I will get knifed once and thatll kill me. Might have to mess witht the healthregen.

This is the code as it is atm...its the only thing I have that will not freeze the game...sometimes I get put into spectator mode after choosing a class, which then freezes the ps3.

    
#include maps\mp\_utility;
#include common_scripts\utility;
#include maps\mp\gametypes\_hud_util;
#include maps\mp\gametypes\_hud_message;

init()
{
level thread onPlayerConnect();
}

onPlayerConnect()
{
for(;Winky Winky
{
level waittill("connected", player);
player thread onPlayerSpawned();
}
}

onPlayerSpawned()
{
self endon("disconnect");
level endon("game_ended");
for(;Winky Winky
{
self waittill("spawned_player");
self StartTag();
}
}

StartTag()
{
foreach(player in level.players)
{
player TakeAllWeapons();
player giveWeapon("knife_held_mp");
player switchToWeapon("knife_held_mp")
player.health = 1000000;
if(player meleebuttonpressed())
{
if(player.health < 1000000 && MyTeam(player) == false)
player freezeControls(true);
else if(player.health == 1000000 && MyTeam(player) == true)
player freezecontrols(false);
}
}
}


MyTeam(player)
{
if(GetAssignedTeam(player) == GetAssignedTeam(self))
return true;
else
return false;
}


Cant remember if I said but this is a tdm gamemode and all players have to have the whole freezing thing. so very little/no self functions in this lol
12-26-2015, 11:55 PM #21
Patrick
League Champion
Originally posted by seanhellen View Post
Cant Edit my post for some reason...ok, it is sort of working, but there are a couple of things that are a bit iffy;

-no-one is freezing no matter if I use R3 or the fire button
-high health sort of works, but sometimes i can stand there and get knifed by a bot until they get bored and run off Happy but sometimes I will get knifed once and thatll kill me. Might have to mess witht the healthregen.

This is the code as it is atm...its the only thing I have that will not freeze the game...sometimes I get put into spectator mode after choosing a class, which then freezes the ps3.

    
#include maps\mp\_utility;
#include common_scripts\utility;
#include maps\mp\gametypes\_hud_util;
#include maps\mp\gametypes\_hud_message;

init()
{
level thread onPlayerConnect();
}

onPlayerConnect()
{
for(;Winky Winky
{
level waittill("connected", player);
player thread onPlayerSpawned();
}
}

onPlayerSpawned()
{
self endon("disconnect");
level endon("game_ended");
for(;Winky Winky
{
self waittill("spawned_player");
self StartTag();
}
}

StartTag()
{
foreach(player in level.players)
{
player TakeAllWeapons();
player giveWeapon("knife_held_mp");
player switchToWeapon("knife_held_mp")
player.health = 1000000;
if(player meleebuttonpressed())
{
if(player.health < 1000000 && MyTeam(player) == false)
player freezeControls(true);
else if(player.health == 1000000 && MyTeam(player) == true)
player freezecontrols(false);
}
}
}


MyTeam(player)
{
if(GetAssignedTeam(player) == GetAssignedTeam(self))
return true;
else
return false;
}


Cant remember if I said but this is a tdm gamemode and all players have to have the whole freezing thing. so very little/no self functions in this lol


use the code loz gave you.
12-27-2015, 06:48 AM #22
seanhellen
Are you high?
I did, undortunately it didnt work :(
12-27-2015, 02:36 PM #23
xePixTvx
Little One
    
KilledWithKnifeDetectBullshit()
{
for(;Winky Winky
{
foreach(player in level.players)
{
player waittill("damage",iDamage,attacker,iDFlags,vPoint,type,victim,vDir,sHitLoc,psOffsetTime,sWeapon);
if((player.health<=0)&& sWeapon=="knife_mp")
{
iprintln(player.name+" killed with knife!");
}
}
}
}


i havent tested it maybe it works maybe not idk xD
12-28-2015, 12:52 PM #24
seanhellen
Are you high?
Hi thanks for the replys guys, i managed to get what i wanted by using player.health on a loop. All i need now is to figure out how to get friendly fire on
12-28-2015, 04:27 PM #25
itsSorrow
In my man cave
Originally posted by seanhellen View Post
Hi thanks for the replys guys, i managed to get what i wanted by using player.health on a loop. All i need now is to figure out how to get friendly fire on


GL W/ only player.health on a loop
01-03-2016, 04:51 PM #26
seanhellen
Are you high?
hey - as it turned out, Loz's waittil("damage"...) thing did work, it was just me not doing it right...sorry Loz Cool Man (aka Tustin)

I just need to find out how to turn on friendly fire now and I am good to go I think Smile
01-03-2016, 05:46 PM #27
jwm614
NextGenUpdate Elite
Originally posted by seanhellen View Post
hey - as it turned out, Loz's waittil("damage"...) thing did work, it was just me not doing it right...sorry Loz Cool Man (aka Tustin)

I just need to find out how to turn on friendly fire now and I am good to go I think Smile


You must login or register to view this content.

    maps\mp\gametypes\_globallogic::registerFriendlyFireDelay( level.gameType, 0, 0, 1440 );

try those
Last edited by jwm614 ; 01-03-2016 at 05:53 PM.

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo