How to block two players with the same UID
Written on the fly so make sure to test before.
_UID_Pool <- [];
function onServerStart()
{
_UID_Pool = array(GetMaxPlayers());
}
function onServerStop()
{
foreach (idx, uid in _UID_Pool) _UID_Pool[idx] = null;
}
function onPlayerJoin(i_player)
{
foreach (idx, uid in _UID_Pool) {
if (uid == i_player.UniqueID) return i_player.kick();
}
_UID_Pool[i_player.ID] = i_player.UniqueID;
}
function onPlayerPart(i_player, reason)
{
_UID_Pool[i_player.ID] = null;
}
Thanks!
function onPlayerJoin( player )
{
Check_MAC( player );
}
function Check_MAC( player )
{
for( local plr, i = 0; i <= GetMaxPlayers(); plr = FindPlayer( i++ ) )
{
if ( player && plr )
{
if ( plr.ID == player.ID ) return;
if ( player.UniqueID == plr.UniqueID ) KickPlayer( player );
}
}
}