SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 25/05/2020, 07:47 PM   #1
Vy
Little Clucker
 
Join Date: Aug 2016
Posts: 40
Reputation: 0
Default background onplayerspawn

Hello! When you die and spawn, in a certain period of time (very short) you see in the background another spawn that already spawns. I guess that's normal (and that this doesn't appear if you use setspawninfo), but there are servers that that ''background'' doesn't appear to you the skin of cj or a map, but in black. In my server 2 teams has setspawninfo and another does not have since they are different modes then if I enter one team and I switch to the other team (different mode), when I die and spawn I get for a short time the spawn of the setspawninfo that has the team that i entered before. Then I don't know how to make it just look black background. Another solution that I can think of is to put random positions in setspawninfo but it does not work for me since when I die and spawn I stay in the same position, and the setspawninfo I only have it in the team dialogue. Thanks!
Vy is offline   Reply With Quote
Old 26/05/2020, 06:24 AM   #2
GameOvr
Huge Clucker
 
GameOvr's Avatar
 
Join Date: Jun 2018
Posts: 296
Reputation: 9
Default Re: background onplayerspawn

Actually I didnt quite understand BUT you cant use SpawnPlayer without using SetSpawnInfo it will bug you... as I remember it is one of the samp default bugs.. use fixes.inc(by ******) it fix many bugs in samp including this spawn thing...also if you want to make the background black just use a textdraw for that..
__________________
GameOvr is offline   Reply With Quote
Old 26/05/2020, 01:17 PM   #3
Vy
Little Clucker
 
Join Date: Aug 2016
Posts: 40
Reputation: 0
Default Re: background onplayerspawn

Thank you for your answer, I already knew about it and about fixes.inc I didn't know it, thank you for telling me

I meant this, in the gif, almost at the end you see a part where you see the skin (1) in another position, I don't know how to fix it, it bothers a lot, on other servers that does not happen to them that and those servers do not use setspawninfo. This fix using setspawninfo but I don't want to use that.

https://imgur.com/a/I9VAXM8
Vy is offline   Reply With Quote
Old 26/05/2020, 10:02 PM   #4
Vy
Little Clucker
 
Join Date: Aug 2016
Posts: 40
Reputation: 0
Default Re: background onplayerspawn

bump
Vy is offline   Reply With Quote
Old 27/05/2020, 12:12 PM   #5
NaS
High-roller
 
NaS's Avatar
 
Join Date: Mar 2008
Location: 🇩🇪
Posts: 1,802
Reputation: 635
Default Re: background onplayerspawn

You possibly use SetPlayerPos in OnPlayerSpawn? This would teleport the player right after spawning, but since there is a small delay between the callback and the actual teleport this becomes visible sometimes.
To avoid this don't teleport players in OnPlayerSpawn, instead set their spawn position beforehand using SetSpawnInfo.
NaS is offline   Reply With Quote
Old 27/05/2020, 12:46 PM   #6
Vy
Little Clucker
 
Join Date: Aug 2016
Posts: 40
Reputation: 0
Default Re: background onplayerspawn

Quote:
Originally Posted by NaS View Post
You possibly use SetPlayerPos in OnPlayerSpawn? This would teleport the player right after spawning, but since there is a small delay between the callback and the actual teleport this becomes visible sometimes.
To avoid this don't teleport players in OnPlayerSpawn, instead set their spawn position beforehand using SetSpawnInfo.
Thank you for the answer, I understand but the problem is that if I put in setspawninfo the positions (they are random i.e. there are several positions) and I die, I stay in the same position when I first spawn. I don't know how to make random positions work using the setspawninfo, so I put setplayerpos on onplayerspawn because that's how it works for me. I only use the SetSpawnInfo when select a team.
Vy is offline   Reply With Quote
Old 27/05/2020, 07:29 PM   #7
NaS
High-roller
 
NaS's Avatar
 
Join Date: Mar 2008
Location: 🇩🇪
Posts: 1,802
Reputation: 635
Default Re: background onplayerspawn

You can use it in for example OnPlayerDeath, or even in OnPlayerSpawn (this would take effect after the next spawn, but if you do it between every spawn it has the same effect). You could write a function that takes care of it, which you can then call in OnPlayerRequestClass and OnPlayerDeath/Spawn to set up the coords in advance.
NaS is offline   Reply With Quote
Old 27/05/2020, 08:12 PM   #8
Vy
Little Clucker
 
Join Date: Aug 2016
Posts: 40
Reputation: 0
Default Re: background onplayerspawn

Quote:
Originally Posted by NaS View Post
You can use it in for example OnPlayerDeath, or even in OnPlayerSpawn (this would take effect after the next spawn, but if you do it between every spawn it has the same effect). You could write a function that takes care of it, which you can then call in OnPlayerRequestClass and OnPlayerDeath/Spawn to set up the coords in advance.


So this?


PHP Code:
public OnPlayerDeath(playeridkilleridreason)
{
    
SetSpawnInfo(playeridNO_TEAMPlayerInfo[playerid][Skin],  RandomS[Randomm][0], RandomS[Randomm][1], RandomS[Randomm][2],  RandomS[Randomm][3],  -1, -1, -1, -1, -1, -1);

// ...........
return 1;

edit: done

Last edited by Vy; 27/05/2020 at 10:13 PM.
Vy 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
Background Help. Sting. Scripting Help 7 19/08/2017 07:05 PM
how add Background par30 Scripting Help 8 11/11/2013 12:20 PM
[Ajuda] BackGround MonFiTy PortuguÍs/Portuguese 2 04/06/2013 02:39 AM
Background SpiderWalk Everything and Nothing 6 14/11/2011 03:56 PM
background emch0o Help Archive 1 05/09/2009 05:51 PM


All times are GMT. The time now is 06:58 PM.


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