SA-MP Forums Archive
[Ajuda] OnRconLoginAttempt - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] OnRconLoginAttempt (/showthread.php?tid=560522)



OnRconLoginAttempt - Mackdaddy - 29.01.2015

Queria saber como pegar o nome do player nessa Callback, eu jб tenho o IP, mas nгo tф conseguindo pegar o nome dele, alguйm pode me dizer como pego?


Re: OnRconLoginAttempt - WLSF - 29.01.2015

Vocк nгo tб conseguindo pegar o nome ? Mostre o cуdigo que vocк usou para isso.


Re: OnRconLoginAttempt - Mackdaddy - 29.01.2015

Код:
public OnRconLoginAttempt(ip[], password[], success)
{
	if(!success)
	{
	        new IPEnd[16], stringban[100];
		for(new i; i < P_MaxPlayersSlots; i++)
		{
		    if(!IsPlayerConnected(i))
			GetPlayerIp(i, IPEnd, sizeof(IPEnd));
			if(!strcmp(ip, IPEnd, false))
			{
			    format(stringban, sizeof(stringban), "RCON - O Jogador %s tentou logar na RCON do Servidor e foi Banido.", );
			    SendClientMessageToAll(VERMELHO, stringban);
Aquela format ali tб incompleta porque nгo tenho o nome.


Re: OnRconLoginAttempt - WLSF - 29.01.2015

Vocк nem tentou.

GetPlayerName, olhe na wiki samp... й semelhante a funзгo do GetPlayerIp


Re: OnRconLoginAttempt - .Skool_. - 29.01.2015

Код:
public OnRconLoginAttempt(ip[], password[], success)
{
	if(!success)
	{
	        new IPEnd[16], stringban[100], nome[MAX_PLAYER_NAME];
		for(new i; i < P_MaxPlayersSlots; i++)
		{
		    if(!IsPlayerConnected(i))
			GetPlayerIp(i, IPEnd, sizeof(IPEnd));
                        GetPlayerName(i, nome, sizeof(nome));
			if(!strcmp(ip, IPEnd, false))
			{
			    format(stringban, sizeof(stringban), "RCON - O Jogador %s tentou logar na RCON do Servidor e foi Banido.", nome);
			    SendClientMessageToAll(VERMELHO, stringban);
Tб ai.



Re: OnRconLoginAttempt - Mackdaddy - 29.01.2015

Antes de postar este tуpico eu tinha tentado isso:

Код:
public OnRconLoginAttempt(ip[], password[], success)
{
	if(!success)
	{
	        new IPEnd[16], stringban[100];
		for(new i; i < P_MaxPlayersSlots; i++)
		{
		    if(!IsPlayerConnected(i))
			GetPlayerIp(i, IPEnd, sizeof(IPEnd));
			if(!strcmp(ip, IPEnd, false))
			{
			    new Name[MAX_PLAYER_NAME];
			    format(stringban, sizeof(stringban), "RCON - O Jogador %s tentou logar na RCON do Servidor e foi Banido.", GetPlayerName(i, Name, sizeof(Name)));
Sу que aн o Nome buga e dб isso: 3BDD0B522... algo que parece ser um hash(sendo que nem usei nada de hash aн) e quando eu tento isso:

Код:
public OnRconLoginAttempt(ip[], password[], success)
{
	if(!success)
	{
	    new IPEnd[16], stringban[100], Name[MAX_PLAYER_NAME];
		for(new i; i < P_MaxPlayersSlots; i++)
		{
		    if(!IsPlayerConnected(i))
			GetPlayerIp(i, IPEnd, sizeof(IPEnd));
			if(!strcmp(ip, IPEnd, false))
			{
			    format(stringban, sizeof(stringban), "RCON - O Jogador %s tentou logar na RCON do Servidor e foi Banido.", Name);
O nome nгo aparece.


Re: OnRconLoginAttempt - .Skool_. - 29.01.2015

Quote:
Originally Posted by Mackdaddy
Посмотреть сообщение
Antes de postar este tуpico eu tinha tentado isso:

Код:
public OnRconLoginAttempt(ip[], password[], success)
{
	if(!success)
	{
	        new IPEnd[16], stringban[100];
		for(new i; i < P_MaxPlayersSlots; i++)
		{
		    if(!IsPlayerConnected(i))
			GetPlayerIp(i, IPEnd, sizeof(IPEnd));
			if(!strcmp(ip, IPEnd, false))
			{
			    new Name[MAX_PLAYER_NAME];
			    format(stringban, sizeof(stringban), "RCON - O Jogador %s tentou logar na RCON do Servidor e foi Banido.", GetPlayerName(i, Name, sizeof(Name)));
Sу que aн o Nome buga e dб isso: 3BDD0B522... algo que parece ser um hash(sendo que nem usei nada de hash aн) e quando eu tento isso:

Код:
public OnRconLoginAttempt(ip[], password[], success)
{
	if(!success)
	{
	    new IPEnd[16], stringban[100], Name[MAX_PLAYER_NAME];
		for(new i; i < P_MaxPlayersSlots; i++)
		{
		    if(!IsPlayerConnected(i))
			GetPlayerIp(i, IPEnd, sizeof(IPEnd));
			if(!strcmp(ip, IPEnd, false))
			{
			    format(stringban, sizeof(stringban), "RCON - O Jogador %s tentou logar na RCON do Servidor e foi Banido.", Name);
O nome nгo aparece.
Da maneira que postei, nгo funcionou ?



Re: OnRconLoginAttempt - WLSF - 29.01.2015

Se tivesse lido o wiki como eu sugeri, nгo teria esse problema...

https://sampwiki.blast.hk/wiki/GetPlayerName

Код:
A funзгo retorna o tamanho do nome do jogador. 0 caso o jogador nгo esteja online.
Ou seja, nгo se trabalha com o retorno dessa funзгo, mas sim com a variбvel 'Name' que vocк faz pass-reference no mйtodo...

pawn Код:
new nome[MAX_PLAYER_NAME]; //24 length
GetPlayerName(playerid, nome, sizeof(nome)); //retorna o tamanho do nome do jogador, ou 0 se nгo tiver jogador.

print(nome); //ai sim retorna o nome do jogador e imprime o mesmo.



Re: OnRconLoginAttempt - Mackdaddy - 29.01.2015

Eu li o wiki, mas mesmo assim, continua sem aparecer o nome ou retornando Hash(ou seja lб o que й isso)

o Cуdigo atualmente estб assim:
Код:
public OnRconLoginAttempt(ip[], password[], success)
{
	if(!success)
	{
	        new IPEnd[16], stringban[100];
		for(new i; i < P_MaxPlayersSlots; i++)
		{
		    if(!IsPlayerConnected(i))
			GetPlayerIp(i, IPEnd, sizeof(IPEnd));
			if(!strcmp(ip, IPEnd, false))
			{
			    new Name[MAX_PLAYER_NAME];
			    GetPlayerName(i, Name, sizeof(Name));
			    format(stringban, sizeof(stringban), "RCON - O Jogador %s tentou logar na RCON do Servidor e foi Banido.", print(Name));
			    SendClientMessageToAll(VERMELHO, stringban);
Ainda estou aprendendo sobre pawno e nгo sei muitas coisas, mas enfim...
O nome nгo tб aparecendo no lugar do %s, como devo consertar o cуdigo? pode me explicar?


Re: OnRconLoginAttempt - Mackdaddy - 29.01.2015

Nossa desculpa, jб consertei, muito obrigado pela ajuda vocкs dois, era sу colocar o cуdigo anterior do meu post e no lugar do print naquela format eu botei o Name, valeu!