Weird Spawn Bug, Lot of code.
#1

Recreating this error is how it works
1st player on Server:
- Joins Server Successfully
- Logs In/Registers Successfully
- Spawns Successfully/Resumes Location Successfully, no problems

2nd Player on Server/Any Other Player
- Joins Server Successfully
- Logs In/Registers Successfully
- Spawn/Resume Failure
Errors that occur is that the player Dies Instantly after logging in, and is frozen.

Sorry if my Code is messy, It was never meant to be public, so please disregard it.
+REP to anyone who can help me to resolve this issue.
link to code: REMOVED, fixed error, was due to not setting a variable for health
Reply
#2

Try removing SpawnPlayer(playerid) and ClearAnimations(playerid) from OnPlayerDeath. When they respawn their animations are cleared and they call OnPlayerSpawn anyway, so it's just useless. I don't think this is the issue, though.

Judging from what code you've shared, there's no reason at all why someone should be dying on spawn. The only time you set their health is in OnPlayerRegister and when [Died] is set to 1.

Do they die every time they spawn, or just the first time they spawn? Do they 0 health die, or do they go into your script death system? I don't see why they would go into the script death because [Died] should always be 0, and [PlayerSpawnCalled] is also always false.

Unless there's something somewhere that you haven't shared, I don't see any reason why this is happening.
Reply
#3

So you are resetting the player variables:
pawn Code:
static const empty_player[E_PLAYERS];
Player[playerid] = empty_player;
then setting the player's health to the reset variable under OnPlayerRegister:
pawn Code:
SetPlayerHealth(playerid, Player[playerid][Health]);
    SetPlayerArmour(playerid, Player[playerid][Armor]);
I hope the empty_player variable has health and armor set to 100.0?
Reply
#4

Quote:
Originally Posted by Cell_
View Post
So you are resetting the player variables:
pawn Code:
static const empty_player[E_PLAYERS];
Player[playerid] = empty_player;
then setting the player's health to the reset variable under OnPlayerRegister:
pawn Code:
SetPlayerHealth(playerid, Player[playerid][Health]);
    SetPlayerArmour(playerid, Player[playerid][Armor]);
I hope the empty_player variable has health and armor set to 100.0?
Fixed due to your comment, + Rep definitely is headed your way, this was a headache
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)