Alright, I know exactly what's happening here. I used to use HLTV event to count how many CT and T alive players there is, and I always used to get false results. If a T was killed the round before, he won't be counted. I realised that HLTV is executed almost before all the players have been spawned. Solution? I delayed the event for about 0.2 seconds and everything worked fine. Please try the following code and let me know the result:
PHP Code:
#include < amxmodx >
#include < fun >
// #include < fakemeta >
public plugin_init( ) {
register_plugin( "Strip Test", "1.0", "tonykaram1993" );
register_event( "HLTV", "Event_HLTV", "a", "1=0", "2=0" );
}
public Event_HLTV( ) {
set_task( 0.2, "Task_DelayedHLTV" );
}
public Task_DelayedHLTV( ) {
static iPlayers[ 32 ], iNum, iLoop, iTempID;
get_players( iPlayers, iNum, "a" );
for( iLoop = 0; iLoop < iNum; iLoop++ ) {
iTempID = iPlayers[ iLoop ];
/*
However I do not recommend you to strip players this way,
since it could bug the player and he will not be able to
pickup a primary weapon anymore. If you want you can use
the commented function below (you need to include fakemeta
tho)
*/
strip_user_weapons( iTempID );
give_item( iTempID, "weapon_knife" );
}
}
/*
To use the function below, you need to include fakemeta above
*/
/*StripPlayerWeapons( iPlayerID ) {
strip_user_weapons( iPlayerID );
set_pdata_int( iPlayerID, 116, 0 );
give_item( iPlayerID, "weapon_knife" );
}*/
__________________