ValveSoftware / halflife

Half-Life 1 engine based games
Other
3.72k stars 625 forks source link

[GoldSource/CS][Bug] 'Free Look' absent crosshair #2174

Open ArmynC opened 5 years ago

ArmynC commented 5 years ago

Originally while client is in free look he should have a crosshair but due to bug it's random

fr_no_cross

(Bugged - no corsshair)

fr_with_cross

(Fixed - with corsshair)

Original topic & the code for fix

twisterniq commented 5 years ago

Actually that fix doesn't work for me. I've added a minor change (task with 0.1 time) to that plugin so now it works fine:

#include <amxmodx>

#define PLUGIN_NAME    "Free Look Crosshair Fix"
#define PLUGIN_VERSION "1.3"
#define PLUGIN_AUTHOR  "Numb"

new g_iMsgCrosshair;

public plugin_init()
{
    register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);

    register_event("TextMsg", "Event_TextMsg", "b", "1=4", "2=#Spec_Mode3");

    g_iMsgCrosshair = get_user_msgid("Crosshair");
}

public Event_TextMsg(id)
{
    set_task(0.1, "task_SetCrosshair", id);
}

public task_SetCrosshair(id)
{
    if(is_user_connected(id) && !is_user_alive(id))
    {
        message_begin(MSG_ONE, g_iMsgCrosshair, .player = id);
        write_byte(1);
        message_end();
    }
}
ArmynC commented 5 years ago

Oh, I forgot about that bug in the plugin. Sometimes it worked and other times, not.