Hey all,
I was wondering how I could force a player to spawn, if possible.
So if the player is dead, I would like the ability for a flag to make them spawn. I've seen this ability on a few other worlds, so I'm wondering how they might have done it. I tried playerRecord->spawned = true, but that didn't work.
Thanks,
Grue
Force a spawn
Re: Force a spawn
While the design of the game allows for the server to tell a player to spawn, I don't believe the bzfs API exposes a way to do that.
Re: Force a spawn
If you are ready to go off the beaten path..
Code: Select all
#include "../src/bzfs/bzfs.h"
..
..
playerAlive(playerID);
Re: Force a spawn
Or just add an API function...
Re: Force a spawn
That did the trick! Thanks so much!
Grue
Grue
Re: Force a spawn
Hmm alright another question on this matter...
I'm trying to give the player a flag immediately after they get killed and spawn back in. I kill the player using bz_killPlayer, then use the playerAlive function to spawn them back in. Right after they spawn back in, I'm trying to give them a flag in the bz_ePlayerSpawnEvent. Unfortunately, the flag won't give to the player. In the console, it just says "Grue grabbed <flag>", "Grue dropped <flag>"
Any idea why I can't give a flag to a player immediately after I spawn them in using the playerAlive function? When a player spawns in normally, the flag gives fine.
Thanks,
Grue
I'm trying to give the player a flag immediately after they get killed and spawn back in. I kill the player using bz_killPlayer, then use the playerAlive function to spawn them back in. Right after they spawn back in, I'm trying to give them a flag in the bz_ePlayerSpawnEvent. Unfortunately, the flag won't give to the player. In the console, it just says "Grue grabbed <flag>", "Grue dropped <flag>"
Any idea why I can't give a flag to a player immediately after I spawn them in using the playerAlive function? When a player spawns in normally, the flag gives fine.
Thanks,
Grue
Re: Force a spawn
Have you tried passing 1 as third parameter to bz_givePlayerFlag?
I do remember bringing players back alive immediately after being killed causing issues. Try delaying the playerAlive call by a short duration. One way is to add the player id to a list and call playerAlive on next tick event and empty the list.
I do remember bringing players back alive immediately after being killed causing issues. Try delaying the playerAlive call by a short duration. One way is to add the player id to a list and call playerAlive on next tick event and empty the list.
Re: Force a spawn
Hey, thanks for the reply. I solved this by just setting a timer and giving the flag back after a fraction of a second.
Thanks again,
Grue
Thanks again,
Grue