Bits problem
I made this plugin but it doesn't give me weapons. Where could be the problem ? Becouse i can't fint it.
PHP Code:
#include < amxmodx >
#include < amxmisc >
#include < fun >
#include < cstrike >
#include < hamsandwich >
#define SetPlayerBit(%1,%2) (%1 |= (1 << (%2 & 31)))
#define ResetPlayerBit(%1,%2) (%1 &= ~(1 << (%2 & 31)))
#define GetPlayerBit(%1,%2) (%1 & (1 << (%2 & 31)))
new const WEAPONSN[ ][ ] = { "weapon_m4a1", "weapon_m3", "weapon_deagle" };
new const WEAPONSC[ ] = { CSW_M4A1, CSW_M3, CSW_DEAGLE };
new const WEAPONSA[ ] = { 90, 32, 0, 32, 1 };
enum _:PlayerData {
kills,
deaths
}
new g_alive;
new g_player[ 32 ][ PlayerData ];
public plugin_init( ) {
register_plugin( "Test Bits/Enum", "1.0", "TBagT" );
RegisterHam( Ham_Spawn, "player", "bacon_spawn", 1 );
register_event( "DeathMsg", "deathmsg", "a" );
register_logevent( "RoundStart", 2, "1=Round_Start" );
register_clcmd( "say !info", "show_info_player" );
}
public bacon_spawn( id ) {
is_user_alive( id ) ? SetPlayerBit( g_alive, id ) : ResetPlayerBit( g_alive, id )
}
public RoundStart( ) {
new player[ 32 ], i, iNum;
get_players( player, iNum, "ac" );
for( i = 0; i < iNum; i++ ) {
set_task( 3.0, "give_weapon", i );
}
}
public deathmsg( ) {
is_user_alive( id ) ? SetPlayerBit( g_alive, id ) : ResetPlayerBit( g_alive, read_data( 2 ) );
remove_task( read_data( 2 ) );
g_player[ read_data( 1 ) ][ kills ]++;
g_player[ read_data( 2 ) ][ deaths ]++;
}
public give_weapon( id ) {
if( !GetPlayerBit( g_alive, id ) ) return;
cs_set_user_armor( id, 100, CS_ARMOR_VESTHELM );
strip_user_weapons( id );
give_item( id, "weapon_knife" );
for( new i = 0; i < sizeof WEAPONSN; i++ ) {
give_item( id, WEAPONSN[ i ] );
cs_set_user_bpammo( id, WEAPONSC[ i ], WEAPONSA[ i ] );
}
}
public show_info_player( id ) {
client_print( id, print_chat, "Your Kills: %i, your deaths: %i.", g_player[ id ][ kills ], g_player[ id ][ deaths ] );
}
|