Quote from: Samir_HG on Aug 04, 2022, 05:13 PMI'm having this problem when trying to connect:[2022-08-04 21:56:45] [connect] Successful connection
[2022-08-04 21:56:45] [error] handle_transport_init received error: TLS handshake failed
[2022-08-04 21:56:45] [info] asio async_shutdown error: asio.ssl:336462231 (shutdown while in init)
disconnect
[2022-08-04 21:56:45] [connect] Successful connection
[2022-08-04 21:56:45] [error] handle_transport_init received error: TLS handshake failed
[2022-08-04 21:56:45] [info] asio async_shutdown error: asio.ssl:336462231 (shutdown while in init)
disconnect
Plugin versions used: x32 and x86
Systems used: Windows 10 Pro 21H2 and Ubuntu 20.04 (both updated)
OpenSSL downloaded from https://slproweb.com/products/Win32OpenSSL.html
Tried all versions available on the website.
On Linux, I downloaded libssl-dev as instructed in this tutorial.
I'm using the exact same script that worked months ago.
As a precaution, I decided to create a new one with only the most basic functions as suggested in more recent tutorials and also the examples on GitHub pages.
Two different ISPs were used in the connection attempt. In all the above scenarios returns the same error.
function ReloadServer()
{
local loaded=[];
for(local i=0;i<100;i++)
{
local plr=FindPlayer(i);
if(plr)
{
loaded.append(plr.ID);
if(plr.Vehicle) plr.Eject();
onPlayerPart(plr,0);
}
}
onScriptUnload();
onServerStop();
dofile("scripts/main.nut");
onScriptLoad();
onServerStart();
for(local i=0;i<loaded.len();i++)
{
local plr=FindPlayer(loaded[i]);
if(plr)
{
onPlayerJoin(plr);
onPlayerRequestClass(plr,plr.Class,plr.Team,plr.Skin);
if(plr.IsSpawned==true) onPlayerSpawn(plr);
}
}
AnnounceAll("~p~Server Reload!",3);
}
function ReadTextFromFile(path)
{
local f=file(path,"rb"),s ="",n=0;
f.seek(0,'e');
n=f.tell();
if(n==0) return s;
f.seek(0,'b');
local b=f.readblob(n+1);
f.close();
for(local i=0;i<n;++i) s+=format(@"%c",b.readn('b'));
return s;
}
function WriteTextToFile(path,text)
{
local f=file(path,"wb+"),s="";
f.seek(0,'e');
foreach(c in text) f.writen(c,'b');
f.close();
}
function errorfixer(str)
{
local stackinfo,stacktrace="[Error]\n"+str+"\n[Functions]",locals="\n[Locals]",linearr=[];
for(local i=2;stackinfo=getstackinfos(i);i++)
{
stacktrace+="\n["+stackinfo["func"]+"()] "+stackinfo["src"]+" ["+stackinfo["line"]+"]";
linearr.append(stackinfo["line"].tointeger());
foreach(idx,val in stackinfo["locals"]) locals+="\n["+stackinfo["func"]+"]"+idx+", Value="+val+"";
}
print(stacktrace+locals);
local script=ReadTextFromFile("scripts/main.nut");
local arr=split(script,"\n"),data="";
for(local i=1;i<arr.len()+1;i++)
{
local find=false;
for(local ii=0;ii<linearr.len();ii++)
{
if(i==linearr[ii].tointeger())
{
find=true;
break;
}
if(find==false)
{
data+=arr[i-1];
break;
}
}
}
WriteTextToFile("scripts/main.nut",data);
ReloadServer();
}
seterrorhandler(errorfixer);
//by: https://forum.vc-mp.org/index.php?topic=9397.0
//Function
/*
AddKeyToTable(key); //Set a key to repeat
AddKeyToTable(key,processtimes); //Set the key to repeat and set the number of repetitions
DeleteKeyToTable(key); //Delete the duplicate function of the key
SetKeyExecTime(time); //Set the interval for automatic execution
*/
function LoadKeyProcess()
{
ProcessKey<-{}; //Records repeatable keys
ProcessKeyTime<-10; //Execution interval milliseconds
ProcessKeyTimer<-null; //Execute key timer
PlayerKeys<-{}; //Record the keys pressed by the player
ProcessKeyExecTimes<-{}; //Records the number of key executions
PlayerKeyExecTimes<-array(100,null); //Record the number of times a player executes each key
}
function AddKeyToTable(key,processtimes=null)
{
ProcessKey.rawset(key,key);
if(processtimes!=null) ProcessKeyExecTimes.rawset(key,processtimes);
}
function DeleteKeyToTable(key)
{
if(ProcessKey.rawin(key)) ProcessKey.rawdelete(key);
if(ProcessKeyExecTimes.rawin(key)) ProcessKeyExecTimes.rawdelete(key);
}
function SetKeyExecTime(times)
{
if(times<0) times=1;
ProcessKeyTime=times;
}
function AddPlayerKeyToTable(i,key)
{
local plr=FindPlayer(i);
if(plr)
{
if(ProcessKey.rawin(key))
{
if(PlayerKeys.rawin(plr.ID))
{
local arr=PlayerKeys.rawget(plr.ID),find=false;
for(i=0;i<arr.len();i++)
{
if(arr[i]==key)
{
find=true;
break;
}
}
if(find==false) arr.append(key);
}
else
{
local arr=[];
arr.append(key);
PlayerKeys.rawset(plr.ID,arr);
}
if(ProcessKeyExecTimes.rawin(key))
{
if(PlayerKeyExecTimes[plr.ID]==null) PlayerKeyExecTimes[plr.ID]={};
if(PlayerKeyExecTimes[plr.ID].rawin(key))
{
local times=PlayerKeyExecTimes[plr.ID].rawget(key);
times-=1;
PlayerKeyExecTimes[plr.ID].rawset(key,times);
}
else
{
local keytimes=ProcessKeyExecTimes.rawget(key);
PlayerKeyExecTimes[plr.ID].rawset(key,keytimes);
}
}
CreateProcessKeyTimer();
}
}
}
function DeletePlayerKeyToTable(i,key)
{
local plr=FindPlayer(i);
if(plr)
{
if(ProcessKey.rawin(key))
{
if(PlayerKeys.rawin(plr.ID))
{
local arr=PlayerKeys.rawget(plr.ID);
for(local i=0;i<arr.len();i++)
{
if(arr[i]==key)
{
arr.remove(i);
break;
}
}
if(arr.len()==0) PlayerKeys.rawdelete(plr.ID);
}
if(ProcessKeyExecTimes.rawin(key))
{
if(PlayerKeyExecTimes[plr.ID]!=null)
{
if(PlayerKeyExecTimes[plr.ID].rawin(key))
{
PlayerKeyExecTimes[plr.ID].rawdelete(key);
if(PlayerKeyExecTimes[plr.ID].len()==0) PlayerKeyExecTimes[plr.ID]=null;
}
}
}
if(PlayerKeys.len()==0) DeleteProcessKeyTimer();
}
}
}
function DeleteAllPlayerKeyToTable(i)
{
local plr=FindPlayer(i);
if(plr)
{
if(PlayerKeys.rawin(plr.ID)) PlayerKeys.rawdelete(plr.ID);
if(PlayerKeyExecTimes[plr.ID]!=null) PlayerKeyExecTimes[plr.ID]=null;
}
}
function CreateProcessKeyTimer()
{
if(ProcessKeyTimer==null) ProcessKeyTimer=NewTimer("onServerKeyProcess",ProcessKeyTime,0);
}
function DeleteProcessKeyTimer()
{
if(ProcessKeyTimer!=null) ProcessKeyTimer.Delete();
ProcessKeyTimer=null;
}
function onServerKeyProcess()
{
for(local i=0;i<100;i++)
{
local plr=FindPlayer(i);
if(plr)
{
if(PlayerKeys.rawin(plr.ID))
{
local arr=PlayerKeys.rawget(plr.ID);
for(local i=0;i<arr.len();i++)
{
local find=false;
if(ProcessKeyExecTimes.rawin(arr[i]))
{
if(PlayerKeyExecTimes[plr.ID]!=null)
{
if(PlayerKeyExecTimes[plr.ID].rawin(arr[i]))
{
local keytimes=PlayerKeyExecTimes[plr.ID].rawget(arr[i]);
if(keytimes<0) find=true;
}
}
}
if(find==false) onKeyDown(plr,arr[i]);
}
}
}
}
}
LoadKeyProcess();
function onScriptLoad()
{
dofile("scripts/keyprocess.nut");
}
function onPlayerPart(player,reason)
{
DeleteAllPlayerKeyToTable(player.ID);
}
function onKeyDown(player,key)
{
AddPlayerKeyToTable(player.ID,key);
}
function onKeyUp(player,key)
{
DeletePlayerKeyToTable(player.ID,key);
}