Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: Banaqs on Nov 14, 2014, 09:20 AM

Title: How to block two players with the same UID
Post by: Banaqs on Nov 14, 2014, 09:20 AM
How to block two players with the same UID
Title: Re: How to block two players with the same UID
Post by: . on Nov 14, 2014, 09:36 AM
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;
}
Title: Re: How to block two players with the same UID
Post by: Banaqs on Nov 14, 2014, 03:31 PM
Thanks!
Title: Re: How to block two players with the same UID
Post by: Diego^ on May 10, 2015, 03:14 PM
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 );
}
}
}