PHP Code:
#include <amxmodx>
#include <engine>
#define oldAK "models/v_ak47.mdl"
#define newAK "models/v_ak47_z.mdl"
#define oldDG "models/v_deagle.mdl"
#define newDG "models/v_deagle_z.mdl"
new bool:g_inZoom[33], Float:g_lastZoom[33];
new g_HideWeapon;
public plugin_init()
{
register_plugin("Realistic Weapons", "1.0", "thEsp");
g_HideWeapon = get_user_msgid("HideWeapon");
}
public plugin_precache()
{
precache_model(oldAK);
precache_model(newAK);
precache_model(oldDG);
precache_model(newDG);
}
public client_cmdStart(id)
{
if(g_lastZoom[id] > get_gametime() || !(get_usercmd(usercmd_buttons) & IN_ATTACK2) || get_user_weapon(id) != CSW_AK47)
return PLUGIN_CONTINUE;
g_lastZoom[id] = get_gametime() + 0.25;
if(g_inZoom[id])
{
entity_set_string(id, EV_SZ_viewmodel, oldDG);
message_begin(MSG_ONE, g_HideWeapon, _, id);
write_byte(0<<6);
message_end();
}
else
{
entity_set_string(id, EV_SZ_viewmodel, newDG);
message_begin(MSG_ONE, g_HideWeapon, _, id);
write_byte(1<<6);
message_end();
}
if(g_inZoom[id])
{
entity_set_string(id, EV_SZ_viewmodel, oldDG);
message_begin(MSG_ONE, g_HideWeapon, _, id);
write_byte(0<<6);
message_end();
}
else
{
entity_set_string(id, EV_SZ_viewmodel, newDG);
message_begin(MSG_ONE, g_HideWeapon, _, id);
write_byte(1<<6);
message_end();
}
g_inZoom[id] = !g_inZoom[id];
return PLUGIN_CONTINUE;
}
public client_disconnect(id)
{
g_inZoom[id] = false;
g_lastZoom[id] = 0.0;
}
more weapons can be register in this plugin like i registered the ak47, not tested but compile perfectly.
its a very nice plugin and ur awesome efforts.
__________________