I wrote a quickie plugin for knives-only for DOD and it works for almost all players. But a few players can circumvent the plugin by quickly switching weapons back and forth. Its like the CurWeapon event isn't being caught and processed every time for them. So the code works. But a few players can trick it somehow. I've tried various combinations of event conditions, and tried putting a weapon check in the event function, but none of that made any difference. Any ideas why?
Code:
#include <amxmodx>
#include <amxmisc>
new g_enable
public plugin_init() {
g_enabled = register_cvar("knivesonly_enable", "0")
register_plugin("Knives Only", "0.1", "Vet")
register_event("CurWeapon", "knivesonly", "be", "1=1", "2!1", "2!2", "2!19", "2!37)
}
public knivesonly(id) {
if (get_pcvar_num(g_enable))
client_cmd(id, "weapon_knife")
}
__________________