the buggy code is there, that this laser just the "best" the "first" and the "last" player became... But it dont work as it should!
If the players connect and the item menu pops up, they got it all...
if they turn later to another item then its disabled for "this time", but if you take a weapon of a teammate wich have it you got both items...
dont understand me wrong, if you wan to use it, do it but you should know it dont works like it should so there can come complications later if the server iss full maybe!
I also looking for this problem, because it should work in the right way... without any bugs
By the way... i think you have not all what you need...
Code:
enum _:ItemsInfo
{
ITEM_LASER, // Done
ITEM_SUICIDE, // Done
ITEM_POISON, // Done
ITEM_ADRENALINE, // Done
ITEM_MEDKIT // Done
};
//and later.....
g_hItemsMenu = menu_create( "Choose an Item:", "ItemsMenu_Handler" );
for( new i = 0; i < ItemsInfo; i++ )
{
num_to_str( i, szInfo, charsmax( szInfo ) );
if( i == ITEM_LASER )
{
menu_additem( g_hItemsMenu, g_szItemNames[ i ], szInfo, _, menu_makecallback( "LaserItem_Callback" ) );
}
else menu_additem( g_hItemsMenu, g_szItemNames[ i ], szInfo );
}
}
public LaserItem_Callback( id, hMenu, iItem )
{
if( g_iCurrentRound == 0 )
return ITEM_DISABLED;
new iFrags = get_user_frags( id );
new iDeaths = get_user_deaths( id );
new iPlayerFrags;
new iPlayers[ 32 ], iNum;
get_players( iPlayers, iNum, "ae", "CT" );
if( iNum == 1 )
return ITEM_DISABLED;
for( new i = 0, iPlayer; i < iNum; i++ )
{
iPlayer = iPlayers[ i ];
if( !is_user_alive( iPlayer ) || iPlayer == id )
continue;
iPlayerFrags = get_user_frags( iPlayer );
if( iPlayerFrags > iFrags )
return ITEM_DISABLED;
else if( iPlayerFrags == iFrags )
{
if( get_user_deaths( iPlayer ) < iDeaths )
return ITEM_DISABLED;
}
}
return ITEM_ENABLED;
}
Look at the "Laser" functions and lock them out of the item menu if you dont want use items... but dont ask me how, i'm new at this...
__________________