Ordering messages by an integer - 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: Ordering messages by an integer (
/showthread.php?tid=637438)
Ordering messages by an integer -
Omirrow - 14.07.2017
Hey,
How can I order messages by an integer? For example a rank, I'd like to send the message by an order (according to player's rank)
Thanks in advance!
Re: Ordering messages by an integer -
JasonRiggs - 14.07.2017
make an enum for the player called "pRank" or something, and do it like that..
PHP код:
foreach(Player, i)
if(PlayerInfo[i][pRank] == the rank you want)
{
SendClientMessage(i, COLOR_RED, "bla bla bla");
}
Re: Ordering messages by an integer -
Paulice - 14.07.2017
Could you please elaborate a little more on what you want to achieve by this? The order would only matter if high ranks see lower ranks' messages (e.g. command list).
Re: Ordering messages by an integer -
BlackBank - 14.07.2017
You could use this include for sorting/ordering the messages:
https://sampforum.blast.hk/showthread.php?tid=343172
Just put the rank and message into an array and sort it, then after you did sort the array on rank, just loop all the messages.
Re: Ordering messages by an integer -
Omirrow - 16.07.2017
Quote:
Originally Posted by JasonRiggs
make an enum for the player called "pRank" or something, and do it like that..
PHP код:
foreach(Player, i)
if(PlayerInfo[i][pRank] == the rank you want)
{
SendClientMessage(i, COLOR_RED, "bla bla bla");
}
|
That's actually easy and not what I want to do.
What I want to do is, getting online players and their rank in an order. When you type a command, it's gonna be shown in an order, the order is by an integer like an offset.
Код:
ONLINE:
XX - Level 1
YY - Level 1
ZZ - Level 2
SS - Level 3
Re: Ordering messages by an integer -
Paulice - 16.07.2017
You could have stated that at the begining. You can use
quickSort.