Author Topic: MovePlayer in OnPlayerRespawn  (Read 1711 times)

0 Members and 3 Guests are viewing this topic.

Offline DevilX4

  • Major(1)
  • Posts: 30
MovePlayer in OnPlayerRespawn
« on: September 23, 2012, 12:20:20 pm »
I want to make a player move to a certain point of the map after being killed for a script/mod im working on.

Does anyone know why MovePlayer doesn't work in OnPlayerRespawn ?
OR does anybody know how to acheive the same result using another way?

Offline TheOne

  • Soldier
  • **
  • Posts: 208
Re: MovePlayer in OnPlayerRespawn
« Reply #1 on: September 23, 2012, 12:32:56 pm »
That depends on your use.
If you want only that single player to respawn in the location, you can modify the spawns of that team (disable all and enable one at those coordinates) and /setteam him. However, be scared of bugs like weapon dropping. I wrote a workaround for weapon drops in case you need it.
As alternative you could set global variables containing the player ID and the coordinates and move that player in the next AppOnIdle call.

If you want the whole team to respawn in that place, you can modify the spawns of the whole team before and after the respawn. That's the safest way, but might not be what you need.

Offline DevilX4

  • Major(1)
  • Posts: 30
Re: MovePlayer in OnPlayerRespawn
« Reply #2 on: September 23, 2012, 01:34:48 pm »
Thanks alot for your reply!
What you have suggested is great, but not what i'm looking for.  I've had an idea since making this thread and should work how I need it to work.
Does anyone know why you can't use MovePlayer in OnPlayerRespawn?

Offline Falcon`

  • Flagrunner
  • ****
  • Posts: 792
  • A wanted lagger
Re: MovePlayer in OnPlayerRespawn
« Reply #3 on: September 23, 2012, 01:58:59 pm »
Because OnPlayerRespawn is called before player is actually respawned.
If you're not paying for something, you're not the customer; you're the product being sold.
- Andrew Lewis

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

Offline DevilX4

  • Major(1)
  • Posts: 30
Re: MovePlayer in OnPlayerRespawn
« Reply #4 on: September 23, 2012, 02:07:08 pm »
Ah ok, maybe I should try to move them just before dying then.  Thanks for your help!

Offline Silnikos

  • Soldier
  • **
  • Posts: 129
Re: MovePlayer in OnPlayerRespawn
« Reply #5 on: October 15, 2012, 04:45:18 am »
Ah ok, maybe I should try to move them just before dying then.  Thanks for your help!
You need to move them AFTER respawning. So add a 1 second trigger on onPlayerRespawn and then execute it after this 1 second on AppOnIddle.

Offline Falcon`

  • Flagrunner
  • ****
  • Posts: 792
  • A wanted lagger
Re: MovePlayer in OnPlayerRespawn
« Reply #6 on: October 15, 2012, 06:10:49 am »
Dude, this topic is almost 1 month old, give it a break.
If you're not paying for something, you're not the customer; you're the product being sold.
- Andrew Lewis

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

Offline Silnikos

  • Soldier
  • **
  • Posts: 129
Re: MovePlayer in OnPlayerRespawn
« Reply #7 on: October 15, 2012, 09:08:45 am »
Dude, this topic is almost 1 month old, give it a break.
What's wrong in solving unsolved threads? If not him, someone else in the future might need an answer for it.

Offline Falcon`

  • Flagrunner
  • ****
  • Posts: 792
  • A wanted lagger
Re: MovePlayer in OnPlayerRespawn
« Reply #8 on: October 15, 2012, 10:57:21 am »
The last post he made clearly states he got the info he required, thus can't see in what way this thread was (is?) unsolved.
If you're not paying for something, you're not the customer; you're the product being sold.
- Andrew Lewis

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

Offline dnmr

  • Camper
  • ***
  • Posts: 315
  • emotionally handicapped
Re: MovePlayer in OnPlayerRespawn
« Reply #9 on: November 08, 2012, 12:29:07 am »
Because OnPlayerRespawn is called before player is actually respawned.
can't you just add "AfterPlayerRespawn"? |: