I have made this function:-
function Check(player)
{
for (local i = 0; i < GetMaxPlayers(); ++i)
{
local plr = FindPlayer(i);
if (plr.UID == player.UID )
{
MessagePlayer("Ok we kicking you out.",plr); //rani hna w last pos nzid nriglha
}
}
}
The function is not working, When i enter the server he is kick me out
The idea is, if the player was in server he is can't enter again, The server will catch him UID and kick him out.
You forgot to add plr.Kick();
Here you go
Untested code.
function Check(player)
{
for (local i = 0; i < GetMaxPlayers(); i++)
{
local plr = FindPlayer(i);
if ( (plr.UID == player.UID) && ( plr.ID != player.ID) )
{
MessagePlayer("Multi Clienting not allowed.",player); //rani hna w last pos nzid nriglha
player.Kick();
}
}
}
Quote from: EnForcer on Mar 27, 2021, 06:06 AMHere you go
Untested code.
function Check(player)
{
for (local i = 0; i < GetMaxPlayers(); i++)
{
local plr = FindPlayer(i);
if ( (plr.UID == player.UID) && ( plr.ID != player.ID) )
{
MessagePlayer("Multi Clienting not allowed.",player); //rani hna w last pos nzid nriglha
player.Kick();
}
}
}
Thank you. But there is a small problem, when in the server a single player, the console throw an error like
plr ID does not found. This function below working great:
function Check(player) //when player in server, he can't enter again
{
for (local i = 0; i < GetMaxPlayers(); i++)
{
local plr = FindPlayer(i);
if ( player.ID != plr.ID && player.UID == plr.UID )
{
MessagePlayer("Multi Clienting not allowed.",player);
player.Kick();
}
else return;
}
}