problem with getting the highest kill streak ever on /stats
#1

As the title itself says, i tried everything, here is the code for a better explanation on how i tried it.

pawn Код:
pSpree[MAX_PLAYERS] = 0,
static hSpree[MAX_PLAYERS]  = 0;

               under OnPlayerDeath(playerid)

/*      if(pSpree[killerid] < hSpree[killerid])
        {
            pSpree[killerid] = hSpree[killerid];
            format(szMessage, sizeof(szMessage), "%d", hSpree[killerid]);
            SetPVarInt(killerid, "hSpree", GetPVarInt(killerid, "hSpree"));
        }
*/

CMD:stats(playerid, params[])
{
    new
        pID,
        Float:phealth = GetPlayerHealth(playerid, phealth),
        Float:parmor = GetPlayerArmour(playerid, parmor),
        pname[MAX_PLAYER_NAME];
       
    if(sscanf(params, "u", pID))
    {
        GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
        format(szMessage, sizeof(szMessage), "==========>> {9EFFBD}[%d]%s{9EFFBD} Account Status <<===========", playerid, pname);
        SendClientMessage(playerid, 0xAFD9FAFF, szMessage);
        playerVariables[playerid][pConnectionIP] = GetPlayerIp(playerid, playerVariables[playerid][pConnectionIP], 32);
        format(szMessage, sizeof(szMessage), "Connection IP: [%s]", playerVariables[playerid][pConnectionIP]);
        SendClientMessage(playerid, COLOR_LIGHT, szMessage);
        format(szMessage, sizeof(szMessage), "{8EED91}FPS: (%d) || {8EED91}Ping: (%d) || {8EED91}PacketLoss: (%.2f)", pFPS[playerid], GetPlayerPing(playerid), NetStats_PacketLossPercent(playerid));
        SendClientMessage(playerid, 0x00FF00AA, szMessage);
        format(szMessage, sizeof(szMessage), "{EAED8E}Admin Level: [%d] || {EAED8E}Current Kill Streak: [%d] || {EAED8E}Highest Killing Streak: [%d]", playerVariables[playerid][pAdminLevel], pSpree[playerid], [B][I]hSpree[playerid])[/I][/B];
        SendClientMessage(playerid, COLOR_YELLOW, szMessage);
    }
    return 1;
}

//

it keeps sayign HighestKillingSpree is 0 no matter what i change
Reply
#2

Have you checked your kill system
Reply
#3

pawn Код:
playerVariables[killerid][pKills]++;
        playerVariables[playerid][pDeaths]++;
        pSpree[killerid]++;
        PreloadAnimLib(playerid,"PED" );
        ApplyAnimation(playerid,"PED","KO_skid_front",4.1, 0,1,0 ,10000,1);
        ApplyAnimation(playerid,"PED","KO_skid_front",4.1, 0,1,0 ,10000,1);
        if(pSpree[killerid] < hSpree[killerid])
        {
            pSpree[killerid] = hSpree[killerid];
            format(szMessage, sizeof(szMessage), "%d", hSpree[killerid]);
            SetPVarInt(killerid, "hSpree", GetPVarInt(killerid, "hSpree"));
        }
This is as far as the kill system goes, the normal killing spree works just fine, and all else. Except when it comes to highest killing spree, it always says 0
Reply
#4

Quote:
Originally Posted by GwENiko
Посмотреть сообщение
This is as far as the kill system goes, the normal killing spree works just fine, and all else. Except when it comes to highest killing spree, it always says 0
It says 0 because you are first setting the players spree info and than you are checking.
Ex:- If you have 3 killing spree,According to your code,this part
Код:
if(pSpree[killerid] < hSpree[killerid])
will execute like
Код:
if(3 < 3)
So first store it in a another variable,Check if its grater than set spree info.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)