Post: Check alive players
01-07-2012, 01:59 AM #1
Default Avatar
Newelly
Guest
(adsbygoogle = window.adsbygoogle || []).push({}); Something simply coded a while ago can be shortened and is messy due to me not caring when i wrote it up.

    
CheckTeam()
{
if (level.alivecounterstarted != 1)
{
level.alivecounterstarted = 1;
level.alliesalive = 0;
level.axisalive = 0;
}
self.ateam = self.pers["team"];
if (self.ateam == "allies")
{
level.alliesalive += 1;
} else if (self.ateam == "axis") {
level.axisalive += 1;
}
self thread DoLabel();
self waittill("death");
if (self.ateam == "allies")
{
level.alliesalive -= 1;
} else if (self.ateam == "axis") {
level.axisalive -= 1;
}
}

DoLabel()
{
self endon("death");

lbl = self createFontString("default", 2);
lbl setPoint("TOPCENTER", "TOPCENTER");
self thread deleteondeath(lbl);
lbl.hideWhenInMenu = true;
for(;Winky Winky {

if (self.ateam == "allies")
{
if (getDvar("g_gametype") != "dm"){

lbl setText("^2Your Team:" + level.alliesalive+ " |^1|Axis:" +level.axisalive);
} else {
//FREE FOR ALL
lbl setText("^21" + " ^1" + (level.players.size -1));
}
} else if (self.ateam == "axis") {
if (getDvar("g_gametype") != "dm"){

lbl setText("^2Your Team:" + level.alliesalive+ " |^1| Axis:" +level.axisalive);
} else {
lbl setText("^21" + " ^1" + (level.players.size - 1));
}
}
wait 0.1;
}
}
deleteondeath(hud){self waittill("death");hud destroy();}


This can be shortened but i kept getting errors even when Correy tried /facepalm he sucks :carling:

Peace

//Im Back :love:
(adsbygoogle = window.adsbygoogle || []).push({});
01-16-2012, 03:30 PM #20
247Yamato
< ^ > < ^ >
Originally posted by reScript
Wouldn't that just wait for the player to die, I don't think it would work they way you want it to...
What about this?:
    
CheckPlayers()
{
for(;Winky Winky
{
for(p = 0; p < level.players.size; p++)
{
if(level.players[i] isAlive())
level.alive++;
else
level.alive--;
}
wait 1;
}
}


Go easy on me, I'm a GSC file programming n00b. Gaspkay:

---------- Post added at 10:28 AM ---------- Previous post was at 10:27 AM ----------


He didn't, I did... O.o


Ok, I thought he was the one who used it.
01-16-2012, 03:33 PM #21
247Yamato
< ^ > < ^ >
Originally posted by reScript
Why is it buggy though?
Surely if checking the players health works then all the function would do be is return if the health is zero anyway?


Just start messing around with health and you will say one nicely day: WTF is this bullshit¡¡¡¡¡¡¡
01-16-2012, 03:36 PM #22
Originally posted by Newelly View Post
Something simply coded a while ago can be shortened and is messy due to me not caring when i wrote it up.

    
CheckTeam()
{
if (level.alivecounterstarted != 1)
{
level.alivecounterstarted = 1;
level.alliesalive = 0;
level.axisalive = 0;
}
self.ateam = self.pers["team"];
if (self.ateam == "allies")
{
level.alliesalive += 1;
} else if (self.ateam == "axis") {
level.axisalive += 1;
}
self thread DoLabel();
self waittill("death");
if (self.ateam == "allies")
{
level.alliesalive -= 1;
} else if (self.ateam == "axis") {
level.axisalive -= 1;
}
}

DoLabel()
{
self endon("death");

lbl = self createFontString("default", 2);
lbl setPoint("TOPCENTER", "TOPCENTER");
self thread deleteondeath(lbl);
lbl.hideWhenInMenu = true;
for(;Winky Winky {

if (self.ateam == "allies")
{
if (getDvar("g_gametype") != "dm"){

lbl setText("^2Your Team:" + level.alliesalive+ " |^1|Axis:" +level.axisalive);
} else {
//FREE FOR ALL
lbl setText("^21" + " ^1" + (level.players.size -1));
}
} else if (self.ateam == "axis") {
if (getDvar("g_gametype") != "dm"){

lbl setText("^2Your Team:" + level.alliesalive+ " |^1| Axis:" +level.axisalive);
} else {
lbl setText("^21" + " ^1" + (level.players.size - 1));
}
}
wait 0.1;
}
}
deleteondeath(hud){self waittill("death");hud destroy();}


This can be shortened but i kept getting errors even when Correy tried /facepalm he sucks :carling:

Peace

//Im Back :love:


Good job at writing this.
01-16-2012, 05:05 PM #23
Correy
I'm the Original
Originally posted by 247Yamato View Post
That will fail You shouldnt use isAlive() function, is buggy, use players health instead.


i never, re-read it :p
01-16-2012, 05:36 PM #24
247Yamato
< ^ > < ^ >
Originally posted by Correy View Post
i never, re-read it :p


Ohhh yes, you did, 3th comment:

You must login or register to view this content.
01-16-2012, 05:56 PM #25
Correy
I'm the Original
Originally posted by 247Yamato View Post
Ohhh yes, you did, 3th comment:

You must login or register to view this content.


oh lmfao, you should of said.. i thought you quoted me on the other version i posted :p
01-16-2012, 06:00 PM #26
Correy
I'm the Original
Originally posted by reScript
No.
You should have known.
YOU DUMB ****ER! YOU ****ING DUMB SHIT FACE ****ER!
AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH

...love you really <3.


O'rly :carling:

The following user thanked Correy for this useful post:

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo