SA-MP Forums

Go Back   SA-MP Forums > SA-MP > Bug Reports

Reply
 
Thread Tools Display Modes
Old 20/12/2016, 05:24 PM   #1
BeckzyBoi
High-roller
 
Join Date: Dec 2006
Posts: 1,590
Reputation: 76
Default SetSpawnInfo in OnPlayerDeath

If SetSpawnInfo is used in OnPlayerDeath, the team parameter has no effect when the player spawns. SetPlayerTeam must be used in OnPlayerSpawn to workaround this.
BeckzyBoi is offline   Reply With Quote
Old 20/12/2016, 09:11 PM   #2
saffierr
High-roller
 
saffierr's Avatar
 
Join Date: Jul 2013
Location: GetPlayerGirlHouse(targetplayer);
Posts: 1,153
Reputation: 36
Default Re: SetSpawnInfo in OnPlayerDeath

Haven't experienced it as I haven't used SetSpawnInfo in OnPlayerDeath, but thanks for the report.
saffierr is offline   Reply With Quote
Old 03/01/2017, 01:57 PM   #3
Lordzy
High-roller
 
Join Date: Mar 2012
Location: NetherRealm
Posts: 2,819
Reputation: 1074
Default Re: SetSpawnInfo in OnPlayerDeath

As per the latest SA-MP 0.3.7-R2 (for Windows), SetSpawnInfo under OnPlayerDeath works fine for me. Can anyone else confirm such an issue for both Windows and Linux? Also, are you using any plugins or includes that modifies memory or functions? This is the code I used to test on a blank gamemode:
Code:
#include <a_samp>

public OnPlayerSpawn(playerid) {

      //If the bug persists, it shouldn't show 2.
	new
	    temp_String[64];
	format(temp_String, sizeof(temp_String), "Your team : %d", GetPlayerTeam(playerid));
	SendClientMessage(playerid, -1, temp_String);
	
	return 1;
}

public OnPlayerConnect(playerid) {

	SetPlayerTeam(playerid, 1);
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason) {

	SetSpawnInfo(playerid, 2, 0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0);
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[]) {

	if(!strcmp(cmdtext, "/kill", true)) {
	
	    SetPlayerHealth(playerid, 0.0);
	    return 1;
	}
	if(!strcmp(cmdtext, "/changeteam", true)) {
	
	    SetPlayerTeam(playerid, 3);
	    return 1;
	}
	if(!strcmp(cmdtext, "/defaultteam", true)) {
	
	    OnPlayerConnect(playerid);
	    return 1;
	}
	if(!strcmp(cmdtext, "/spawnme", true)) {
	
	    SpawnPlayer(playerid);
	    return 1;
	}
	return 0;
}

EDIT : I've only tested with GetPlayerTeam function and it works fine. I'm not sure if this applies to the gameplay, if that's what the OP is referring to. (For instance to shoot your team mates.)
__________________
[Include]safeDialogs - Complete protection against dialog responses! (dialog ids, list-items, input-text of list-item and user)

Currently inactive - I don't play at any SA-MP servers nor work on anything in PAWN for now. The projects that I've done so far in PAWN, which requires updates will be taking some time.
Lordzy is offline   Reply With Quote
Old 03/01/2017, 04:50 PM   #4
BeckzyBoi
High-roller
 
Join Date: Dec 2006
Posts: 1,590
Reputation: 76
Default Re: SetSpawnInfo in OnPlayerDeath

I have only tested it on Linux and I have only tested it by shooting players who were previously in the same team as me - not tested GetPlayerTeam. Thanks for confirming that it possibly works properly on Windows.
BeckzyBoi is offline   Reply With Quote
Old 04/01/2017, 04:04 AM   #5
Lordzy
High-roller
 
Join Date: Mar 2012
Location: NetherRealm
Posts: 2,819
Reputation: 1074
Default Re: SetSpawnInfo in OnPlayerDeath

GetPlayerTeam works properly for Linux versions too. It'd be nice if someone tests if it works on gameplay too. Or else it could be a mistake from something that you're using.
__________________
[Include]safeDialogs - Complete protection against dialog responses! (dialog ids, list-items, input-text of list-item and user)

Currently inactive - I don't play at any SA-MP servers nor work on anything in PAWN for now. The projects that I've done so far in PAWN, which requires updates will be taking some time.
Lordzy is offline   Reply With Quote
Old 10/01/2017, 10:46 AM   #6
john21wall
Little Clucker
 
Join Date: Feb 2016
Posts: 1
Reputation: 0
Default Re: SetSpawnInfo in OnPlayerDeath

It all works really well! The change to OnPlayerDeathFinished is awesome It seems like it works really well and properly from what I've tested.

I've only noticed one bug though (not sure if it's a bug but it seems like it is). Sometimes when you die inside a vehicle (tested several times and I think it depends on the vehicle - from what I remember, it bugs out with a Cheetah but not with SAN News Helicopter and Bullet), you get respawn when you finish your animation, it respawns you on the spot (instantly respawns like you mentioned above) which is awesome but you get bugged out. Your skin is set to the CJ skin every now and then. It didn't happen each time though.

I'll be testing some more in the morning and will hopefully be able to explain it better
__________________
obrzeża do ogrodów
john21wall is offline   Reply With Quote
Old 18/01/2017, 08:03 PM   #7
Dokins
High-roller
 
Dokins's Avatar
 
Join Date: Jun 2010
Posts: 1,577
Reputation: 35
Default Re: SetSpawnInfo in OnPlayerDeath

Simple solution would be to use a timer.
__________________

Grant Alexander Owner/Developer.
Dokins 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
SetSpawnInfo ScIrUsna Scripting Help 6 20/05/2016 12:05 PM
SetSpawnInfo rambalili2 Scripting Help 10 03/11/2015 10:46 AM
[Ajuda] SetSpawnInfo Ts3 Português/Portuguese 6 26/06/2014 04:08 PM
SetSpawnInfo help! Genmetal Scripting Help 2 09/03/2014 12:33 AM
[Ajuda] SetSpawnInfo minimessi10 Português/Portuguese 2 06/07/2013 11:10 PM


All times are GMT. The time now is 08:47 PM.


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