help please - 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: help please (
/showthread.php?tid=226432)
help please -
bboytimix - 15.02.2011
How to make respawn when all players dead?- whe all die they all will go to the class selection
I want that if you die you will only goto the class selection when everyone is dead how can i do that?
please help
[]thanx for helper[]
Re: help please -
Mean - 15.02.2011
@ the top:
pawn Код:
forward dead( );
new deada[ MAX_PLAYERS ];
Will make a callback for the repeating timer and will check if player is dead
pawn Код:
public OnGameModeInit( )
{
SetTimer( "dead", 5000, 1 );
return 1;
}
Will start the timer to check if everyone is dead
pawn Код:
public OnPlayerDeath( playerid )
{
deada[ playerid ] = 1;
return 1;
}
pawn Код:
public OnPlayerSpawn( playerid )
{
deada[ playerid ] = 0;
return 1;
}
Will make the server know if player is dead or not.
pawn Код:
public dead( )
{
new count = 0;
for( new i = 0; i < MAX_PLAYERS; i++ )
{
if( deada[ i ] == 0 )
{
count++;
}
}
if( count == 0 )
{
for( new a = 0; a < MAX_PLAYERS; a++ )
{
if( IsPlayerConnected( a ) )
{
ForceClassSelection( a );
SetPlayerHealth( a, 0.0 );
}
}
}
return 1;
}
If everyone is dead at the whole server, it will put them at class selection!
UNTESTED.
Re: help please -
bboytimix - 16.02.2011
thanx bro no errors but i sure this will worke lot thanx to you
Re: help please -
bboytimix - 16.02.2011
amm ineed help again
can u do a when all players is this team: if (PlayerTeam[playerid] == 1) /TEAM_ZOMBIE
all will go to the class section
please
Re: help please -
bboytimix - 16.02.2011
some 1 ?
Re: help please -
Mean - 16.02.2011
Don't understand what u mean.
Re: help please -
bboytimix - 16.02.2011
i mean: if all will be a zombie team : Zombie - TEAM_ZOMBIE all go to the class selection