Jump to content
  • 0

Jucatori afisati


Rayan

Question

Salut, am urmatorul cod https://pastebin.com/AAGrBwAH si as vrea sa stiu cum as putea face ca jucatorii care primesc kick ( > 1 ) sa nu fie nevoie sa se trimita 2 mesaje pe 2 randuri , ci intr-un rand, actual trimite ceva de genu:

Andrei was kicked by AdmBot for being AFK for more than 30 minutes.
Marius was kicked by AdmBot for being AFK for more than 30 minutes.

Inloc de

Andrei, Marius were kicked by AdmBot for being AFK for more than 30 minutes.

Cum as putea face acest lucru? Am incercat ceva de genu , am incercat sa si formatezi, nimic, nu iese

strcat(gString, ", ");
strcat(gString, GetName(i));

Am incercat si asa si nu merge, apare gen

 ,  were kicked for being AFK for more than 30 minutes.

nu le apar numele..

new players[128], finalString[256]
foreach(new i : Player) {
	if(timeAFK[i] >= 15) {
		format(players, 128, "%s, ", players, numeJucator);
	}
}

format(finalString, 256, "%s was kicked by AdmBot for being AFK for more than 30 minutes.", players);

 

Edited by Rayan
Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0
new name[MAX_PLAYERS], string[128], stringx[128], players[MAX_PLAYERS], count;
foreach(new i : Player)
{
	if(IsPlayerConnected(i))
	{
		if(IsBot[i] == 0)
		{
			if(PlayerInfo[i][pSleeping] == 0)
			{
				if(IsPlayerAFK[i] >= 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] >= 1800)
				{
					count ++;
					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.");
					GetPlayerName(i, name, sizeof(name));

					if(count > 0) {
						format(players, sizeof(players), "%s, ", name);
						strcat(stringx, players);
					}
					

					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(count > 0) {
  format(string, sizeof(string), "%s was kicked by AdmBot for being AFK for more than 30 minutes.", stringx);
  strdel(string, strlen(stringx)-2, strlen(stringx)-1);
  SendClientMessageToAll(COLOR_LIGHTRED, string);
} else {
  format(string, sizeof(string), "%s was kicked by AdmBot for being AFK for more than 30 minutes.", name);
  SendClientMessageToAll(COLOR_LIGHTRED, string);
}

asta ar trebui sa rezolve problema ta.

 

  • Like 1
Link to comment
Share on other sites

  • 0

Salut, incearca acest cod te rog

new name[MAX_PLAYERS], string[128], stringx[128], players[MAX_PLAYERS], count;
foreach(new i : Player)
{
	if(IsPlayerConnected(i))
	{
		if(IsBot[i] == 0)
		{
			if(PlayerInfo[i][pSleeping] == 0)
			{
				if(IsPlayerAFK[i] >= 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] >= 1800)
				{
					count++;
					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.");
					GetPlayerName(i, name, sizeof(name));

					if(count > 0) {
						format(players, sizeof(players), "%s, ", GetNameEx(i));
						strcat(stringx, players);
					}
					

					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);
				}
			}
		}
	}
}

format(string, sizeof(string), "%s was kicked by AdmBot for being AFK for more than 30 minutes.", stringx);
strdel(string, strlen(stringx)-2, strlen(stringx)-1);
SendClientMessageToAll(COLOR_LIGHTRED, string);

 

Edited by BuNiCu-RP
  • Like 1
Link to comment
Share on other sites

  • 0
new name[MAX_PLAYERS], string[128], stringx[128], players[MAX_PLAYERS], count;
foreach(new i : Player)
{
	if(IsPlayerConnected(i))
	{
		if(IsBot[i] == 0)
		{
			if(PlayerInfo[i][pSleeping] == 0)
			{
				if(IsPlayerAFK[i] >= 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] >= 1800)
				{
					count++;
					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.");
					GetPlayerName(i, name, sizeof(name));

					if(count > 0) {
						format(players, sizeof(players), "%s, ", GetNameEx(i));
						strcat(stringx, players);
					}
					

					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(count > 0) {
	format(string, sizeof(string), "%s was kicked by AdmBot for being AFK for more than 30 minutes.", stringx);
    strdel(string, strlen(stringx)-2, strlen(stringx)-1);
    SendClientMessageToAll(COLOR_LIGHTRED, string);
} else {
	format(string, sizeof(string), "%s was kicked by AdmBot for being AFK for more than 30 minutes.", name);
    SendClientMessageToAll(COLOR_LIGHTRED, string);
}

 

  • Like 1
Link to comment
Share on other sites

  • 0
1 oră în urmă, Rayan a spus:


 

La fel apare man..

if(count > 1) {
	

format(string, sizeof(string), "%s was kicked by AdmBot for being AFK for more than 30 minutes.", name); SendClientMessageToAll(COLOR_LIGHTRED, string);} else {
format(string, sizeof(string), "%s was kicked by AdmBot for being AFK for more than 30 minutes.", stringx); strdel(string, strlen(stringx)-2, strlen(stringx)-1); SendClientMessageToAll(COLOR_LIGHTRED, string);	

}
Edited by AddisoN
  • Like 1
Link to comment
Share on other sites

  • 0
Acum 4 ore, AddisoN a spus:

if(count > 1) {
	

format(string, sizeof(string), "%s was kicked by AdmBot for being AFK for more than 30 minutes.", name); SendClientMessageToAll(COLOR_LIGHTRED, string);} else {
format(string, sizeof(string), "%s was kicked by AdmBot for being AFK for more than 30 minutes.", stringx); strdel(string, strlen(stringx)-2, strlen(stringx)-1); SendClientMessageToAll(COLOR_LIGHTRED, string);	

}

nu merge , se trimite la fel ca la inceput

Andrei was kicked by AdmBot for being AFK for more than 30 minutes.
Marius was kicked by AdmBot for being AFK for more than 30 minutes.

Inloc de

Andrei, Marius were kicked by AdmBot for being AFK for more than 30 minutes.
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.