SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 06/06/2020, 05:50 PM   #1
SkyFlare
Huge Clucker
 
SkyFlare's Avatar
 
Join Date: Apr 2015
Location: NZ
Posts: 221
Reputation: 43
Default Weird Spawn Bug, Lot of code.

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
__________________
Purchasable Scripting Services Available, Inbox me with your Requests.
My Project Progress Tracker
My Work
Link
Information
S-Store System V2 LinkIngame Store in Dialogs

Last edited by SkyFlare; 07/06/2020 at 07:52 AM.
SkyFlare is offline   Reply With Quote
Old 06/06/2020, 07:18 PM   #2
[FMJ]PowerSurge
Big Clucker
 
Join Date: May 2012
Location: Nottingham, England
Posts: 125
Reputation: 19
Default Re: Weird Spawn Bug, Lot of code.

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.
[FMJ]PowerSurge is offline   Reply With Quote
Old 06/06/2020, 07:32 PM   #3
Cell_
Big Clucker
 
Join Date: May 2012
Posts: 161
Reputation: 66
Default Re: Weird Spawn Bug, Lot of code.

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?
Cell_ is offline   Reply With Quote
Old 07/06/2020, 07:50 AM   #4
SkyFlare
Huge Clucker
 
SkyFlare's Avatar
 
Join Date: Apr 2015
Location: NZ
Posts: 221
Reputation: 43
Default Re: Weird Spawn Bug, Lot of code.

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
__________________
Purchasable Scripting Services Available, Inbox me with your Requests.
My Project Progress Tracker
My Work
Link
Information
S-Store System V2 LinkIngame Store in Dialogs
SkyFlare is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Weird spawn kbalor Scripting Help 3 15/10/2014 08:23 PM
weird car spawning code Flatz Scripting Help 2 22/12/2013 10:13 AM
Weird Spawn Issue Abreezy Scripting Help 2 09/02/2012 12:21 PM
Get ride of wepons on Spawn code | need code cssbart Help Archive 5 19/04/2010 06:05 PM
[HELP] corrupting weird code addinol Help Archive 3 18/02/2010 06:13 PM


All times are GMT. The time now is 02:06 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.