Ordering messages by an integer
#1

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!
Reply
#2

make an enum for the player called "pRank" or something, and do it like that..

PHP код:
foreach(Playeri)
if(
PlayerInfo[i][pRank] == the rank you want)
{
      
SendClientMessage(iCOLOR_RED"bla bla bla");

Reply
#3

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).
Reply
#4

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.
Reply
#5

Quote:
Originally Posted by JasonRiggs
Посмотреть сообщение
make an enum for the player called "pRank" or something, and do it like that..

PHP код:
foreach(Playeri)
if(
PlayerInfo[i][pRank] == the rank you want)
{
      
SendClientMessage(iCOLOR_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
Reply
#6

You could have stated that at the begining. You can use quickSort.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)