Positions on derby end issue; same score doesn't show
#1

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
Reply
#2

bumpedibump - Still need to figure out this issue :S
Reply
#3

this looks like if the two players (or more) with the same score, have the high score too, it would say they both have 1st place, is that right?

do you just want the top 5?
Reply
#4

Yes, you are right; you see my existing code: At first place, both players show up (if they have the same score) because both scores are equal to the Hscore, as you see.

But nr 2,3,4 and 5 doesn't show the cloned scores.

(sometimes 4th and 5th place doesn't show up at all, and i dont see why really).

So now when someone wins it will show me:

Winner: ID - falls 2
Winner: ID - falls 2
Second Place: ID - falls 4
Third Place: ID - falls 6

And in addition there are 2 more players in the derby, which doesn't show up because they also have 4 and 6 falls. but since those "slots" are already taken, my code wont let them show aswell on second and third place. So i am curious on how to fix that.

I want the top 5, yes ^^
Reply
#5

Okay i really need help here; so anyone that knows or maybe got an idea how to do this /rewrite this, can you give me an idea what to do to make it work correctly?

Thanks in advance
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)