event question - 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: event question (
/showthread.php?tid=325371)
event question -
new121 - 13.03.2012
I have a timer going and on every hour it tps everyone to a certain spots gives them all guns and they are to kill each other, when they join they get this variable tfight[playerid] ++;
Now I want to know how to tell who the last man alive is?
Here is my code
Код:
public fight()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
TogglePlayerControllable(i, 1);
ResetPlayerWeapons(i);
GivePlayerWeapon(i, 24, 99999);
GivePlayerWeapon(i, 25, 99999);
GivePlayerWeapon(i, 34, 99999);
tfight[i] ++;
if(gTeam[i] == 0)// fast food
{
SetPlayerPos(i, changeme);
}
if(gTeam[i] == 1)//elvis
{
SetPlayerPos(i, changeme);
}
if(gTeam[i] == 2)//medic
{
SetPlayerPos(i, changeme);
}
if(gTeam[i] == 3)//sp
{
SetPlayerPos(i, changeme);
}
if(gTeam[i] == 4)//wigger
{
SetPlayerPos(i, changeme);
}
if(gTeam[i] == 5)//beachbums
{
SetPlayerPos(i, changeme);
}
if(gTeam[i] == 6)// Rednecks
{
SetPlayerPos(changeme);
}
}
return 1;
}
Re: event question -
SnG.Scot_MisCuDI - 13.03.2012
Im guessing, make it get the number of players that are there and when each dies make it one less until it gets to one.
(no clue how)
Re: event question -
new121 - 13.03.2012
Quote:
Originally Posted by SnG.Scot_MisCuDI
(no clue how)
|
Essentially you had no reason to post then
Re: event question -
eesh - 13.03.2012
pawn Код:
new lastman[MAX_PLAYERS];
public OnPlayerDeath(playerid, killerid, reason)
{
lastman[playerid] = 0;
return 1;
}
public fight()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
TogglePlayerControllable(i, 1);
ResetPlayerWeapons(i);
GivePlayerWeapon(i, 24, 99999);
GivePlayerWeapon(i, 25, 99999);
GivePlayerWeapon(i, 34, 99999);
tfight[i] ++;
lastman[i]=1;
if(gTeam[i] == 0)// fast food
{
SetPlayerPos(i, changeme);
}
if(gTeam[i] == 1)//elvis
{
SetPlayerPos(i, changeme);
}
if(gTeam[i] == 2)//medic
{
SetPlayerPos(i, changeme);
}
if(gTeam[i] == 3)//sp
{
SetPlayerPos(i, changeme);
}
if(gTeam[i] == 4)//wigger
{
SetPlayerPos(i, changeme);
}
if(gTeam[i] == 5)//beachbums
{
SetPlayerPos(i, changeme);
}
if(gTeam[i] == 6)// Rednecks
{
SetPlayerPos(changeme);
}
}
return 1;
}
The players with lastman == 1 are last players alive.