SA-MP Forums Archive
Hmm Somethings wrong or what? - 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: Hmm Somethings wrong or what? (/showthread.php?tid=156571)



Hmm Somethings wrong or what? - Lorenc_ - 23.06.2010

Im trying to make like a little system to allow you to have 1 life per match so im asking 2 things How and Why.


Why dosent my code work??

Код:
public OnPlayerSpawn(playerid)
{
	if(PlayerDied[playerid] == true)
	{
		TogglePlayerSpectating(playerid, 1);// need to make some addons for this...
	}
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    PlayerDied[playerid] = true;
	return 1;
}
How do i detect if all players in one team died so it can exec a restart?
and
How do i make it automaticlly restart if theres 1 person on my server and they die?


Thats all i think :P

-Lorenc


Re: Hmm Somethings wrong or what? - [HiC]TheKiller - 23.06.2010

You could either make a variable like this

pawn Код:
new TeamBlue, TeamRed;

//When a player joins
TeamBlue ++; /* Or*/ TeamRed ++;

//When a player leaves
TeamBlue --; /* Or*/ TeamRed --;
The other way is to do a check that checks if there is anyone in a team using a for loop.



Re: Hmm Somethings wrong or what? - Lorenc_ - 23.06.2010

Quote:
Originally Posted by [HiC
TheKiller ]
You could either make a variable like this

pawn Код:
new TeamBlue, TeamRed;

//When a player joins
TeamBlue ++; /* Or*/ TeamRed ++;

//When a player leaves
TeamBlue --; /* Or*/ TeamRed --;
The other way is to do a check that checks if there is anyone in a team using a for loop.
I get what you mean and thats very useful infact for the 1 life system but still i cant fix the problam damn..


Re: Hmm Somethings wrong or what? - [LSR]State_Trooper - 23.06.2010

Why dnt u use, GetPlayerHealth and Select the Player's/Teams


Re: Hmm Somethings wrong or what? - Lorenc_ - 24.06.2010

Quote:
Originally Posted by [LSR
State_Trooper ]
Why dnt u use, GetPlayerHealth and Select the Player's/Teams
For what.


Re: Hmm Somethings wrong or what? - [LSR]State_Trooper - 24.06.2010

To see if the Team has a total health of 0 ( all players are dead). Then tell it if it is 0 to restart