View previous topic :: View next topic |
Author |
Message |
redrum

Joined: 28 Mar 2007 Posts: 367 Location: Long Island, New York
|
Posted: Mon Feb 18, 2008 5:40 am Post subject: Death timer? |
|
|
Guys once again I am in a bind.
I'm trying to get a timer started when the player dies and stops when the player respawns and grabs his first item.
In Clientobituary() I tried:
Code: | targ.deathtimer = time + 3; //(I want my actions to take place 3 seconds after death)
if (targ.deathtimer == time)
if (targ.netname == "redrum")
stuffcmd(targ, "say nice shot!\n"); |
Stopping the timer would be easy, so I don't need help with that part.
Any suggestions? _________________ Welcome to the Overlook Hotel 69.113.123.178:27500 |
|
Back to top |
|
 |
Willem
Joined: 23 Jan 2008 Posts: 73
|
Posted: Mon Feb 18, 2008 10:17 am Post subject: |
|
|
I'm new to QuakeC but would:
Code: | if (targ.deathtimer >= time) |
Be any more reliable? Checking for == with floats is often bad news in C based languages. _________________ www.wantonhubris.com |
|
Back to top |
|
 |
Orion

Joined: 12 Jan 2007 Posts: 414 Location: Brazil
|
Posted: Mon Feb 18, 2008 1:09 pm Post subject: |
|
|
ClientObituary() is only called after a player is killed... if you check for that in there it won't work properly.
Remove the time check but keep this line and add another after it:
Code: |
targ.deathtimer = time + 3;
targ.dontloop = 0;
|
and put this new one in PlayerPreThink():
Code: |
if (self.deathtimer < time)
if (damage_attacker != self)
if (!self.dontloop)
{
self.dontloop = 1;
stuffcmd (self, "say nice shot!\n");
}
|
And at the very top of the file, add this line:
And it should work.  _________________ There's no signature here. Stop looking for one. |
|
Back to top |
|
 |
|