SA-MP Forums Archive
Team spawns - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Team spawns (/showthread.php?tid=402832)



Team spawns - siemka321 - 28.12.2012

I made a timer. What the timer does is it freezes everyone for a while and resets everything. But the only problem is that I have 2 teams, RED and BLUE. I need them to respawn in their specific area. But mostly they end up at the same position. How can I 'choose' only RED team to be in his spawnpoint and BLUE team in their spawn?


Re: Team spawns - Grim_ - 28.12.2012

Without any code to build upon or look at, it's difficult to aid you much! The process itself is very simple however, simply check their team id prior to spawning them and set their spawn data appropriately.


Re: Team spawns - siemka321 - 28.12.2012

Quote:
Originally Posted by Grim_
Посмотреть сообщение
Without any code to build upon or look at, it's difficult to aid you much! The process itself is very simple however, simply check their team id prior to spawning them and set their spawn data appropriately.
Код:
public turaskeiciasi(playerid)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
	TogglePlayerControllable(i,1);
	ResetPlayerWeapons(i);
	ResetPlayerMoney(i);
	GivePlayerMoney(i,100);
	SetPlayerArmour(i,0);
	SetPlayerHealth(i,100);
	GivePlayerWeapon(i,22,300);
	PlayerPlaySound(i,1098,0,0,0);
	SetPlayerInterior(i,3);
	SetPlayerPos(i,2495.8982,-1707.8923,1014.7422);
	SetPlayerColor(i,COLOR_BLUE);
   	SetPlayerInterior(i,6);
	SetPlayerPos(i,2343.0278,-1064.3197,1049.0234);
	SetPlayerColor(i,0xFF000090);
    SetTimer("turasbaigsis", 55000, false);
	redscore = 0;
	bluescore = 0;
    if(turas == 1)
    {
    turas = 2;
    }
    if(turas == 2)
    {
	turas = 1;
    }
    }
    }
	return 1;
}
Here's my code. I removed some useless things because they obviously don't work. I believe the problem is that the id is for every player on the server, and I need help making an id for BLUE and RED teams. Can you show me how to do it?


Re: Team spawns - siemka321 - 28.12.2012

Bumpin'.


Re: Team spawns - Vinninho - 28.12.2012

Код:
if(IsPlayerConnected(i))
    {
	TogglePlayerControllable(i,1);
	ResetPlayerWeapons(i);
	ResetPlayerMoney(i);
	GivePlayerMoney(i,100);
	SetPlayerArmour(i,0);
	SetPlayerHealth(i,100);
	GivePlayerWeapon(i,22,300);
	PlayerPlaySound(i,1098,0,0,0);
	SetPlayerInterior(i,3);
	SetPlayerPos(i,2495.8982,-1707.8923,1014.7422);
	SetPlayerColor(i,COLOR_BLUE);
   	SetPlayerInterior(i,6);
	SetPlayerPos(i,2343.0278,-1064.3197,1049.0234);
	SetPlayerColor(i,0xFF000090);
    SetTimer("turasbaigsis", 55000, false);
	redscore = 0;
	bluescore = 0;
    if(turas == 1)
    {
    turas = 2;
    }
    if(turas == 2)
    {
	turas = 1;
    }
    }
    }
	return 1;
}
This is wrong man. You need to specify your players first in a team! Now both team will spawn at one place!


Re: Team spawns - siemka321 - 28.12.2012

Quote:
Originally Posted by Vinninho
Посмотреть сообщение
Код:
if(IsPlayerConnected(i))
    {
	TogglePlayerControllable(i,1);
	ResetPlayerWeapons(i);
	ResetPlayerMoney(i);
	GivePlayerMoney(i,100);
	SetPlayerArmour(i,0);
	SetPlayerHealth(i,100);
	GivePlayerWeapon(i,22,300);
	PlayerPlaySound(i,1098,0,0,0);
	SetPlayerInterior(i,3);
	SetPlayerPos(i,2495.8982,-1707.8923,1014.7422);
	SetPlayerColor(i,COLOR_BLUE);
   	SetPlayerInterior(i,6);
	SetPlayerPos(i,2343.0278,-1064.3197,1049.0234);
	SetPlayerColor(i,0xFF000090);
    SetTimer("turasbaigsis", 55000, false);
	redscore = 0;
	bluescore = 0;
    if(turas == 1)
    {
    turas = 2;
    }
    if(turas == 2)
    {
	turas = 1;
    }
    }
    }
	return 1;
}
This is wrong man. You need to specify your players first in a team! Now both team will spawn at one place!
Yeah, and I don't know how to do it.


Re: Team spawns - Vinninho - 28.12.2012

Well, this is what happens when someone connects to your server.

I would suggest you to make a dialog, so people can choose their team. Once they chose their team, you can set their spawn place. (And it wont get bugged). That's how I did it man.


Re: Team spawns - siemka321 - 28.12.2012

Quote:
Originally Posted by Vinninho
Посмотреть сообщение
Well, this is what happens when someone connects to your server.

I would suggest you to make a dialog, so people can choose their team. Once they chose their team, you can set their spawn place. (And it wont get bugged). That's how I did it man.
You can already choose a team. I already made them, now I just want to know how to set different positions for BLUE team and RED team after the time runs out (I already made the timer and everything is ok except the position change). But is there a command that respawns a player?


Re: Team spawns - siemka321 - 28.12.2012

Quote:
Originally Posted by siemka321
Посмотреть сообщение
You can already choose a team. I already made them, now I just want to know how to set different positions for BLUE team and RED team after the time runs out (I already made the timer and everything is ok except the position change). But is there a command that respawns a player?
OH nevermind! I managed to fix this. Thanks man, you just gave me a little hint. I looked up for a respawn function and found it, I noticed that in the OnPlayerSpawn it is set that if you are on blue team you spawn there and if you are RED then you spawn there. Everyting works now.