SA-MP Forums Archive
How to make it say when someone has been kicked? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to make it say when someone has been kicked? (/showthread.php?tid=119181)



How to make it say when someone has been kicked? - Sampiscool123 - 07.01.2010

Hey

Can someone tell me whats wrong with this code, it only says that someone has been kicked not their name. For example it says "Has been kicked" but it should say "Sampiscool123 has been kicked"

Code:
Код:
if(dialogid == 11)
	{
		if(response)
		{
		  SendClientMessage(playerid,0xE60000FF, "You chose Not to follow our rules, Therefore you got kicked!");
 			Kick(playerid);
			new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
		  GetPlayerName(playerid, pname, sizeof(pname));
      {
			format(string, sizeof(string), "%s has left the server. (Kicked)", pname);
  }
  		SendClientMessageToAll(0xAAAAAAAA, string);

		}
		else
		{
		  SendClientMessage(playerid, 0xFFFF00FF, "Have fun);
}
		return 1;
	}



Re: How to make it say when someone has been kicked? - xxmitsu - 07.01.2010

Is this helpfull?

https://sampwiki.blast.hk/wiki/OnPlayerDisconnect
Quote:

public OnPlayerDisconnect(playerid, reason)
{
new
string[64],
name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
switch(reason)
{
case 0: format(string,sizeof string,"%s left the server. (Timed out)",name);
case 1: format(string,sizeof string,"%s left the server. (Leaving)",name);
case 2: format(string,sizeof string,"%s left the server. (Kicked/Banned)",name);
}
SendClientMessageToAll(0xFFFFFFAA,string);
return 1;
}

and in your example I guess it's because you're kicking the player before reading it's name

Try this and see if it works:
Код:
if(dialogid == 11)
{
	if(response)
	{
		SendClientMessage(playerid,0xE60000FF, "You chose Not to follow our rules, Therefore you got kicked!");
		//Kick(playerid);
		new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
		GetPlayerName(playerid, pname, sizeof(pname));
		Kick(playerid);
		format(string, sizeof(string), "%s has left the server. (Kicked)", pname);
		SendClientMessageToAll(0xAAAAAAAA, string);
	}
	else SendClientMessage(playerid, 0xFFFF00FF, "Have fun);
	return 1;
}