Как изменить любой плагин, чтобы он действовал только для админов с определенным флагом? К примеру плагин grenade_sack-0.4.1.amxx(дает возможност купить более одной гранаты)-как изменить SMA, что бы только админ с определенным флагом мог покупать более 1й гранаты?????????
new MSG_NO_FUNDS[] = "You have insufficient funds!"; new MSG_CANT_CARRY[] = "You cannot carry anymore!";
new CVAR_STR_FB[] = "mp_max_fb"; new CVAR_STR_HE[] = "mp_max_he"; new CVAR_STR_SG[] = "mp_max_sg";
new VAL_DEF_FB[] = "3"; new VAL_DEF_HE[] = "2"; new VAL_DEF_SG[] = "2";
new NADE_PICKUP_SOUND[] = "items/9mmclip1.wav";
// The following block of code was VEN's idea // ---> // initial AMXX version number supported CVAR pointers in get/set_pcvar_* natives #define CVAR_POINTERS_AMXX_INIT_VER_NUM 170
// determine if get/set_pcvar_* natives can be used #if defined AMXX_VERSION_NUM && AMXX_VERSION_NUM >= CVAR_POINTERS_AMXX_INIT_VER_NUM #define CVAR_POINTERS new g_PCVAR_FB; new g_PCVAR_HE; new g_PCVAR_SG;
new pToucherMdl[64]; entity_get_string(pToucher , EV_SZ_model , pToucherMdl , 63);
new model = check_nade_model(pToucherMdl); /* Check if the model is a grenade's */
if(model != -1) /* If it's a grenade it'll return a value > -1 */ { new ammo = cs_get_user_bpammo(pTouched , model) , max_ammo;
switch(model) /* Get the max values for grenade ammo types */ { case CSW_FLASHBANG: max_ammo = get_nade_num(CSW_FLASHBANG); case CSW_HEGRENADE: max_ammo = get_nade_num(CSW_HEGRENADE); case CSW_SMOKEGRENADE: max_ammo = get_nade_num(CSW_SMOKEGRENADE); }
if(max_ammo <= 0) /* If the max ammo cvar doesn't have a value > 0 then hault the code */ return PLUGIN_CONTINUE;
if(ammo <= 0) /* Let CS handle the first grenade */ { set_entity_visibility(pToucher , 0); entity_set_int(pToucher , EV_INT_iuser1 , 1);
return PLUGIN_CONTINUE; }
if(ammo > 0 && ammo < max_ammo) /* Everything is OK so give the grenade! */ { set_entity_visibility(pToucher , 0); entity_set_int(pToucher , EV_INT_iuser1 , 1); give_nade(pTouched , model);
return PLUGIN_HANDLED; } }
return PLUGIN_CONTINUE; }
public give_nade(id , grenade) { new ammo = cs_get_user_bpammo(id , grenade); cs_set_user_bpammo(id , grenade , ammo + 1);
public get_nade_num(grenade) { switch(grenade) { case CSW_FLASHBANG: return CVAR_FB; case CSW_HEGRENADE: return CVAR_HE; case CSW_SMOKEGRENADE: return CVAR_SG; }
new MSG_NO_FUNDS[] = "You have insufficient funds!"; new MSG_CANT_CARRY[] = "You cannot carry anymore!";
new CVAR_STR_FB[] = "mp_max_fb"; new CVAR_STR_HE[] = "mp_max_he"; new CVAR_STR_SG[] = "mp_max_sg";
new VAL_DEF_FB[] = "3"; new VAL_DEF_HE[] = "2"; new VAL_DEF_SG[] = "2";
new NADE_PICKUP_SOUND[] = "items/9mmclip1.wav";
// The following block of code was VEN's idea // ---> // initial AMXX version number supported CVAR pointers in get/set_pcvar_* natives #define CVAR_POINTERS_AMXX_INIT_VER_NUM 170
// determine if get/set_pcvar_* natives can be used #if defined AMXX_VERSION_NUM && AMXX_VERSION_NUM >= CVAR_POINTERS_AMXX_INIT_VER_NUM #define CVAR_POINTERS new g_PCVAR_FB; new g_PCVAR_HE; new g_PCVAR_SG;
new pToucherMdl[64]; entity_get_string(pToucher , EV_SZ_model , pToucherMdl , 63);
new model = check_nade_model(pToucherMdl); /* Check if the model is a grenade's */
if(model != -1) /* If it's a grenade it'll return a value > -1 */ { new ammo = cs_get_user_bpammo(pTouched , model) , max_ammo;
switch(model) /* Get the max values for grenade ammo types */ { case CSW_FLASHBANG: max_ammo = get_nade_num(CSW_FLASHBANG); case CSW_HEGRENADE: max_ammo = get_nade_num(CSW_HEGRENADE); case CSW_SMOKEGRENADE: max_ammo = get_nade_num(CSW_SMOKEGRENADE); }
if(max_ammo <= 0) /* If the max ammo cvar doesn't have a value > 0 then hault the code */ return PLUGIN_CONTINUE;
if(ammo <= 0) /* Let CS handle the first grenade */ { set_entity_visibility(pToucher , 0); entity_set_int(pToucher , EV_INT_iuser1 , 1);
return PLUGIN_CONTINUE; }
if(ammo > 0 && ammo < max_ammo) /* Everything is OK so give the grenade! */ { set_entity_visibility(pToucher , 0); entity_set_int(pToucher , EV_INT_iuser1 , 1); give_nade(pTouched , model);
return PLUGIN_HANDLED; } }
return PLUGIN_CONTINUE; }
public give_nade(id , grenade) { new ammo = cs_get_user_bpammo(id , grenade); cs_set_user_bpammo(id , grenade , ammo + 1);
public get_nade_num(grenade) { switch(grenade) { case CSW_FLASHBANG: return CVAR_FB; case CSW_HEGRENADE: return CVAR_HE; case CSW_SMOKEGRENADE: return CVAR_SG; }