SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 23/09/2014, 06:00 AM   #1
GwENiko
Big Clucker
 
Join Date: Jan 2013
Posts: 130
Reputation: 2
Default problem with getting the highest kill streak ever on /stats

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

pawn Code:
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
GwENiko is offline   Reply With Quote
Old 23/09/2014, 06:07 AM   #2
psoni9697
Little Clucker
 
Join Date: May 2014
Posts: 23
Reputation: 4
Default Re: problem with getting the highest kill streak ever on /stats

Have you checked your kill system
__________________


Rep me + If you like it, i will surely give you a rep. also
psoni9697 is offline   Reply With Quote
Old 23/09/2014, 06:15 AM   #3
GwENiko
Big Clucker
 
Join Date: Jan 2013
Posts: 130
Reputation: 2
Default Re: problem with getting the highest kill streak ever on /stats

pawn Code:
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
GwENiko is offline   Reply With Quote
Old 23/09/2014, 08:00 AM   #4
_Mohit_
Big Clucker
 
Join Date: Sep 2012
Location: India
Posts: 83
Reputation: 5
Default Re: problem with getting the highest kill streak ever on /stats

Quote:
Originally Posted by GwENiko View Post
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
Code:
if(pSpree[killerid] < hSpree[killerid])
will execute like
Code:
if(3 < 3)
So first store it in a another variable,Check if its grater than set spree info.
_Mohit_ is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Kill Streak Help. StormDust Scripting Help 3 17/08/2013 04:15 PM
Kill streak problem with multiple GM's ElCowboy Scripting Help 0 22/12/2012 05:18 PM
[FilterScript] Kill Streak SpiderWalk Filterscripts 23 26/04/2012 07:20 PM
[FilterScript] [FS]MW2 - Kill Streak Naxix Filterscripts 11 29/03/2011 10:07 AM
Problem with my kill streak system > says 5 kills in a row while 2 Andy_McKinley Help Archive 1 08/07/2010 03:18 PM


All times are GMT. The time now is 07:46 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.