03.09.2009, 06:39
So this is what I have atm:
Now I have a couple problems,
(1.) If the player with the highest score leaves the server, then it tries to set the unknown person's pos on the podium and shows " has won the round" without a name.
(2.) If 2 or more people have the same highest kills then it sets all their pos's to the top of the podium and shows " has won the round" with no name.
Can someone please try help me fix or make a work-around for these problems?
Thanks
pawn Код:
new winner = 0;
new second = 0;
new third = 0;
new wname[MAX_PLAYER_NAME];
new string[128];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(RoundKills[i] > winner)
{
winner = RoundKills[i];
}
else if(RoundKills[i] > second < winner)
{
second = RoundKills[i];
}
else if(RoundKills[i] > third < second)
{
third = RoundKills[i];
}
}
for(new p = 0; p < MAX_PLAYERS; p++)
{
TextDrawHideForPlayer(p, WeaponSet[p]);
TextDrawHideForPlayer(p, WeaponSet2[p]);
SetPlayerVirtualWorld(p, 1);
SetPlayerTime(p, 12, 00);
SetPlayerWeather(p, 1);
SetPlayerCameraPos(p, 1162.0117, -2037.2634, 77.3912);
SetPlayerCameraLookAt(p, 1136.5795, -2035.9546, 69.2867);
TogglePlayerControllable(p, 0);
new rand = random(sizeof(gRandomLoserPos));
SetPlayerPos(p, gRandomLoserPos[rand][0], gRandomLoserPos[rand][1], gRandomLoserPos[rand][2]);
SetPlayerFacingAngle(p, gRandomLoserPos[rand][3]);
SetPlayerInterior(p, 0);
if(winner == 0)
{
GameTextForAll("There is no winner this round!", 15000, 4);
}
else if(RoundKills[p] == winner)
{
SetPlayerScore(p, AccountInfo[p][RoundsWon]+1);
SetPlayerPos(p, 1136.6077,-2037.0586,70.3367);
SetPlayerFacingAngle(p, 267);
GetPlayerName(p, wname, sizeof(wname));
format(string, sizeof(string), "%s has won the round!", wname);
GameTextForAll(string, 15000, 4);
ApplyAnimation(p, "DANCING", "dance_loop", 100, 1, 1, 1, 0, 14800);
}
else if(RoundKills[p] == second && second != 0)
{
SetPlayerPos(p, 1136.5135,-2038.0604,69.8617);
SetPlayerFacingAngle(p, 267);
ApplyAnimation(p, "DANCING", "dance_loop", 100, 1, 1, 1, 0, 14800);
}
else if(RoundKills[p] == third && third != 0)
{
SetPlayerPos(p, 1136.5795, -2035.9546, 69.2867);
SetPlayerFacingAngle(p, 267);
ApplyAnimation(p, "DANCING", "dance_loop", 100, 1, 1, 1, 0, 14800);
}
}
(1.) If the player with the highest score leaves the server, then it tries to set the unknown person's pos on the podium and shows " has won the round" without a name.
(2.) If 2 or more people have the same highest kills then it sets all their pos's to the top of the podium and shows " has won the round" with no name.
Can someone please try help me fix or make a work-around for these problems?
Thanks