Posts: 175
Threads: 30
Joined: Jun 2010
Reputation:
0
So I'm recently starting to learn scripting again, and I have a problem.
Whenever somebody dies he spawns at BlueBerry. I tried to put SetPlayerPos in OnPlayerSpawn, but now when a player logs in he spawns at the hospital (I have a register/save system). How can I fix this?
Thanks in advance!
Posts: 175
Threads: 30
Joined: Jun 2010
Reputation:
0
Well, I've put SetPlayerPos and then the coordinates of the hospital under OnPlayerSpawn. So now, when someone dies it teleports him to the hospital, but also when a player connects it teleports him to there, while it should teleport him to his last X, Y, Z.
When I remove the SetPlayerPos from my OnPlayerSpawn, it works fine when you log in, it'll teleport you to your last X, Y, Z. But when you die you just teleport back to Blueberry. I'm not working with teams or anything similar.
Posts: 973
Threads: 10
Joined: Sep 2012
Reputation:
0
So what's the issue?you want players who die to get teleportd to the Hospital and those who didn't to spawn in the usual places?
Posts: 175
Threads: 30
Joined: Jun 2010
Reputation:
0
Yes, that's exactly what I want. But I can't make it work. Can you help me?
Posts: 7,801
Threads: 187
Joined: Feb 2010
Reputation:
0
When a player dies, you would want to set a bool variable to true. So, for example: justDied[playerid] = true;
Obviously, set that under OnPlayerDeath. Under OnPlayerSpawn, check to see if justDied[playerid] is equal to true. To do that: if(justDied[playerid])
If it is, spawn them at the hospital and set the bool back to false. Otherwise, spawn them as usual (as per your accounts system).
Make sense?
Posts: 175
Threads: 30
Joined: Jun 2010
Reputation:
0
Yes, that makes sense. I'll try it out!