SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 08/02/2018, 01:11 PM   #1
Milak
Little Clucker
 
Join Date: Oct 2017
Location: Poland, Gdansk
Posts: 15
Reputation: 0
Default SetSpawnInfo does not change player team(?)

I discovered, when I use SetSpawnInfo on me and I set in this Team: 0, and my friend has same team as me set by SetSpawnInfo too then if we get "GetPlayerTeam" our teams are 0, right? But callback OnPlayerGiveDamage will damage will work on us and we will damage ourself. If we USE SetPlayerTeam to me and my friend team 0 too, then it will not take any damage. So SetSpawnInfo does not work correctly - SetPlayerTeam works correctly.
Milak is offline   Reply With Quote
Old 10/02/2018, 12:34 PM   #2
Matz
Huge Clucker
 
Matz's Avatar
 
Join Date: Apr 2011
Location: Istanbul
Posts: 260
Reputation: 141
Default Re: SetSpawnInfo does not change player team(?)

I've also noticed this problem yesterday, wondering why
Matz is offline   Reply With Quote
Old 11/02/2018, 09:05 AM   #3
Milak
Little Clucker
 
Join Date: Oct 2017
Location: Poland, Gdansk
Posts: 15
Reputation: 0
Default Re: SetSpawnInfo does not change player team(?)

It's so weird! GetPlayerTeam function returns the player's team but player's team does not work correctly!
Milak is offline   Reply With Quote
Old 14/02/2018, 02:01 AM   #4
Banana_Ghost
Huge Clucker
 
Banana_Ghost's Avatar
 
Join Date: Jul 2011
Location: United States
Posts: 253
Reputation: 45
Default Re: SetSpawnInfo does not change player team(?)

If I recall correctly, SetPlayerTeam even had to be used in SA-MP 0.2. Using the team parameter in SetSpawnInfo then only allowed the usage of /tpm while using SetPlayerTeam wouldn't work for it and vise versa.
Banana_Ghost is offline   Reply With Quote
Old 14/02/2018, 02:25 AM   #5
RogueDrifter
High-roller
 
RogueDrifter's Avatar
 
Join Date: Dec 2017
Location: SA-MP Drifting world.
Posts: 1,144
Reputation: 344
Default Re: SetSpawnInfo does not change player team(?)

This can be fixed with 1 hook, SetSpawnInfo either by y_hooks or ALS then use SetPlayerTeam and put the team param in it, fixed. This in an include:
PHP Code:
forward SetSpawnInfoHooked(playeridteamskinFloat:xFloat:yFloat:zFloat:rotationweapon1weapon1_ammoweapon2weapon2_ammoweapon3weapon3_ammo);

public 
SetSpawnInfoHooked(playeridteamskinFloat:xFloat:yFloat:zFloat:rotationweapon1weapon1_ammoweapon2weapon2_ammoweapon3weapon3_ammo)
{
    
SetSpawnInfo(playeridteamskinFloat:xFloat:yFloat:zFloat:rotationweapon1weapon1_ammoweapon2weapon2_ammoweapon3weapon3_ammo);
    
SetPlayerTeam(playeridteam);
    return 
1;
}

#if defined _ALS_SetSpawnInfo
  #undef SetSpawnInfo
#else
    #define _ALS_SetSpawnInfo
#endif

#define SetSpawnInfo SetSpawnInfoHooked 
__________________
Quote:
I'm not using the forum to release stuff anymore, if you want updates for my releases or to check my new releases check the links below >
Quote:
Originally Posted by Escobar ⚠
Life sucked me in and shat me on the cruel world.

[Github]:Link [Gists]:Link [Forum]:Link [Server]:Link [Discord]:Link


RogueDrifter is offline   Reply With Quote
Old 17/02/2018, 09:03 AM   #6
BeckzyBoi
Beta Tester
 
Join Date: Dec 2006
Posts: 1,696
Reputation: 127
Default Re: SetSpawnInfo does not change player team(?)

I reported a similar, if not the same issue here:

http://forum.sa-mp.com/showthread.php?t=624667

