Players on single line
#1

Hello, i want to send to all players a message like this:
Код:
Andrew was kicked by AdmBot for being AFK for more then 30 minutes.
And when more players are afk, something like this:
Код:
Andrew, Forech, Marius, Leed were kicked by AdmBot for being AFK for more then 30 minutes.
In my script when more then 1 player goes kick by admbot for being afk, appears like this:
Код:
Andrew was kicked by AdmBot for being AFK for more then 30 minutes.
Forech was kicked by AdmBot for being AFK for more then 30 minutes.
Marius was kicked by AdmBot for being AFK for more then 30 minutes.
Leed was kicked by AdmBot for being AFK for more then 30 minutes.
i want in one line, no in 4,5,1000.

My script: https://pastebin.com/AAGrBwAH
Reply
#2

No One Can Do THAT Bro Sorry
Reply
#3

We can help you only if you show some effort, try coding something. This is not a place for script requesting.
Reply
#4

Sorry, i tried something like this, but is show me only players that has been kicked, the message "was kicked by AdmBot ..." doesn't appear.

Код HTML:
new out,tmp[128];
		gString[0] = (EOS);
		foreach(new i : Player)
		{
			if(IsPlayerConnected(i))
			{
				if(IsBot[i] == 0)
				{
					if(PlayerInfo[i][pSleeping] == 0)
					{
						if(IsPlayerAFK[i] == 300) //1680
						{
							SS(i, COLOR_LIGHTRED, "Daca nu te misti vei primi kick in 2 minute.", "If you don't move you will be kicked in 2 minutes.");
						}
						if(IsPlayerAFK[i] >= 400) //1800
						{
							SS(i, COLOR_WHITE, "Ai primit kick pentru ca ai fost AFK mai mult de 30 de minute.", "You were kicked for being AFK (away from keyboard) for more than 30 minutes.");
							SS(i, COLOR_WHITE, "Pentru a-ti lasa caracterul AFK mai mult de 30 de minute, foloseste /sleep intr-o casa.", "To leave your character AFK for longer than 30 minutes, use /sleep in a house.");
							SendClientMessage(i, COLOR_GENANNOUNCE, "You have been kicked for being AFK.");
							out++;
							if( out > 0 ) format(tmp,sizeof(tmp),"%s, ",GetName(i));
							strcat(gString,tmp);
							new var100[300];
							mysql_format(SQL, var100, sizeof(var100), "INSERT INTO kicklogs (`playerid`,`giverid`,`playername`,`givername`,`reason`) VALUES ('%d','3','%s','AdmBot','AFK for more than 30 minutes')", PlayerInfo[i][pSQLID],PlayerInfo[i][pNormalName]);
							mysql_tquery(SQL,var100,"","");
							KickEx(i);
						}
					}
				}
			}
		}
		if(out > 1) strcat(tmp, " were kicked by AdmBot for being AFK without sleep for more than 30 minutes.");
		if(out == 1) strcat(tmp, " was kicked by AdmBot for being AFK without sleep for more than 30 minutes.");
		if(out > 0) {
			SendClientMessageToAll(COLOR_LIGHTRED, gString);
		}
Reply
#5

It's good, except near the end:
pawn Код:
if(out > 1) strcat(tmp, " were kicked by AdmBot for being AFK without sleep for more than 30 minutes.");
if(out == 1) strcat(tmp, " was kicked by AdmBot for being AFK without sleep for more than 30 minutes.");
if(out > 0) {
  SendClientMessageToAll(COLOR_LIGHTRED, gString);
}
You add to "tmp" variable, but send "gString". Choose one of them
Reply
#6

and what when there will be more than few players? SCM can send 144 characters ;d
Reply
#7

I try, but is appear something like this
Код:
Andrew, was kicked by AdmBot for being AFK more then 30 minutes.
With more players
Код:
Andrew, Leon, Grown, was kicked by AdmBot for being AFK more then 30 minutes.
I want no comma at the end of the last player
Reply
#8

You could just compile all the names into a singular string.

Код:
format(sendString, 128, "%s, %s, %s", firstName, secondName, thirdName);
Just a thought.
Reply
#9

Alright, so all you have to do is to remove the last comma:
pawn Код:
if(out > 0) {
  new len = strlen(str);
  tmp[len - 2] = EOS;
}
if(out > 1) strcat(tmp, " were kicked by AdmBot for being AFK without sleep for more than 30 minutes.");
if(out == 1) strcat(tmp, " was kicked by AdmBot for being AFK without sleep for more than 30 minutes.");
if(out > 0) {
  SendClientMessageToAll(COLOR_LIGHTRED, tmp);
}
Reply
#10

Now is just show 1 name
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)