Участник
Пользователь
- Сообщения
- 103
- Реакции
- 5
- Помог
- 2 раз(а)
- Ошибка
-
Скрин
- Компилятор
- Локальный
- Amx Mod X
- Исходный код
-
#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>
new szWeaponList[][] =
{
"",
"weapon_ak47",
"weapon_m4a1",
"weapon_awp",
"weapon_deagle"
};
new iWeaponAmmo[] = { 0, 30, 30, 20, 28 };
new szVModel[][] =
{
"",
"models/gold1/v_ak47.mdl",
"models/gold1/v_m4a1.mdl",
"models/gold1/v_awp.mdl",
"models/gold1/v_deagle.mdl",
"models/gold1/p_ak47.mdl",
"models/gold1/p_m4a1.mdl",
"models/gold1/p_awp.mdl",
"models/gold1/p_deagle.mdl",
"models/gold1/w_ak47.mdl",
"models/gold1/w_m4a1.mdl",
"models/gold1/w_awp.mdl",
"models/gold1/w_deagle.mdl",
"models/asimov1/p_ak47.mdl",
"models/asimov1/p_m4a1.mdl",
"models/asimov1/p_awp.mdl",
"models/asimov1/p_deagle.mdl"
"models/asimov1/v_ak47.mdl",
"models/asimov1/v_m4a1.mdl",
"models/asimov1/v_awp.mdl",
"models/asimov1/v_deagle.mdl"
"models/asimov1/w_ak47.mdl",
"models/asimov1/w_m4a1.mdl",
"models/asimov1/w_awp.mdl",
"models/asimov1/w_deagle.mdl"
};
public plugin_init()
{
register_plugin( "[PNR] Weapon", "1.1", "Coder" );
register_clcmd( "vipmenu2", "ShowMenuGold" );
RegisterHam( Ham_Item_Deploy, "weapon_ak47", "HamHook_Item_Deploy", 1 );
RegisterHam( Ham_Item_Deploy, "weapon_m4a1", "HamHook_Item_Deploy", 1 );
RegisterHam( Ham_Item_Deploy, "weapon_awp", "HamHook_Item_Deploy", 1 );
RegisterHam( Ham_Item_Deploy, "weapon_deagle", "HamHook_Item_Deploy", 1 );
}
public plugin_precache()
{
for( new a = 0; a < sizeof( szVModel ); a++ )
if ( szVModel[ a ][ 0 ]) precache_model( szVModel[ a ] );
}
public ShowMenuGold( const playerid )
{
if ( ! ( get_user_flags( playerid ) & ADMIN_LEVEL_H ) )
{
client_print( playerid, print_chat, "Сначала приобрети випку" );
return PLUGIN_HANDLED;
}
new MenuID = menu_create( "\yМеню Оружия: \rGold", "_MenuGold" );
menu_additem( MenuID, "AK Gold", "1" );
menu_additem( MenuID, "M4 Gold", "2" );
menu_additem( MenuID, "AWP Gold", "3" );
menu_additem( MenuID, "Deagle Gold", "4" );
menu_additem( MenuID, "Перейти в Asimov", "5" );
menu_setprop( MenuID, MPROP_EXITNAME, "Выход" );
menu_display( playerid, MenuID );
return PLUGIN_HANDLED;
}
public _ShowMenuAsimov( const playerid )
{
new MenuID = menu_create( "\yМеню Оружия: \rAsimov", "_MenuAsimov" );
menu_additem( MenuID, "AK Asimov", "1" );
menu_additem( MenuID, "M4 Asimov", "2" );
menu_additem( MenuID, "AWP Asimov", "3" );
menu_additem( MenuID, "Deagle Asimov", "4" );
menu_setprop( MenuID, MPROP_EXITNAME, "Выход" );
menu_display( playerid, MenuID );
return PLUGIN_HANDLED;
}
public _MenuAsimov( const playerid, const iMenu, const iItem )
{
if( iItem == MENU_EXIT )
{
menu_destroy( iMenu );
return PLUGIN_HANDLED;
}
new szData[ 6 ], szName[ 64 ], iCallback, iAcces, iKey;
menu_item_getinfo( iMenu, iItem, iAcces, szData, charsmax( szData ), szName, charsmax( szName ), iCallback );
iKey = str_to_num(szData);
give_item_ex2( playerid, szWeaponList[ iKey ], iWeaponAmmo[ iKey ], ( iKey == 4 ) ? 0 : 1, 13378 + iKey + 4 );
menu_destroy( iMenu );
return PLUGIN_HANDLED;
}
public _MenuGold( const playerid, const iMenu, const iItem )
{
if( iItem == MENU_EXIT )
{
menu_destroy( iMenu );
return PLUGIN_HANDLED;
}
new szData[ 6 ], szName[ 64 ], iCallback, iAcces, iKey;
menu_item_getinfo( iMenu, iItem, iAcces, szData, charsmax( szData ), szName, charsmax( szName ), iCallback );
iKey = str_to_num( szData );
if ( iKey == 5 )
{
_ShowMenuAsimov( playerid );
menu_destroy( iMenu );
return PLUGIN_HANDLED;
}
give_item_ex2( playerid, szWeaponList[ iKey ], iWeaponAmmo[ iKey ], ( iKey == 4 ) ? 0 : 1, 13378 + iKey );
menu_destroy( iMenu );
return PLUGIN_HANDLED;
}
public HamHook_Item_Deploy( const iItem )
{
if ( pev_valid( iItem ) != 2 )
return HAM_IGNORED;
new playerid = get_pdata_cbase( iItem, 41, 4 );
set_pev( playerid, pev_viewmodel2, szVModel[ pev( iItem, pev_impulse ) - 13378 ] );
return HAM_IGNORED;
}
const PRIMARY_WEAPONS_BITSUM = ( 1<<CSW_SCOUT )|( 1<<CSW_XM1014 )|( 1<<CSW_MAC10 )|( 1<<CSW_AUG )|( 1<<CSW_UMP45 )|( 1<<CSW_SG550 )|( 1<<CSW_GALIL )|( 1<<CSW_FAMAS )|( 1<<CSW_AWP )|( 1<<CSW_MP5NAVY )|( 1<<CSW_M249 )|( 1<<CSW_M3 )|( 1<<CSW_M4A1 )|( 1<<CSW_TMP )|( 1<<CSW_G3SG1 )|( 1<<CSW_SG552 )|( 1<<CSW_AK47 )|( 1<<CSW_P90 );
const SECONDARY_WEAPONS_BITSUM = ( 1<<CSW_P228 )|( 1<<CSW_ELITE )|( 1<<CSW_FIVESEVEN )|( 1<<CSW_USP )|( 1<<CSW_GLOCK18 )|( 1<<CSW_DEAGLE );
stock give_item_ex2( pId, currWeaponName[], ammoAmount, dropFlag =1, iKey = -1 )
{
static weaponsList[ 32 ], weaponName[ 32 ], weaponsNum, currWeaponID;
currWeaponID = get_weaponid( currWeaponName );
if( dropFlag )
{
weaponsNum = 0;
get_user_weapons( pId,weaponsList,weaponsNum );
for ( new i;i < weaponsNum;i++ )
{
if( ( ( 1 << currWeaponID ) & PRIMARY_WEAPONS_BITSUM && ( 1 << weaponsList[ i ] ) & PRIMARY_WEAPONS_BITSUM) | ( ( 1 << currWeaponID ) & SECONDARY_WEAPONS_BITSUM && ( 1 << weaponsList[ i ] ) & SECONDARY_WEAPONS_BITSUM ) )
{
get_weaponname( weaponsList[ i ],weaponName,charsmax( weaponName ) );
engclient_cmd( pId,"drop",weaponName );
}
}
}
fm_give_item2( pId, currWeaponName, iKey );
cs_set_user_bpammo( pId, currWeaponID, ammoAmount );
return 1;
}
stock fm_give_item2( index, const item[], iKey )
{
if ( !equal( item, "weapon_", 7 ) && !equal( item, "ammo_", 5 ) && !equal( item, "item_", 5 ) && !equal( item, "tf_weapon_", 10 ) )
return 0;
new Entity = engfunc( EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, item));
if ( !pev_valid( Entity ) )
return 0;
new Float:origin[3];
pev( index, pev_origin, origin );
set_pev( Entity, pev_origin, origin );
set_pev( Entity, pev_spawnflags, pev( Entity, pev_spawnflags ) | SF_NORESPAWN );
if ( iKey > 0 ) set_pev( Entity, pev_impulse, iKey );
dllfunc( DLLFunc_Spawn, Entity );
new save = pev( Entity, pev_solid );
dllfunc( DLLFunc_Touch, Entity, index );
if ( pev( Entity, pev_solid ) != save )
return Entity;
engfunc( EngFunc_RemoveEntity, Entity );
return -1;
}
Не могу скомпилировать
В этой теме было размещено решение! Перейти к решению.
Вложения
-
11.3 KB Просмотры: 616