I just use SetPlayerTeam in OnPlayerSpawn to fix it.
__________________
BeckzyBoi is online now   Reply With Quote
Old 17/02/2018, 10:00 AM   #7
Arthur Kane
Gangsta
 
Join Date: Sep 2012
Posts: 771
Reputation: 115
Default Re: SetSpawnInfo does not change player team(?)

Use SetPlayerTeam( playerid, 255 ); when the player connects and see if it makes a difference.
__________________
LS:RP Development Team
Arthur Kane is offline   Reply With Quote
Old 17/02/2018, 10:12 PM   #8
NaS
High-roller
 
NaS's Avatar
 
Join Date: Mar 2008
Posts: 1,549
Reputation: 457
Default Re: SetSpawnInfo does not change player team(?)

Quote:
Originally Posted by RogueDrifter View Post
This can be fixed with 1 hook, SetSpawnInfo either by y_hooks or ALS then use SetPlayerTeam and put the team param in it, fixed. This in an include:
PHP Code:
forward SetSpawnInfoHooked(playeridteamskinFloat:xFloat:yFloat:zFloat:rotationweapon1weapon1_ammoweapon2weapon2_ammoweapon3weapon3_ammo);

public 
SetSpawnInfoHooked(playeridteamskinFloat:xFloat:yFloat:zFloat:rotationweapon1weapon1_ammoweapon2weapon2_ammoweapon3weapon3_ammo)
{
    
SetSpawnInfo(playeridteamskinFloat:xFloat:yFloat:zFloat:rotationweapon1weapon1_ammoweapon2weapon2_ammoweapon3weapon3_ammo);
    
SetPlayerTeam(playeridteam);
    return 
1;
}

#if defined _ALS_SetSpawnInfo
  #undef SetSpawnInfo
#else
    #define _ALS_SetSpawnInfo
#endif

#define SetSpawnInfo SetSpawnInfoHooked 
This wouldn't be fully correct either. SetSpawnInfo shouldn't set the team when called, it should set the team on the next respawn. Furthermore you can make a much easier fix by doing this in OnPlayerSpawn:

Code:
public OnPlayerSpawn(playerid)
{
SetPlayerTeam(playerid, GetPlayerTeam(playerid));
}
Since GetPlayerTeam returns the correct value, you can just update it, like BeckzyBoi mentioned.
NaS is offline   Reply With Quote
Old 17/02/2018, 10:15 PM   #9
RogueDrifter
High-roller
 
RogueDrifter's Avatar
 
Join Date: Dec 2017
Location: SA-MP Drifting world.
Posts: 1,144
Reputation: 344
Default Re: SetSpawnInfo does not change player team(?)

Quote:
Originally Posted by NaS View Post
This wouldn't be fully correct either. SetSpawnInfo shouldn't set the team when called, it should set the team on the next respawn. Furthermore you can make a much easier fix by doing this in OnPlayerSpawn:

Code:
public OnPlayerSpawn(playerid)
{
SetPlayerTeam(playerid, GetPlayerTeam(playerid));
}
Since GetPlayerTeam returns the correct value, you can just update it, like BeckzyBoi mentioned.
Oh i had no idea that getplayerteam returned the true value, you're totally right that would indeed be a lot easier and better.
__________________
Quote:
I'm not using the forum to release stuff anymore, if you want updates for my releases or to check my new releases check the links below >
Quote:
Originally Posted by Escobar ⚠
Life sucked me in and shat me on the cruel world.

[Github]:Link [Gists]:Link [Forum]:Link [Server]:Link [Discord]:Link


RogueDrifter 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
How to change player's team after death? KillerDVX Scripting Help 4 08/06/2015 09:28 PM
change player team Amine_Mejrhirrou Scripting Help 13 19/06/2012 01:33 AM
Saving Player Pos with Y_INI and using it with SetSpawnInfo Unfriendly Scripting Help 3 14/06/2012 08:32 AM
[Help Request] SetSpawnInfo() without team jujuv Scripting Help 8 24/04/2012 09:02 AM
Don't let the health change if player from the same team how to do that??? RyDeR` Help Archive 16 01/08/2009 11:57 AM


All times are GMT. The time now is 12:34 PM.


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