Same UID for players

Started by Mohamed Boubekri, Mar 26, 2021, 03:37 PM

Previous topic - Next topic

Mohamed Boubekri

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.
| What now ? | Not yet ! |
Morrocan:- [ 🇲🇦 ].

Xmair

You forgot to add plr.Kick();

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

EnForcer

#2
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();
}
}
}

Mohamed Boubekri

#3
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;
}
}
| What now ? | Not yet ! |
Morrocan:- [ 🇲🇦 ].