/*************************************************** Cvar: amx_knifeonly_time okresla przez jaki czas nie mozemy podniesc/kupic/uzyc jakiejkolwiek broni poza nozem i C4. Jezeli przyjmuje wartosc <=0.0 to brana jest pod uwage wartosc cvar'a mp_freezetime 1.0 - wersja poczatkowa 1.1 - zmiana spobu metody uzywanej do broni: hamsandwich -> fakemeta ***************************************************/ #include #include #include #include #include new bool: gCan_pickup[33] new bool: gIn_game[33] new pcTime, pcFreez new Float: gAlowtime public plugin_init() { register_plugin("Only Knife At Start", "1.1", "Pavulon") pcFreez = get_cvar_pointer("mp_freezetime") pcTime = register_cvar("amx_knifeonly_time", "0.0") RegisterHam(Ham_Spawn,"player","pre_player_spawn",0) register_event("WeapPickup","event_weappickup","be") register_event("CurWeapon","event_curweapon","be", "1=1") register_event("DeathMsg","event_deathmsg","a") } public plugin_cfg() { gAlowtime = get_pcvar_float(pcTime) if (gAlowtime<=0.0) gAlowtime = get_pcvar_float(pcFreez) } public client_putinserver(id) { gCan_pickup[id] = false gIn_game[id] = false } public client_disconnect(id) { gIn_game[id] = false gCan_pickup[id] = false } public pre_player_spawn(id) { gCan_pickup[id] = false if (task_exists(id)) remove_task(id) set_task(gAlowtime, "allow_pickup", id) if (gIn_game[id]) strip_prev(id) gIn_game[id] = true return HAM_IGNORED } public event_deathmsg() { gCan_pickup[read_data(2)] = false } public allow_pickup(id) { gCan_pickup[id] = true } public event_curweapon(id) { if (gCan_pickup[id]) return PLUGIN_HANDLED new wId = read_data(2) if (wId==6 || wId==29) return PLUGIN_HANDLED new task_array[2] task_array[0] = id task_array[1] = wId set_task(0.05,"strip_weapon",_ , task_array, 2) return PLUGIN_HANDLED } public event_weappickup(id) { if (gCan_pickup[id]) return PLUGIN_HANDLED new wId = read_data(1) if (wId==6 || wId==29) return PLUGIN_HANDLED new task_array[2] task_array[0] = id task_array[1] = wId set_task(0.05,"strip_weapon",_ , task_array, 2) return PLUGIN_HANDLED } public strip_weapon(task_array[2]) { new id = task_array[0] if(!is_user_connected(id)) return fm_strip_user_gun(id, task_array[1]) //ham_strip_weapon(id, task_array[1]) } stock strip_prev(id) { new Weapons[32] new numWeapons, i, wId get_user_weapons(id, Weapons, numWeapons) for (i=0; i