Народ, крч, пишу значит свой способ новых пушек и тут такая шняга)
Нужно, если оружия не существует оно удаляется из списка что бы не заменялось другое оружие на сервере.
Голова уже не варит, есть идеи?
Код:
#include < amxmodx >
#include < engine >
#include < cstrike >
#include < fakemeta >
#include < hamsandwich >
#include < fun >
#define 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))
new const models [ ][ ] =
{
"models/up_wp/v_sr25.mdl",
"models/up_wp/p_sr25.mdl",
"models/up_wp/w_sr25.mdl"
}
new weapons [ 255 ], len
public plugin_init ( )
{
register_plugin ( "SR-25 Desert", "1.0", "OverGame" )
register_event ( "CurWeapon", "Event_CurWeapon", "be","1=1" )
RegisterHam ( Ham_TakeDamage, "player", "ham_damager", 0 )
register_logevent ( "logevent_round_start", 2, "1=Round_Start" )
format ( weapons, charsmax ( weapons ), "" )
}
public logevent_round_start ( )
{
format ( weapons, charsmax ( weapons ), "" )
}
public ham_damager ( victim, inflicator, attacker, Float:damage )
{
if ( !is_user_connected ( attacker ) && victim == attacker || !victim )
return
new wp_id [ 33 ], clip, ammo
new weapon = get_user_weapon ( attacker, clip, ammo )
wp_id [ attacker ] = get_entity_weapon ( attacker )
if ( weapon == CSW_G3SG1 && contain ( weapons, wp_id [ attacker ] ) != -1 )
SetHamParamFloat ( 4, damage * 2.0 )
}
public plugin_natives ( )
{
register_native ( "give_wp_sr25", "native_give_wp_sr25", 1 )
}
public native_give_wp_sr25 ( id )
{
give_wp ( id )
return 1
}
public plugin_precache ( )
{
for ( new i; i < sizeof ( models ); i++ )
precache_model ( models [ i ] )
}
public Event_CurWeapon ( id )
{
new wp_id [ 33 ]
wp_id [ id ] = get_entity_weapon ( id )
if ( contain ( weapons, wp_id [ id ] ) != -1 )
{
entity_set_string ( id, EV_SZ_viewmodel, models [ 0 ] )
entity_set_string ( id, EV_SZ_weaponmodel, models [ 1 ] )
}
}
public give_wp ( id )
{
drop_primary ( id )
give_item ( id, "weapon_g3sg1" )
cs_set_user_bpammo ( id, CSW_G3SG1, 90 )
set_task ( 0.5, "add_wp", id )
}
public add_wp ( id )
{
if ( contain ( weapons, "" ) != -1 )
{
len += format ( weapons [ len ], charsmax ( weapons ) - len, ",%s", get_entity_weapon ( id ) )
} else {
len += format ( weapons [ len ], charsmax ( weapons ) - len, "%s", get_entity_weapon ( id ) )
}
Event_CurWeapon ( id )
}
stock get_entity_weapon ( id )
{
return get_pdata_cbase ( id, 373, 5 )
}
stock drop_primary ( id )
{
new wp_buffer [ 32 ], num
get_user_weapons ( id, wp_buffer, num )
for ( new i = 0; i < num; i++ )
{
if ( PRIMARY_WEAPONS_BITSUM & ( 1<<wp_buffer [ i ] ) )
{
static wname [ 32 ]
get_weaponname ( wp_buffer [ i ], wname, sizeof wname - 1 )
engclient_cmd ( id, "drop", wname )
}
}
}
Отредактировал: OverGame, - 23.5.2015, 23:52