20.11.2012, 10:00
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! ?
can any one please! ?
#define DIALOG_KILLS 54 // We define a dialog id
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;
}
stock Nick(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
return name;
}
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 Код:
pawn Код:
pawn Код:
|