PHP Code:
#include <amxmodx>
#include <fakemeta>
new bool:g_bCustomSkin[ 33 ]; // Holder for whether player gets a custom model or not
new g_szViewModel[ ] = ""; // View model location
new g_szWeaponModel[ ] = ""; // Weapon model location
public plugin_precache()
{
precache_model( g_szViewModel );
precache_model( g_szWeaponModel );
}
public plugin_init()
{
register_event( "CurWeapon", "Event_CurWeapon", "be", "1=1" ); // Register curweapon
register_clcmd( "say /randomknife", "CmdKnife" );
}
public Event_CurWeapon( id )
{
if( !is_user_alive( id ) || !g_bCustomSkin[ id ] ) // If they aren't alive or they don't have a custom skin return
return PLUGIN_CONTINUE;
if( get_user_weapon( id ) == CSW_KNIFE ) // If weapon is a knife
{
set_pev( id, pev_viewmodel2, g_szViewModel ); // set models
set_pev( id, pev_weaponmodel2, g_szWeaponModel ); // set models
}
}
public CmdKnife( id )
{
if( !( get_user_flags( id ) & ADMIN_BAN ) // If they don't have BAN flag return
return PLUGIN_HANDLED;
new iPlayers[ 32 ], iNum;
get_players( iPlayers, iNum );
new iRand = random( iNum ); // Get random player
g_bCustomSkin[ iPlayers[ iNum ] ] = true; // Set the array index to true
}
How Can I Make So If player have ak47 and the other weapon?
Do I make Switch Case Or Else?