Bugged top killstreaks textdraw
#1

So one guy helped me make a code and its have a couple bugs.
First one: When other player online i got hes frags like i had 36 and player online with 0 frags bouth of us get hes frags.
Second: Its count only the last player frags if i kill its doesn't count.

Here the most important code lines. I'm pretty sure its something wrong with this code.
Код:
stock UpdateKST()
{
    new string[200];
    new KSSlot1 = -1, KSSlot2 = -1, KSSlot3 = -1;
    new HKSteak=0;

    for(new x=0; x<MAX_PLAYERS; x++) if (IsPlayerConnected(x)) if (pInfo[x][pKills] >= HKSteak)
    {
         HKSteak = pInfo[x][pKills];
         KSSlot1 = x;
    }
    HKSteak = 0;
    for(new x=0; x<MAX_PLAYERS; x++) if (IsPlayerConnected(x) && x != KSSlot1) if (pInfo[x][pKills] >= HKSteak)
    {
         HKSteak = pInfo[x][pKills];
         KSSlot2 = x;
    }
    HKSteak = 0;
    for(new x=0; x<MAX_PLAYERS; x++) if (IsPlayerConnected(x) && x != KSSlot1 && x != KSSlot2) if (pInfo[x][pKills] >= HKSteak)
    {
         HKSteak = pInfo[x][pKills];
         KSSlot3 = x;
    }
    if(KSSlot1 != -1)
    {
           format(string, sizeof(string), "______Top_3_KillStreaks~n~~n~1._~g~%s_~w~(KillStreak:_%d)", PlayerName2(KSSlot1), pInfo[KSSlot1][pKills]);
    }
    if(KSSlot2 != -1)
    {
           format(string, sizeof(string), "______Top_3_KillStreaks~n~~n~1._~g~%s_~w~(KillStreak:_%d)~n~~n~2._~y~%s_~w~(KillStreak:_%d)", PlayerName2(KSSlot1), pInfo[KSSlot2][pKills], PlayerName2(KSSlot2), pInfo[KSSlot2][pKills]);
    }
    if(KSSlot3 != -1)
    {
           format(string, sizeof(string), "______Top_3_KillStreaks~n~~n~1._~g~%s_~w~(KillStreak:_%d)~n~~n~2._~y~%s_~w~(KillStreak:_%d)~n~~n~3._~y~%s_~w~(KillStreak:_%d)", PlayerName2(KSSlot1), pInfo[KSSlot1][pKills], PlayerName2(KSSlot2), pInfo[KSSlot2][pKills], PlayerName2(KSSlot3), pInfo[KSSlot3][pKills]);
    }
    TextDrawSetString(KSTextdraw, string);
}
Please help
Reply
#2

Help
Reply
#3

Up up
Reply
#4

I do not quite understand what you mean, explain better.
Reply
#5

umm...

problem 1 might be a little mistake here
PHP код:
format(stringsizeof(string), "______Top_3_KillStreaks~n~~n~1._~g~%s_~w~(KillStreak:_%d)~n~~n~2._~y~%s_~w~(KillStreak:_%d)"PlayerName2(KSSlot1), pInfo[KSSlot2][pKills], PlayerName2(KSSlot2), pInfo[KSSlot2][pKills]); 
cause your player 1 kill count just show of pInfo[KSSlot2][pKills] player2's kill count

but might some other wrong..?

and second question...i dont know that mean,
maybe you can try fix that first and try again,
sorry about it
Reply
#6

Well i try explain better.

First bug.

So i playing alone right? everything work fine its show like this
Top 3 killstreaks
1.Name_Name - 36 (killstreaks)

Then new player online, and luck what happen
Top 3 killstreaks
1.Name_Name - 0 (killstreaks)
2.Second_Name - 0 (killstreaks)

Second bug.
So when its playing 2players textdraw luck like this
Top 3 killstreaks
1.Name_Name - 0 (killstreaks) if i make kills its still show zero
2.Second_Name - 0 (killstreaks) if him make kill this textdraw show kills both of us.

And its luck like this
Top 3 killstreaks
1.Name_Name - 1 (killstreaks)
2.Second_Name - 1 (killstreaks)
Reply
#7

Quote:
Originally Posted by Pokemon64
Посмотреть сообщение
Well i try explain better.

First bug.

So i playing alone right? everything work fine its show like this
Top 3 killstreaks
1.Name_Name - 36 (killstreaks)

Then new player online, and luck what happen
Top 3 killstreaks
1.Name_Name - 0 (killstreaks)
2.Second_Name - 0 (killstreaks)

Second bug.
So when its playing 2players textdraw luck like this
Top 3 killstreaks
1.Name_Name - 0 (killstreaks) if i make kills its still show zero
2.Second_Name - 0 (killstreaks) if him make kill this textdraw show kills both of us.

And its luck like this
Top 3 killstreaks
1.Name_Name - 1 (killstreaks)
2.Second_Name - 1 (killstreaks)
ok.. possibly is here

PHP код:
if(KSSlot2 != -1)
    {
           
format(stringsizeof(string), "______Top_3_KillStreaks~n~~n~1._~g~%s_~w~(KillStreak:_%d)~n~~n~2._~y~%s_~w~(KillStreak:_%d)"PlayerName2(KSSlot1), pInfo[KSSlot2][pKills], PlayerName2(KSSlot2), pInfo[KSSlot2][pKills]);
    } 
lookat
PHP код:
PlayerName2(KSSlot1), pInfo[KSSlot2][pKills]// player 1's score is player2's score 
should be
PHP код:
PlayerName2(KSSlot1), pInfo[KSSlot1][pKills
(if that's only happened with 2 players)
Reply
#8

I think using many variables unnecessarily, in OnPlayerDeath you can already detect it.
Reply
#9

If you mean pKills variable its just one function with it
Код:
    if(killerid != INVALID_PLAYER_ID)
     {
              pInfo[killerid][pKills]++;
              UpdateKST();
     }
This update me textdraw after i made kill
Reply
#10

Quote:
Originally Posted by Alvitr
Посмотреть сообщение
ok.. possibly is here

PHP код:
if(KSSlot2 != -1)
    {
           
format(stringsizeof(string), "______Top_3_KillStreaks~n~~n~1._~g~%s_~w~(KillStreak:_%d)~n~~n~2._~y~%s_~w~(KillStreak:_%d)"PlayerName2(KSSlot1), pInfo[KSSlot2][pKills], PlayerName2(KSSlot2), pInfo[KSSlot2][pKills]);
    } 
lookat
PHP код:
PlayerName2(KSSlot1), pInfo[KSSlot2][pKills]// player 1's score is player2's score 
should be
PHP код:
PlayerName2(KSSlot1), pInfo[KSSlot1][pKills
(if that's only happened with 2 players)
I dont really know if its only with 2player bat i think its with all slots same bug
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)