SA-MP Forums Archive
[Ajuda] Anti Cheat launcher - 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] Anti Cheat launcher (/showthread.php?tid=598064)



Anti Cheat launcher - bruxo00 - 08.01.2016

Estou a fazer um anti-cheat para o SAMP. O client й em C#. Para o servidor, pensei em utilizar sockets mas o plugin estб a dar-me alguns problemas. A ъltima versгo (0.2b) nem carrega no servidor. Tentei compilar o source, mas nem isso consigo. O Visual Studio diz que nгo consegue aceder a algumas includes. Jб tentei de tudo, consegui resolver alguns erros mas outros nгo desaparecem.

Na primeira versгo, o servidor carrega o plugin, cria o socket e recebe bem os dados, mas nгo os envia.

Код:
// A simple TCP server sample

#include <a_samp>
#include <socket>

new Socket:g_Socket;

public OnFilterScriptInit()
{
	g_Socket = socket_create(TCP);
	
	if(is_socket_valid(g_Socket))
	{
		socket_set_max_connections(g_Socket, 10);
		socket_listen(g_Socket, 420);
	}
	
	return 1;
}

public OnFilterScriptExit()
{
	if(is_socket_valid(g_Socket))
	{
	    socket_destroy(g_Socket);
	}
}

public onSocketRemoteConnect(Socket:id, remote_client[], remote_clientid)
{
	printf("Incoming connection from [%d:%s]", remote_clientid, remote_client); // [id:ip]
	
	return 1;
}

public onSocketRemoteDisconnect(Socket:id, remote_clientid)
{
	printf("Remote client [%d] has disconnected.", remote_clientid); // [id:ip]
	
	return 1;
}

public onSocketReceiveData(Socket:id, remote_clientid, data[], data_len)
{
	printf("Remote client [%d] has sent: %s", remote_clientid, data); // id & data
	
	socket_send(id, "teste", sizeof(id));
	
	return 1;
}

public onSocketAnswer(Socket:id, data[], data_len)
{
	printf("Data sent %s data lenght %d", data, data_len); // id & data

	return 1;
}
Ou seja, ele recebe o pedido do client mas nгo envia nenhum return. Se alguйm me arranjar a .dll do plugin e o .so da nova versгo para testar, agradecia.

Se nгo, hб mais alguma maneira de conectar o client ao servidor? Pensei em MySQL mas ia ficar muito lento.


Re: Anti Cheat launcher - WooPz - 08.01.2016

mysql supri suas necessidades.

agora sobre ele ser lento sу se seu servidor for bem fraco (muito fraco mesmo) ou sua query ser enorme (com muitos joins). fora isso o mysql serб rбpido como sempre


Re: Anti Cheat launcher - bruxo00 - 08.01.2016

O meu servidor й bem rбpido, mas com muitas conexхes (150) nгo ia afetar o servidor?


Re: Anti Cheat launcher - Dayvison_ - 08.01.2016

Parece besteira, mas tamem podes usar PHP. vocк faz as solicitaзхes do cliente para uma pбgina em PHP, esta se encarrega de levar os dados para o servidor, existe algo como QueryAPI.php
Ae in-game vocК vai fazer o tratamento de tudo por OnRconCommand^^