SA-MP Forums Archive
Help!! - 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)
+--- Thread: Help!! (/showthread.php?tid=641051)



Help!! - KoloradO - 10.09.2017

I'm trying to use this Anti-Cheater Client:

https://sampforum.blast.hk/showthread.php?tid=604051

I tested it on Windows 7 and it worked perfectly perfectly.

But when I switched to VPS Linux ubuntu, an error occurs in socket_connect and the server simply closes.

Part of the code:

Код:
public OnPlayerConnect(playerid)
{
	new pIP[16];
	new string[32];

	bac_Socket[playerid] = socket_create(TCP);
    GetPlayerIp(playerid, pIP, sizeof(pIP));

	IsACConnected[playerid] = false;
	IsCheater[playerid] = false;
	UpdateNeeded[playerid] = false;

	format(string, sizeof(string), "connected |%d| ,%s,", playerid, CURRENT_VERSION); // azeite
    
	socket_connect(bac_Socket[playerid], pIP, 4000);
	socket_send(bac_Socket[playerid], string, sizeof(string));

	SetTimerEx("CheckForACOnConnect", TIMERDELAY_CHECKFORACONCONNECT, false, "i", playerid);

	return 1;
}

public onSocketAnswer(Socket:id, data[], data_len)
{
	print("onSocketAnswer");
	new playerid;
	new output[4][512];
	new md5Hash[512];

	explode(output, data, "'"); // template: [ playerid'status'UID'md5Hash ]

	playerid = strval(output[0]);
	md5Hash = output[3];

	if(strfind(output[1], "secure", true) != -1)
	{
		playerid = strval(output[0]);
	    IsACConnected[playerid] = true;
	}
	else if(strfind(output[1], "cheater", true) != -1)
	{
		SendClientMessage(playerid, ANTICHEATER_COLOR, "[BrasilianZ Anti-Cheater]: {FFFFFF}Vocк foi kickado do servidor. Motivo: Arquivos suspeitos foram detectados.");
	    return SetTimerEx("KickP", 1500, false, "i", playerid);
	}
	else if(strfind(output[1], "off", true) != -1)
	{
	    IsACConnected[playerid] = false;
	}
	else if(strfind(output[1], "online", true) != -1)
	{
	    IsACConnected[playerid] = true;
	}
	else if(strfind(output[1], "updateneed", true) != -1)
	{
	    IsACConnected[playerid] = true;
	    UpdateNeeded[playerid] = true;
	}
	else
	{
	    IsACConnected[playerid] = false;
	}

	if(strcmp(SERVER_MD5HASH, md5Hash))
	{
		SendClientMessage(playerid, ANTICHEATER_COLOR, "[BrasilianZ Anti-Cheater]: {FFFFFF}Seu Cliente Anti-Cheater foi modificado.");
	    //return SetTimerEx("KickP", 1500, false, "i", playerid);
	}

	return 1;
}
Server log:

Код HTML:
socket_connect(): Socket ID 0 has failed to connect.
I believe this happened because the door 4000 is not released. If that's the problem, please tell me how to release it.