This is only theory, I have no idea if it will work:
Code:
#define NADE_FLOOD 1.7 // change to anim time of grenade throw
new smokeNades[33]; // smoke grenade amount
new usingSmokeNade[33]; // if a smoke grenade is out
new canThrowNade[33]; // if a user can throw a smoke grenade
public plugin_init() {
register_clcmd("slot6","cmd_slot6");
register_event("CurWeapon","event_curweapon","b");
}
public event_curweapon(id) {
canThrowNade[id] = 1;
remove_task(id,0);
usingSmokeNade[id] = 0;
}
public cmd_slot6(id) {
if(smokeNades[id] > 0) {
usingSmokeNade[id] = 1;
entity_set_string(id,EV_SZ_viewmodel,"models/v_smokenade.mdl");
entity_set_string(id,EV_SZ_weaponmodel,"models/w_smokenade.mdl");
}
}
public client_PreThink(id) {
if(!is_user_alive(id) || usingSmokeNade[id] == 0) {
return PLUGIN_CONTINUE;
}
new button = get_user_button(id);
if(button & IN_ATTACK) {
entity_set_int(id,EV_INT_button,button & ~IN_ATTACK);
if(canThrowNade[id] > 0) {
canThrowNade[id] = 0;
smokeNades[id]--;
set_task(NADE_FLOOD,"throw_nade",id);
}
}
if(button & IN_ATTACK2) {
entity_set_int(id,EV_INT_button,button & ~IN_ATTACK2);
}
}
public throw_nade(id) {
// make grenade here
canThrowNade[id] = 1;
if(smokeNades[id] == 0) {
// switch back to some other weapon somehow
}
}
There's a base. Good luck.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS