SA-MP Forums Archive
Help me... - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help me... (/showthread.php?tid=196754)



Help me... - Bogdanovic - 06.12.2010

Hi all, i have create a simple DM Gamemode, and 1 Kill add in a Stats a Var_Kill...
How i can made Function "BestKiller" of match?
Thanks.


Re: Help me... - Mehtab - 06.12.2010

what are you using 0.3c or 0.3b


Re: Help me... - WillyP - 06.12.2010

Quote:
Originally Posted by Mehtab
Посмотреть сообщение
what are you using 0.3c or 0.3b
Would that make a difference? ...No. It wouldn't. Anyways, run a loop through all players, and find a player with highest kills according to your saving system.


Re: Help me... - Bogdanovic - 06.12.2010

I use 0.3c


Re: Help me... - Bogdanovic - 06.12.2010

Quote:

Anyways, run a loop through all players, and find a player with highest kills according to your saving system.

I know this, but please can write an example?


Re: Help me... - Mehtab - 06.12.2010

Код:
//----//Rank Stuff//----//
enum pinfo
{
    MinutesPlayed,
    HoursPlayed,
    Kills,
    Visits,
    Rank,
    SaveStats,
}
new PInfo[MAX_PLAYERS][pinfo];
Код:
//----//Requierments//----//
enum rinfo
{
    RName[64],
    RRequirement,
    RStartMoney,
    Float:RSpawnHealth,
    Float:RSpawnArmour,
    RSpawnWeapon,
    RSpawnAmmo,
};

new RankInfo[MAX_RANKS][rinfo];
Код:
AddRank(rankID, const Name[], Requirement, Startmoney, Float:SpawnHealth, Float:SpawnArmour, SpawnWeapon, SpawnAmmo);



Re: Help me... - Bogdanovic - 06.12.2010

Mmmh no Mehtab i need a Function for BestKiller, the Player that have a "BestScore"...


Re: Help me... - Mehtab - 06.12.2010

Top of the script (under #include <a_samp>):
Код:
new Kills[MAX_PLAYERS], KillsOn;
OnPlayerCommandText:
Код:
if(strcmp("/startkillcount", cmdtext, true) == 0)
    {
        if(IsPlayerAdmin(playerid) == 0) return 0;
        KillsOn = 1;
        return 1;
    }
    if(strcmp("/endkillcount", cmdtext, true) == 0)
    {
        if(IsPlayerAdmin(playerid) == 0) return 0;
        KillsOf = 0;
        GetMaxKills();
        return 1;
    }



OnPlayerDeath:

Код:
if(KillsOn = 1)
    {
        Kills[playerid]++;
    }
Bottom of script, or not in another callback:
Код:
[GetMaxKills()
{
    new killerid;

    for(new a = 0; a < MAX_PLAYERS; a++)
    {
        for(new b = 0; b < MAX_PLAYERS; b++)
        {
            if(Kills[a] > Kills[b])
            {
                killerid = a;
            }
        }
    }

    new string[128];
    format(string, sizeof(string), "ID %d was the winner", killerid);
    SendClientMessageToAll(0xFFFFFFFF, string);
}



Re: Help me... - Bogdanovic - 06.12.2010

Wao thanks Mehtab +__+


Re: Help me... - Mehtab - 06.12.2010

need other help then PM me