again need function :P - 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)
+--- Thread: again need function :P (
/showthread.php?tid=393886)
again need function :P -
dr.lozer - 20.11.2012
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! ?
Re: again need function :P -
Camorra - 20.11.2012
You can be a little more specific, or bring an example ?
AW: again need function :P -
Skimmer - 20.11.2012
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;
}
Re: AW: again need function :P -
dr.lozer - 20.11.2012
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!