05.10.2014, 19:12
pawn Код:
foreach(new i:Player)
{
if(GetPVarInt(i,"InMonsterDerby")== 1)
{
if(GetPVarInt(i,"MonsterDerbyScore") > Hscore)
{
Hscore = GetPVarInt(i,"MonsterDerbyScore");
}
}
}
foreach(new i:Player)
{
new str[120];
if(GetPVarInt(i,"InMonsterDerby"))
{
if(GetPVarInt(i,"MonsterDerbyScore") == Hscore)
{
new falls;
if(Hscore == 0)
{
falls = 0;
}
else
{
falls=(Hscore/ 10 *-1);
}
format(str,sizeof(str), ""cgreen"Winner:"cwhite" %s (ID:%d)"cgreen" - Number of falls:"cwhite" %d",PlayerName(i),i, falls);
SendClientMessageToAll(0x33FF33AA,str);
SetPlayerScore(i,GetPlayerScore(i)+10);
AccInfo[i][cookies]=AccInfo[i][cookies] + 5;
SendClientMessage(i, blue, "Information: "cwhite"You won 5 cookies and 10 score!");
}
if(place2==0 && GetPVarInt(i, "MonsterDerbyScore") > Hscore2 && GetPVarInt(i, "MonsterDerbyScore") < Hscore)
{
place2 =1; //Locking the position so all other positons don't end up with second place aswell
Hscore2 = GetPVarInt(i, "MonsterDerbyScore");
new falls;
if(Hscore2 == 0)
{
falls = 0;
}
else
{
falls=(Hscore2/ 10 * -1);//Test
}
format(str,sizeof(str), ""cyellow"Second Place:"cwhite" %s (ID:%d)"cyellow" - Number of falls:"cwhite" %d",PlayerName(i),i, falls);
SendClientMessageToAll(0x33FF33AA,str);
SetPlayerScore(i,GetPlayerScore(i)+5);
AccInfo[i][cookies]=AccInfo[i][cookies] + 3;
SendClientMessage(i, blue, "Information: "cwhite"You earned 3 cookies and 5 score!");
}
if(place3 == 0 &&GetPVarInt(i, "MonsterDerbyScore") > Hscore3 && GetPVarInt(i, "MonsterDerbyScore") < Hscore2)
{
place3 =1;
Hscore3 = GetPVarInt(i, "MonsterDerbyScore");
new falls;
if(Hscore3 == 0)
{
falls = 0;
}
else
{
falls=(Hscore3/ 10 *-1);
}
format(str,sizeof(str), ""corange"Third Place:"cwhite" %s (ID:%d)"corange" - Number of falls:"cwhite" %d",PlayerName(i),i, falls);
SendClientMessageToAll(0x33FF33AA,str);
SetPlayerScore(i,GetPlayerScore(i)+2);
AccInfo[i][cookies]=AccInfo[i][cookies] + 1;
SendClientMessage(i, blue, "Information: "cwhite"You earned 1 cookie and 2 score!");
}
if(place4 == 0 &&GetPVarInt(i, "MonsterDerbyScore") > Hscore4 && GetPVarInt(i, "MonsterDerbyScore") < Hscore3)
{
place4 =1;
Hscore4 = GetPVarInt(i, "MonsterDerbyScore");
new falls;
if(Hscore4 == 0)
{
falls = 0;
}
else
{
falls=(Hscore4/ 10 *-1);
}
format(str,sizeof(str), ""cblue"Fourth Place:"cwhite" %s (ID:%d)"cblue" - Number of falls:"cwhite" %d",PlayerName(i),i, falls);
SendClientMessageToAll(0x33FF33AA,str);
}
if(place5==0 && GetPVarInt(i, "MonsterDerbyScore") > Hscore5 && GetPVarInt(i, "MonsterDerbyScore") < Hscore4)
{
place5 =1;
Hscore5 = GetPVarInt(i, "MonsterDerbyScore");
new falls;
if(Hscore5 == 0)
{
falls = 0;
}
else
{
falls=(Hscore5/ 10 *-1);
}
format(str,sizeof(str), ""cred"Fifth Place:"cwhite" %s (ID:%d)"cred" - Number of falls:"cwhite" %d",PlayerName(i),i, falls);
SendClientMessageToAll(0x33FF33AA,str);
}
}
}
Okay so my question is simple; i had to "lock" each position after being used once in order to prevent players getting the same postion with a different score.
How can i get two players with the same score (check the pvar) to show on the same position? because, current method blocks out the other one if the player has the same score.
I know i might did it on a very hard way, and i can provide more code if needed. Hscore is btw getting more negative for each "fall" out from the map.
Thanks