PHP Kod:
/* Plugin generated by AMXX-Studio */
#include < amxmodx >
#include < amxmisc >
#include < fakemeta >
#include < hamsandwich >
#include < fun >
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"
new const BICAK1[] = "models/AsiimowKelebek.mdl";
new const BICAK2[] = "models/CizgiliKarambit.mdl";
new const BICAK3[] = "models/Falchion.mdl";
new const BICAK4[] = "models/KancaliBicak.mdl";
new const BICAK5[] = "models/KirmiziKelebek.mdl";
new const BICAK6[] = "models/KirmiziBayonet.mdl";
new const BICAK7[] = "models/KirmiziKarambit.mdl";
new const BICAK8[] = "models/SariBayonet.mdl";
new g_bicak1, g_bicak2, g_bicak3, g_bicak4,
g_bicak5, g_bicak6, g_bicak7, g_bicak8;
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd( "say /bicakmenu", "bicaklar" );
register_clcmd( "say /bicakmenu", "bicaklar" );
RegisterHam(Ham_Spawn, "player", "Fwd_PlayerSpawn_Post", 1);
register_event("CurWeapon", "Event_Change_Weapon", "be", "1=1")
}
public Fwd_PlayerSpawn_Post( id )
{
if( is_user_alive( id ) )
{
bicaklar( id );
}
}
public Event_Change_Weapon( id )
{
new weaponID = read_data( 2 );
if( weaponID == CSW_KNIFE )
{
if( g_bicak1 & ( 1 << id ) )
{
set_pev( id, pev_viewmodel2, BICAK1 );
}
if( g_bicak2 & ( 1 << id ) )
{
set_pev( id, pev_viewmodel2, BICAK2 );
}
if( g_bicak3 & ( 1 << id ) )
{
set_pev( id, pev_viewmodel2, BICAK3 );
}
if( g_bicak4 & ( 1 << id ) )
{
set_pev( id, pev_viewmodel2, BICAK4 );
}
if( g_bicak5 & ( 1 << id ) )
{
set_pev( id, pev_viewmodel2, BICAK5 );
}
if( g_bicak6 & ( 1 << id ) )
{
set_pev( id, pev_viewmodel2, BICAK6 );
}
if( g_bicak7 & ( 1 << id ) )
{
set_pev( id, pev_viewmodel2, BICAK7 );
}
if( g_bicak8 & ( 1 << id ) )
{
set_pev( id, pev_viewmodel2, BICAK8 );
}
}
}
public bicaklar( id )
{
if( is_user_alive( id ) )
{
new menu = menu_create( "\rBicak Menu", "bicak_ver" );
menu_additem( menu, "\yAsimov Kelebek", "1" );
menu_additem( menu, "\yCizgili Karambit", "2" );
menu_additem( menu, "\yFalcion", "3" );
menu_additem( menu, "\yKancali Bicak", "4" );
menu_additem( menu, "\yKirmizi Kelebek", "5" );
menu_additem( menu, "\yKirmizi Bayonet", "6" );
menu_additem( menu, "\yKirmizi Karambit", "7" );
menu_additem( menu, "\ySari Bayonet", "8" );
menu_setprop( menu, MPROP_EXIT, MEXIT_ALL );
menu_display( id, menu, 0 );
}
return PLUGIN_HANDLED;
}
public bicak_ver( id, menu, item )
{
if(item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new access,callback,data[6],iname[64]
menu_item_getinfo(menu,item,access,data,5,iname,63,callback)
new key = str_to_num(data)
switch(key)
{
case 1 :
{
if( is_user_alive( id ) )
{
g_bicak1 |= ( 1 << id );
g_bicak2 &= ~( 1 << id );
g_bicak3 &= ~( 1 << id );
g_bicak4 &= ~( 1 << id );
g_bicak5 &= ~( 1 << id );
g_bicak6 &= ~( 1 << id );
g_bicak7 &= ~( 1 << id );
g_bicak8 &= ~( 1 << id );
ham_strip_weapon( id, "weapon_knife" );
give_item( id, "weapon_knife" );
renkli_yazi( id ,"!n[ !tBicakMenu !n] !gAsimow Kelebek bicagini aldin" );
}
}
case 2 :
{
if( is_user_alive( id ) )
{
g_bicak1 &= ~( 1 << id );
g_bicak2 |= ( 1 << id );
g_bicak3 &= ~( 1 << id );
g_bicak4 &= ~( 1 << id );
g_bicak5 &= ~( 1 << id );
g_bicak6 &= ~( 1 << id );
g_bicak7 &= ~( 1 << id );
g_bicak8 &= ~( 1 << id );
ham_strip_weapon( id, "weapon_knife" );
give_item( id, "weapon_knife" );
renkli_yazi( id ,"!n[ !tBicakMenu !n] !gCizgili Karambit bicagini aldin" );
}
}
case 3 :
{
if( is_user_alive( id ) )
{
g_bicak1 &= ~( 1 << id );
g_bicak2 &= ~( 1 << id );
g_bicak3 |= ( 1 << id );
g_bicak4 &= ~( 1 << id );
g_bicak5 &= ~( 1 << id );
g_bicak6 &= ~( 1 << id );
g_bicak7 &= ~( 1 << id );
g_bicak8 &= ~( 1 << id );
ham_strip_weapon( id, "weapon_knife" );
give_item( id, "weapon_knife" );
renkli_yazi( id ,"!n[ !tBicakMenu !n] !gFalcion bicagini aldin" );
}
}
case 4 :
{
if( is_user_alive( id ) )
{
g_bicak1 &= ~( 1 << id );
g_bicak2 &= ~( 1 << id );
g_bicak3 &= ~( 1 << id );
g_bicak4 |= ( 1 << id );
g_bicak5 &= ~( 1 << id );
g_bicak6 &= ~( 1 << id );
g_bicak7 &= ~( 1 << id );
g_bicak8 &= ~( 1 << id );
ham_strip_weapon( id, "weapon_knife" );
give_item( id, "weapon_knife" );
renkli_yazi( id ,"!n[ !tBicakMenu !n] !gKancali bicagini aldin" );
}
}
case 5 :
{
if( is_user_alive( id ) )
{
g_bicak1 &= ~( 1 << id );
g_bicak2 &= ~( 1 << id );
g_bicak3 &= ~( 1 << id );
g_bicak4 &= ~( 1 << id );
g_bicak5 |= ( 1 << id );
g_bicak6 &= ~( 1 << id );
g_bicak7 &= ~( 1 << id );
g_bicak8 &= ~( 1 << id );
ham_strip_weapon( id, "weapon_knife" );
give_item( id, "weapon_knife" );
renkli_yazi( id ,"!n[ !tBicakMenu !n] !gKirmizi Kelebek bicagini aldin" );
}
}
case 6 :
{
if( is_user_alive( id ) )
{
g_bicak1 &= ~( 1 << id );
g_bicak2 &= ~( 1 << id );
g_bicak3 &= ~( 1 << id );
g_bicak4 &= ~( 1 << id );
g_bicak5 &= ~( 1 << id );
g_bicak6 |= ( 1 << id );
g_bicak7 &= ~( 1 << id );
g_bicak8 &= ~( 1 << id );
ham_strip_weapon( id, "weapon_knife" );
give_item( id, "weapon_knife" );
renkli_yazi( id ,"!n[ !tBicakMenu !n] !gKirmizi Bayonet bicagini aldin" );
}
}
case 7 :
{
if( is_user_alive( id ) )
{
g_bicak1 &= ~( 1 << id );
g_bicak2 &= ~( 1 << id );
g_bicak3 &= ~( 1 << id );
g_bicak4 &= ~( 1 << id );
g_bicak5 &= ~( 1 << id );
g_bicak6 &= ~( 1 << id );
g_bicak7 |= ( 1 << id );
g_bicak8 &= ~( 1 << id );
ham_strip_weapon( id, "weapon_knife" );
give_item( id, "weapon_knife" );
renkli_yazi( id ,"!n[ !tBicakMenu !n] !gKirmizi Karambit bicagini aldin" );
}
}
case 8 :
{
if( is_user_alive( id ) )
{
g_bicak1 &= ~( 1 << id );
g_bicak2 &= ~( 1 << id );
g_bicak3 &= ~( 1 << id );
g_bicak4 &= ~( 1 << id );
g_bicak5 &= ~( 1 << id );
g_bicak6 &= ~( 1 << id );
g_bicak7 &= ~( 1 << id );
g_bicak8 |= ( 1 << id );
ham_strip_weapon( id, "weapon_knife" );
give_item( id, "weapon_knife" );
renkli_yazi( id ,"!n[ !tBicakMenu !n] !gSari Bayonet bicagini aldin" );
}
}
}
menu_destroy( menu );
return PLUGIN_HANDLED;
}
public plugin_precache( )
{
precache_model( BICAK1 );
precache_model( BICAK2 );
precache_model( BICAK3 );
precache_model( BICAK4 );
precache_model( BICAK5 );
precache_model( BICAK6 );
precache_model( BICAK7 );
precache_model( BICAK8 );
}
stock ham_strip_weapon(id,weapon[])
{
if(!equal(weapon,"weapon_",7)) return 0;
new wId = get_weaponid(weapon);
if(!wId) return 0;
new wEnt;
while((wEnt = engfunc(EngFunc_FindEntityByString,wEnt,"classname",weapon)) && pev(wEnt,pev_owner) != id) {}
if(!wEnt) return 0;
if(get_user_weapon(id) == wId) ExecuteHamB(Ham_Weapon_RetireWeapon,wEnt);
if(!ExecuteHamB(Ham_RemovePlayerItem,id,wEnt)) return 0;
ExecuteHamB(Ham_Item_Kill,wEnt);
set_pev(id,pev_weapons,pev(id,pev_weapons) & ~(1<<wId));
return 1;
}
stock renkli_yazi(const id, const input[], any:...)
{
new count = 1, players[32];
static msg[191];
vformat(msg, 190, input, 3);
replace_all(msg, 190, "!n", "^x01"); // Default Renk(Sarı)
replace_all(msg, 190, "!g", "^x04"); // Yeşil Renk
replace_all(msg, 190, "!t", "^x03"); // Takım Renk( CT mavi , T kırmızı )
if (id) players[0] = id; else get_players(players, count, "ch");
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}