Specating enemy after dead if team #1 is fully dead - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Specating enemy after dead if team #1 is fully dead (
/showthread.php?tid=172477)
Specating enemy after dead if team #1 is fully dead -
LifeStyle - 30.08.2010
I am trying to make if team 1 is completely dead it would spec team 2, it's a no-respawn gamemode.
Currently i have this code:
pawn Code:
stock GetRandomTeamPlayerForPlayer(playerid)
{
new rand = -1;
new team = mTeam[playerid];
new Float:health;
while(rand == -1)
{
rand = random(MAX_PLAYERS);
if(!IsPlayerConnected(rand)) rand = -1;
if(TeamCounting[team] != 0 && team == mTeam[rand]) rand = -1;
GetPlayerHealth(rand, health);
if(health <= 0) rand = -1;
}
return rand;
}
Butt his code makes everyone respawn.
Re: Specating enemy after dead if team #1 is fully dead -
LarzI - 30.08.2010
Set a variable to true OnPlayerDeath and at the same time check if the variable is true for the rest of the team, if it is, set all to spectatem, if it's not; do whatever you like x)
Remember to return false inside OnPlayerSpawn, if not they will respawn.
Re: Specating enemy after dead if team #1 is fully dead -
LifeStyle - 30.08.2010
i have updated the code:
It's not spectating the enemy, but just looking at the water + bridge...
pawn Code:
stock GetRandomTeamPlayerForPlayer(playerid)
{
new rand = -1;
new Float:health;
if(ThisMode == 1)
{
while(rand == -1)
{
rand = random(MAX_PLAYERS);
if(mTeam[rand] != mTeam[playerid] || !IsPlayerConnected(rand)) rand = -1;
GetPlayerHealth(rand, health);
if(health <= 0) rand = -1;
}
return rand;
}
else if(ThisMode == 2)
{
while(rand == -1)
{
rand = random(MAX_PLAYERS);
if(!IsPlayerConnected(rand)) rand = -1;
GetPlayerHealth(rand, health);
if(health <= 0) rand = -1;
}
}
return rand;
}
Re: Specating enemy after dead if team #1 is fully dead -
LifeStyle - 31.08.2010
Anybody?
Re: Specating enemy after dead if team #1 is fully dead -
Grim_ - 31.08.2010
Indention is your friend.
And this code is not enough to figure out why everyone is re-spawning, so the code where you use this function.
Re: Specating enemy after dead if team #1 is fully dead -
LifeStyle - 31.08.2010
I have fixed the no-respawning. Except the spectating enemy. Now it just looks at the bridge :S
Re: Specating enemy after dead if team #1 is fully dead -
Grim_ - 31.08.2010
Maybe it's trying to spectate yourself. Add
pawn Code:
if(rand == playerid) rand = -1;
Re: Specating enemy after dead if team #1 is fully dead -
LifeStyle - 31.08.2010
Didn't work :S
Re: Specating enemy after dead if team #1 is fully dead -
LifeStyle - 01.09.2010
bump :S.
Re: Specating enemy after dead if team #1 is fully dead -
LifeStyle - 02.09.2010
Bump again