again need function :P
#1

how to make script that put the those name on top in dialog or textdraws who have higher kills then others ??

can any one please! ?
Reply
#2

You can be a little more specific, or bring an example ?
Reply
#3

He means a list of most killers. I'll script for you, but i need your variable name for saving player kills.
In this tutorial i use pKills[playerid], you can change it.

Copy this top of the script:
pawn Код:
#define DIALOG_KILLS 54 // We define a dialog id
This is a command put it below OnPlayerCommandText()

pawn Код:
if (strcmp("/kills", cmdtext, true, 10) == 0)
{
    new best, best2, best3;
    new bestsc, bestsc2, bestsc3;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && pKills[i] > bestsc)
        {
            bestsc = pKills[i];
            best = i;
        }
    }
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && pKills[playerid] > bestsc2 && i != best)
        {
            bestsc2 = pKills[i];
            best2 = i;
        }
    }
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && pKills[playerid] > bestsc3 && i != best && i != best2)
        {
            bestsc3 = pKills[i];
            best3 = i;
        }
    }
    new string[128];
    format(string, sizeof(string), "1 - %s (%d) - %d Kills\n2 - %s (%d) - %d Kills\n3 - %s (%d) - %d Kills", Nick(best), best, bestsc, Nick(best2), best2, bestsc2, Nick(best3), best3, bestsc3);
    ShowPlayerDialog(playerid, DIALOG_KILLS, DIALOG_STYLE_MSGBOX, "Kills", string, "Okay", "");
    return 1;
}
EDIT: If you don't have Nick() stock function here copy this anywhere in your script.

pawn Код:
stock Nick(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    return name;
}
Reply
#4

Quote:
Originally Posted by MouseBreaker
Посмотреть сообщение
He means a list of most killers. I'll script for you, but i need your variable name for saving player kills.
In this tutorial i use pKills[playerid], you can change it.

Copy this top of the script:
pawn Код:
#define DIALOG_KILLS 54 // We define a dialog id
This is a command put it below OnPlayerCommandText()

pawn Код:
if (strcmp("/kills", cmdtext, true, 10) == 0)
{
    new best, best2, best3;
    new bestsc, bestsc2, bestsc3;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && pKills[i] > bestsc)
        {
            bestsc = pKills[i];
            best = i;
        }
    }
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && pKills[playerid] > bestsc2 && i != best)
        {
            bestsc2 = pKills[i];
            best2 = i;
        }
    }
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && pKills[playerid] > bestsc3 && i != best && i != best2)
        {
            bestsc3 = pKills[i];
            best3 = i;
        }
    }
    new string[128];
    format(string, sizeof(string), "1 - %s (%d) - %d Kills\n2 - %s (%d) - %d Kills\n3 - %s (%d) - %d Kills", Nick(best), best, bestsc, Nick(best2), best2, bestsc2, Nick(best3), best3, bestsc3);
    ShowPlayerDialog(playerid, DIALOG_KILLS, DIALOG_STYLE_MSGBOX, "Kills", string, "Okay", "");
    return 1;
}
EDIT: If you don't have Nick() stock function here copy this anywhere in your script.

pawn Код:
stock Nick(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    return name;
}
Thank You Very Much!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)