mirror of
https://github.com/ineedbots/iw5_bot_warfare.git
synced 2025-04-26 07:34:50 +00:00
added showhp script
This commit is contained in:
parent
5d6e80e2d4
commit
0b7e576e50
66
raw/scripts/showHP.gsc
Normal file
66
raw/scripts/showHP.gsc
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
#include common_scripts\utility;
|
||||||
|
#include maps\mp\_utility;
|
||||||
|
#include maps\mp\gametypes\_hud_util;
|
||||||
|
|
||||||
|
init()
|
||||||
|
{
|
||||||
|
setDvarIfUninitialized( "scr_showHP", false );
|
||||||
|
level.showHP = getDvarInt("scr_showHP");
|
||||||
|
|
||||||
|
level thread onPlayerConnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
onPlayerConnect()
|
||||||
|
{
|
||||||
|
for(;;)
|
||||||
|
{
|
||||||
|
level waittill( "connected", player);
|
||||||
|
player thread onPlayerSpawned();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onPlayerSpawned()
|
||||||
|
{
|
||||||
|
self endon("disconnect");
|
||||||
|
for(;;)
|
||||||
|
{
|
||||||
|
self waittill("spawned_player");
|
||||||
|
|
||||||
|
if(level.showHP)
|
||||||
|
self thread drawHP();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
destoryHPdraw()
|
||||||
|
{
|
||||||
|
self waittill_either("disconnect", "death");
|
||||||
|
self.drawHP destroy();
|
||||||
|
self.drawSpeed destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
initHPdraw()
|
||||||
|
{
|
||||||
|
self.drawHP = self createFontString("default", 1.2);
|
||||||
|
self.drawHP setPoint("BOTTOMRIGHT", "BOTTOMRIGHT", -150, -20);
|
||||||
|
self thread destoryHPdraw();
|
||||||
|
|
||||||
|
self.drawSpeed = self createFontString("default", 1.2);
|
||||||
|
self.drawSpeed setPoint("BOTTOMRIGHT", "BOTTOMRIGHT", -150, -10);
|
||||||
|
self thread destoryHPdraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
drawHP()
|
||||||
|
{
|
||||||
|
self endon( "disconnect" );
|
||||||
|
self endon( "death" );
|
||||||
|
self initHPdraw();
|
||||||
|
for(;;)
|
||||||
|
{
|
||||||
|
//self.drawHP setText("HP: "+self.health+" KS: "+self.pers["cur_kill_streak"]);
|
||||||
|
self.drawHP setValue(self.health);
|
||||||
|
|
||||||
|
vel = self getVelocity();
|
||||||
|
self.drawSpeed setValue(int(length((vel[0], vel[1], 0))));
|
||||||
|
wait 0.05;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user