AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Please, Can you Fix the Red Crosshair? (https://forums.alliedmods.net/showthread.php?t=340720)

Ark_Procession 12-05-2022 15:01

Please, Can you Fix the Red Crosshair?
 
In this plugin, a custom crosshair with a sprite, after changing through the red color, you cannot choose it again:

additionally, aiming with krieg or bullpup won't show the custom sprite, but the default crosshair


Edit1: after messing around with the code, i changed places the parts of the code that refered to purple crosshair with red crosshair.

Now, the purple crosshair is the one missing, it seems to me it has something to do with being the first in the code, not the color itself.

HTML Code:

#pragma semicolon 1

#include <amxmodx>

#define NVAULT_SAVE

#define PLUGIN_NAME        "Crosshair Menu"
#define PLUGIN_VERS        "1.0"
#define PLUGIN_AUTH        "Dev"

new const crosshairs[][][] = {
    {"Lined Point","LinedPoint_R","LinedPoint_Y","LinedPoint_G","LinedPoint_P","LinedPoint_C"},
    {"Cross","Cross_R","Cross_Y","Cross_G","Cross_P","Cross_C"},
    {"Cross-2","Cross2_R","Cross2_Y","Cross2_G","Cross2_P","Cross2_C"},
    {"Point","Point_R","Point_Y","Point_G","Point_P","Point_C"},
    {"Square","Square_R","Square_Y","Square_G","Square_P","Square_C"},
    {"Square-2","Square2_R","Square2_Y","Square2_G","Square2_P","Square2_C"},
    {"Cool Cross","CoolCross_R","CoolCross_Y","CoolCross_G","CoolCross_P","CoolCross_C"}
};

new const colors[][] = {
    "Red",
    "Yellow",
    "Green",
    "Purple",
    "Cyan"
};

new
    g_crosshair_type[MAX_PLAYERS + 1],
    g_crosshair_color[MAX_PLAYERS + 1],
    bool:g_scope[MAX_PLAYERS + 1],
    g_msgids[4];

public plugin_init() {
    register_plugin(PLUGIN_NAME, PLUGIN_VERS, PLUGIN_AUTH);

    register_clcmd("say /crosshair", "@clcmd_crosshair");
    register_clcmd("say /cross", "@clcmd_crosshair");

    register_event("SetFOV", "@Event_SetFOV", "be");
    register_event("CurWeapon", "@Event_CurWeapon", "be", "1=1", "2!18");

    g_msgids[0] = get_user_msgid("HideWeapon");
    g_msgids[1] = get_user_msgid("WeaponList");
    g_msgids[2] = get_user_msgid("SetFOV");
    g_msgids[3] = get_user_msgid("CurWeapon");
}

@Event_SetFOV(const id) {
    if(!g_crosshair_type[id]) {
        return;
    }

    new FOV = read_data(1);

    if(FOV == 90) {
        g_scope[id] = false;
    }
    else {
        g_scope[id] = true;
        SetMessage_HideWeapon(id, 0);
    }
}

public plugin_precache() {
    for(new i = 0; i < sizeof(crosshairs); i++) {
        for(new a = 1; a < sizeof(crosshairs[]); a++) {
            precache_generic(fmt("sprites/%s.txt", crosshairs[i][a]));
        }
    }
    precache_generic("sprites/recrosshair.spr");
}

public client_putinserver(id) {
    client_cmd(id, "crosshair 1");
}

@clcmd_crosshair(const id) {
    new menu = menu_create("\yCrosshair Menu", "@clcmd_crosshair_handler");

    if(g_crosshair_type[id]) {
        menu_additem(menu, fmt("Change Crosshair Type \dCurrent: %s", crosshairs[g_crosshair_type[id] - 1][0]), "1");
        menu_additem(menu, fmt("Change Crosshair Color \dCurrent: %s", colors[g_crosshair_color[id]]), "2");
        menu_additem(menu, "Default Crosshair", "3");
    }
    else {
        menu_additem(menu, "Change Crosshair Type \dCurrent: Default", "1");
    }

    menu_display(id, menu);
    return PLUGIN_HANDLED;
}

@clcmd_crosshair_handler(const id, const menu, const item) {
    if(item == MENU_EXIT) {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
    new data[6];
    menu_item_getinfo(menu, item, _, data, charsmax(data));
    new key = str_to_num(data), weapon = get_user_weapon(id);
    switch(key) {
        case 1: {
            g_crosshair_type[id] = Calc(g_crosshair_type[id] + 1, sizeof(crosshairs));
            Change_Crosshair(id, weapon);
        }
        case 2: {
            g_crosshair_color[id] = Calc(g_crosshair_color[id] + 1, sizeof(colors) - 1);
            Change_Crosshair(id, weapon);
        }
        case 3: {
            SetMessage_HideWeapon(id, 0);
            g_crosshair_type[id] = 0;
        }
    }
    @clcmd_crosshair(id);
    return PLUGIN_HANDLED;
}

Calc(const arg, const max) {
    return (arg >
max) ? 1: arg;
}

@Event_CurWeapon(const id) {
    if(!g_crosshair_type[id] || g_scope[id]) {
        return;
    }

    new weapon = read_data(2);
    Change_Crosshair(id, weapon);
}

Change_Crosshair(const id, const weapon) {
    switch(weapon) {
        case CSW_P228: SetMessage_WeaponList(id, 9, 52);
        case CSW_HEGRENADE: SetMessage_WeaponList(id, 12, 1);
        case CSW_XM1014: SetMessage_WeaponList(id, 5, 32);
        case CSW_C4: SetMessage_WeaponList(id, 14, 1);
        case CSW_MAC10: SetMessage_WeaponList(id, 6, 100);
        case CSW_AUG: SetMessage_WeaponList(id, 4, 90);
        case CSW_SMOKEGRENADE: SetMessage_WeaponList(id, 13, 1);
        case CSW_ELITE: SetMessage_WeaponList(id, 10, 120);
        case CSW_FIVESEVEN: SetMessage_WeaponList(id, 7, 100);
        case CSW_UMP45: SetMessage_WeaponList(id, 6, 100);
        case CSW_GALIL: SetMessage_WeaponList(id, 4, 90);
        case CSW_FAMAS: SetMessage_WeaponList(id, 4, 90);
        case CSW_USP: SetMessage_WeaponList(id, 6, 100);
        case CSW_GLOCK18: SetMessage_WeaponList(id, 10, 120);
        case CSW_MP5NAVY: SetMessage_WeaponList(id, 10, 120);
        case CSW_M249: SetMessage_WeaponList(id, 3, 200);
        case CSW_M3: SetMessage_WeaponList(id, 5, 32);
        case CSW_M4A1: SetMessage_WeaponList(id, 4, 90);
        case CSW_TMP: SetMessage_WeaponList(id, 10, 120);
        case CSW_FLASHBANG: SetMessage_WeaponList(id, 11, 2);
        case CSW_DEAGLE: SetMessage_WeaponList(id, 8, 35);
        case CSW_SG552: SetMessage_WeaponList(id, 4, 90);
        case CSW_AK47: SetMessage_WeaponList(id, 2, 90);
        case CSW_KNIFE: SetMessage_WeaponList(id, -1, -1);
        case CSW_P90: SetMessage_WeaponList(id, 7, 100);
        default: return;
    }

    SetMessage_HideWeapon(id, 1<<6);
    SetMessage_SetFOV(id, 89);
    SetMessage_CurWeapon(id);
    SetMessage_SetFOV(id, 90);
}

SetMessage_WeaponList(const id, const pAmmoId, const pAmmoMaxAmount) {
    message_begin(MSG_ONE, g_msgids[1], .player = id); {
        write_string(crosshairs[g_crosshair_type[id] - 1][g_crosshair_color[id] + 1]);
        write_byte(pAmmoId);
        write_byte(pAmmoMaxAmount);
        write_byte(-1);
        write_byte(-1);
        write_byte(0);
        write_byte(11);
        write_byte(2);
        write_byte(0);
    }
    message_end();
}

SetMessage_SetFOV(const id, const FOV) {
    message_begin(MSG_ONE, g_msgids[2], .player = id); {
        write_byte(FOV);
    }
    message_end();
}

SetMessage_CurWeapon(const id) {
    new ammo;
    get_user_weapon(id, ammo);

    message_begin(MSG_ONE, g_msgids[3], .player = id); {
        write_byte(1);
        write_byte(2);
        write_byte(ammo);
    }
    message_end();
}

SetMessage_HideWeapon(const id, const byte) {
    message_begin(MSG_ONE, g_msgids[0], .player = id); {
        write_byte(byte);
    }
    message_end();
}

#if defined NVAULT_SAVE
#include <nvault>


new g_vault;

public plugin_cfg() {
    g_vault = nvault_open("crosshairvault");

    if(g_vault == INVALID_HANDLE) {
        set_fail_state("Unknown nvault for crosshair");
    }
}

public plugin_end() {
    nvault_close(g_vault);
}

public client_authorized(id, const authid[]) {
    g_crosshair_type[id] = nvault_get(g_vault, fmt("%s_type", authid));
    g_crosshair_color[id] = nvault_get(g_vault, fmt("%s_color", authid));
}

public client_disconnected(id) {
    new authid[MAX_AUTHID_LENGTH];
    get_user_authid(id, authid, charsmax(authid));

    if(!g_crosshair_type[id]) {
        if(nvault_get(g_vault, fmt("%s_type", authid))) {
            nvault_remove(g_vault, fmt("%s_type", authid));
            nvault_remove(g_vault, fmt("%s_authid", authid));
        }
        return;
    }

    new data[MAX_AUTHID_LENGTH+10];

    num_to_str(g_crosshair_type[id], data, charsmax(data));
    nvault_pset(g_vault, fmt("%s_type", authid), data);

    num_to_str(g_crosshair_color[id], data, charsmax(data));
    nvault_pset(g_vault, fmt("%s_color", authid), data);
}
#endif


+ARUKARI- 12-08-2022 00:36

Re: Please, Can you Fix the Red Crosshair?
 
It seems that Version 1.2.5 was released 2 years ago.
Why don't you give it a try?

https://github.com/AoiKagase/Amxx-CrosshairMenu

sanimare 12-08-2022 12:26

Re: Please, Can you Fix the Red Crosshair?
 
Crosshair Menu 1.2.5

Code:
#pragma semicolon 1 #include <amxmodx> /* If you want players to save the crosshair they chose, define NVAULT_SAVE. It will use nvault.inc */ #define NVAULT_SAVE #define PLUGIN_NAME     "Crosshair Menu" #define PLUGIN_VERS     "1.2.5" #define PLUGIN_AUTH     "KriTo & PurposeLess" new const crosshairs[][][] = {     {"Lined Point","LinedPoint_R","LinedPoint_Y","LinedPoint_G","LinedPoint_P","LinedPoint_C"},     {"Cross","Cross_R","Cross_Y","Cross_G","Cross_P","Cross_C"},     {"Cross-2","Cross2_R","Cross2_Y","Cross2_G","Cross2_P","Cross2_C"},     {"Point","Point_R","Point_Y","Point_G","Point_P","Point_C"},     {"Square","Square_R","Square_Y","Square_G","Square_P","Square_C"},     {"Square-2","Square2_R","Square2_Y","Square2_G","Square2_P","Square2_C"},     {"Cool Cross","CoolCross_R","CoolCross_Y","CoolCross_G","CoolCross_P","CoolCross_C"} }; new const colors[][] = {     "Red",     "Yellow",     "Green",     "Purple",     "Cyan" }; new     g_crosshair_type[MAX_PLAYERS + 1],     g_crosshair_color[MAX_PLAYERS + 1],     bool:g_scope[MAX_PLAYERS + 1],     g_msgids[4]; public plugin_init() {     register_plugin(PLUGIN_NAME, PLUGIN_VERS, PLUGIN_AUTH);     register_clcmd("say /crosshair", "@clcmd_crosshair");     register_clcmd("say /cross", "@clcmd_crosshair");     register_event("SetFOV", "@Event_SetFOV", "be");     register_event("CurWeapon", "@Event_CurWeapon", "be", "1=1", "2!18");     g_msgids[0] = get_user_msgid("HideWeapon");     g_msgids[1] = get_user_msgid("WeaponList");     g_msgids[2] = get_user_msgid("SetFOV");     g_msgids[3] = get_user_msgid("CurWeapon"); } @Event_SetFOV(const id) {     if(!g_crosshair_type[id]) {         return;     }     new FOV = read_data(1);     if(FOV == 90) {         g_scope[id] = false;     }     else {         g_scope[id] = true;         SetMessage_HideWeapon(id, 0);     } } public plugin_precache() {     for(new i = 0; i < sizeof(crosshairs); i++) {         for(new a = 1; a < sizeof(crosshairs[]); a++) {             precache_generic(fmt("sprites/%s.txt", crosshairs[i][a]));         }     }     precache_generic("sprites/recrosshair.spr"); } public client_putinserver(id) {     client_cmd(id, "crosshair 1"); } @clcmd_crosshair(const id) {     new menu = menu_create("\yCrosshair Menu", "@clcmd_crosshair_handler");     if(g_crosshair_type[id]) {         menu_additem(menu, fmt("Change Crosshair Type \dCurrent: %s", crosshairs[g_crosshair_type[id] - 1][0]), "1");         menu_additem(menu, fmt("Change Crosshair Color \dCurrent: %s", colors[g_crosshair_color[id]]), "2");         menu_additem(menu, "Default Crosshair", "3");     }     else {         menu_additem(menu, "Change Crosshair Type \dCurrent: Default", "1");     }     menu_display(id, menu);     return PLUGIN_HANDLED; } @clcmd_crosshair_handler(const id, const menu, const item) {     if(item == MENU_EXIT) {         menu_destroy(menu);         return PLUGIN_HANDLED;     }     new data[6];     menu_item_getinfo(menu, item, _, data, charsmax(data));     new key = str_to_num(data), weapon = get_user_weapon(id);     switch(key) {         case 1: {             g_crosshair_type[id] = Calc(g_crosshair_type[id] + 1, sizeof(crosshairs), 1);             Change_Crosshair(id, weapon);         }         case 2: {             g_crosshair_color[id] = Calc(g_crosshair_color[id] + 1, sizeof(colors) - 1, 0);             Change_Crosshair(id, weapon);         }         case 3: {             SetMessage_HideWeapon(id, 0);             g_crosshair_type[id] = 0;         }     }     @clcmd_crosshair(id);     return PLUGIN_HANDLED; } Calc(const arg, const max, const min) {     return (arg > max) ? min : arg; } @Event_CurWeapon(const id) {     if(!g_crosshair_type[id] || g_scope[id]) {         return;     }     new weapon = read_data(2);     Change_Crosshair(id, weapon); } Change_Crosshair(const id, const weapon) {     switch(weapon) {         case CSW_P228: SetMessage_WeaponList(id, 9, 52);         case CSW_HEGRENADE: SetMessage_WeaponList(id, 12, 1);         case CSW_XM1014: SetMessage_WeaponList(id, 5, 32);         case CSW_C4: SetMessage_WeaponList(id, 14, 1);         case CSW_MAC10: SetMessage_WeaponList(id, 6, 100);         case CSW_AUG: SetMessage_WeaponList(id, 4, 90);         case CSW_SMOKEGRENADE: SetMessage_WeaponList(id, 13, 1);         case CSW_ELITE: SetMessage_WeaponList(id, 10, 120);         case CSW_FIVESEVEN: SetMessage_WeaponList(id, 7, 100);         case CSW_UMP45: SetMessage_WeaponList(id, 6, 100);         case CSW_GALIL: SetMessage_WeaponList(id, 4, 90);         case CSW_FAMAS: SetMessage_WeaponList(id, 4, 90);         case CSW_USP: SetMessage_WeaponList(id, 6, 100);         case CSW_GLOCK18: SetMessage_WeaponList(id, 10, 120);         case CSW_MP5NAVY: SetMessage_WeaponList(id, 10, 120);         case CSW_M249: SetMessage_WeaponList(id, 3, 200);         case CSW_M3: SetMessage_WeaponList(id, 5, 32);         case CSW_M4A1: SetMessage_WeaponList(id, 4, 90);         case CSW_TMP: SetMessage_WeaponList(id, 10, 120);         case CSW_FLASHBANG: SetMessage_WeaponList(id, 11, 2);         case CSW_DEAGLE: SetMessage_WeaponList(id, 8, 35);         case CSW_SG552: SetMessage_WeaponList(id, 4, 90);         case CSW_AK47: SetMessage_WeaponList(id, 2, 90);         case CSW_KNIFE: SetMessage_WeaponList(id, -1, -1);         case CSW_P90: SetMessage_WeaponList(id, 7, 100);         default: return;     }     SetMessage_HideWeapon(id, 1<<6);     SetMessage_SetFOV(id, 89);     SetMessage_CurWeapon(id);     SetMessage_SetFOV(id, 90); } SetMessage_WeaponList(const id, const pAmmoId, const pAmmoMaxAmount) {     message_begin(MSG_ONE, g_msgids[1], .player = id); {         write_string(crosshairs[g_crosshair_type[id] - 1][g_crosshair_color[id] + 1]);         write_byte(pAmmoId);         write_byte(pAmmoMaxAmount);         write_byte(-1);         write_byte(-1);         write_byte(0);         write_byte(11);         write_byte(2);         write_byte(0);     }     message_end(); } SetMessage_SetFOV(const id, const FOV) {     message_begin(MSG_ONE, g_msgids[2], .player = id); {         write_byte(FOV);     }     message_end(); } SetMessage_CurWeapon(const id) {     new ammo;     get_user_weapon(id, ammo);     message_begin(MSG_ONE, g_msgids[3], .player = id); {         write_byte(1);         write_byte(2);         write_byte(ammo);     }     message_end(); } SetMessage_HideWeapon(const id, const byte) {     message_begin(MSG_ONE, g_msgids[0], .player = id); {         write_byte(byte);     }     message_end(); } #if defined NVAULT_SAVE #include <nvault> new g_vault; public plugin_cfg() {     g_vault = nvault_open("crosshairvault");     if(g_vault == INVALID_HANDLE) {         set_fail_state("Unknown nvault for crosshair");     } } public plugin_end() {     nvault_close(g_vault); } public client_authorized(id, const authid[]) {     g_crosshair_type[id] = nvault_get(g_vault, fmt("%s_type", authid));     g_crosshair_color[id] = nvault_get(g_vault, fmt("%s_color", authid)); } public client_disconnected(id) {     new authid[MAX_AUTHID_LENGTH];     get_user_authid(id, authid, charsmax(authid));     if(!g_crosshair_type[id]) {         if(nvault_get(g_vault, fmt("%s_type", authid))) {             nvault_remove(g_vault, fmt("%s_type", authid));             nvault_remove(g_vault, fmt("%s_authid", authid));         }         return;     }     new data[MAX_AUTHID_LENGTH+10];     num_to_str(g_crosshair_type[id], data, charsmax(data));     nvault_pset(g_vault, fmt("%s_type", authid), data);     num_to_str(g_crosshair_color[id], data, charsmax(data));     nvault_pset(g_vault, fmt("%s_color", authid), data); } #endif

Ark_Procession 12-08-2022 16:38

Re: Please, Can you Fix the Red Crosshair?
 
Quote:

Originally Posted by +ARUKARI- (Post 2794722)
It seems that Version 1.2.5 was released 2 years ago.
Why don't you give it a try?

https://github.com/AoiKagase/Amxx-CrosshairMenu

Hello, i did not know it was your plugin, are you still maintaining it?
Seems to work, i hope it doesnt crash, so far so good. (the version i was using crashed the sv)

The zoom from bullpup or krieg are still with default crosshair, can it be changed?

Btw, maybe is the same scenario like with this request, since this is heavy related with weapon spread, is there any plugin you know that controls spread?
i am using one for RECOIL, but for example, spread is reduced but not to 0, or shooting with snipers without crosshair bullets dont go to center of screen.

Ark_Procession 12-08-2022 16:39

Re: Please, Can you Fix the Red Crosshair?
 
Quote:

Originally Posted by sanimare (Post 2794771)
Crosshair Menu 1.2.5

Code:
#pragma semicolon 1 #include <amxmodx> /* If you want players to save the crosshair they chose, define NVAULT_SAVE. It will use nvault.inc */ #define NVAULT_SAVE #define PLUGIN_NAME     "Crosshair Menu" #define PLUGIN_VERS     "1.2.5" #define PLUGIN_AUTH     "KriTo & PurposeLess" new const crosshairs[][][] = {     {"Lined Point","LinedPoint_R","LinedPoint_Y","LinedPoint_G","LinedPoint_P","LinedPoint_C"},     {"Cross","Cross_R","Cross_Y","Cross_G","Cross_P","Cross_C"},     {"Cross-2","Cross2_R","Cross2_Y","Cross2_G","Cross2_P","Cross2_C"},     {"Point","Point_R","Point_Y","Point_G","Point_P","Point_C"},     {"Square","Square_R","Square_Y","Square_G","Square_P","Square_C"},     {"Square-2","Square2_R","Square2_Y","Square2_G","Square2_P","Square2_C"},     {"Cool Cross","CoolCross_R","CoolCross_Y","CoolCross_G","CoolCross_P","CoolCross_C"} }; new const colors[][] = {     "Red",     "Yellow",     "Green",     "Purple",     "Cyan" }; new     g_crosshair_type[MAX_PLAYERS + 1],     g_crosshair_color[MAX_PLAYERS + 1],     bool:g_scope[MAX_PLAYERS + 1],     g_msgids[4]; public plugin_init() {     register_plugin(PLUGIN_NAME, PLUGIN_VERS, PLUGIN_AUTH);     register_clcmd("say /crosshair", "@clcmd_crosshair");     register_clcmd("say /cross", "@clcmd_crosshair");     register_event("SetFOV", "@Event_SetFOV", "be");     register_event("CurWeapon", "@Event_CurWeapon", "be", "1=1", "2!18");     g_msgids[0] = get_user_msgid("HideWeapon");     g_msgids[1] = get_user_msgid("WeaponList");     g_msgids[2] = get_user_msgid("SetFOV");     g_msgids[3] = get_user_msgid("CurWeapon"); } @Event_SetFOV(const id) {     if(!g_crosshair_type[id]) {         return;     }     new FOV = read_data(1);     if(FOV == 90) {         g_scope[id] = false;     }     else {         g_scope[id] = true;         SetMessage_HideWeapon(id, 0);     } } public plugin_precache() {     for(new i = 0; i < sizeof(crosshairs); i++) {         for(new a = 1; a < sizeof(crosshairs[]); a++) {             precache_generic(fmt("sprites/%s.txt", crosshairs[i][a]));         }     }     precache_generic("sprites/recrosshair.spr"); } public client_putinserver(id) {     client_cmd(id, "crosshair 1"); } @clcmd_crosshair(const id) {     new menu = menu_create("\yCrosshair Menu", "@clcmd_crosshair_handler");     if(g_crosshair_type[id]) {         menu_additem(menu, fmt("Change Crosshair Type \dCurrent: %s", crosshairs[g_crosshair_type[id] - 1][0]), "1");         menu_additem(menu, fmt("Change Crosshair Color \dCurrent: %s", colors[g_crosshair_color[id]]), "2");         menu_additem(menu, "Default Crosshair", "3");     }     else {         menu_additem(menu, "Change Crosshair Type \dCurrent: Default", "1");     }     menu_display(id, menu);     return PLUGIN_HANDLED; } @clcmd_crosshair_handler(const id, const menu, const item) {     if(item == MENU_EXIT) {         menu_destroy(menu);         return PLUGIN_HANDLED;     }     new data[6];     menu_item_getinfo(menu, item, _, data, charsmax(data));     new key = str_to_num(data), weapon = get_user_weapon(id);     switch(key) {         case 1: {             g_crosshair_type[id] = Calc(g_crosshair_type[id] + 1, sizeof(crosshairs), 1);             Change_Crosshair(id, weapon);         }         case 2: {             g_crosshair_color[id] = Calc(g_crosshair_color[id] + 1, sizeof(colors) - 1, 0);             Change_Crosshair(id, weapon);         }         case 3: {             SetMessage_HideWeapon(id, 0);             g_crosshair_type[id] = 0;         }     }     @clcmd_crosshair(id);     return PLUGIN_HANDLED; } Calc(const arg, const max, const min) {     return (arg > max) ? min : arg; } @Event_CurWeapon(const id) {     if(!g_crosshair_type[id] || g_scope[id]) {         return;     }     new weapon = read_data(2);     Change_Crosshair(id, weapon); } Change_Crosshair(const id, const weapon) {     switch(weapon) {         case CSW_P228: SetMessage_WeaponList(id, 9, 52);         case CSW_HEGRENADE: SetMessage_WeaponList(id, 12, 1);         case CSW_XM1014: SetMessage_WeaponList(id, 5, 32);         case CSW_C4: SetMessage_WeaponList(id, 14, 1);         case CSW_MAC10: SetMessage_WeaponList(id, 6, 100);         case CSW_AUG: SetMessage_WeaponList(id, 4, 90);         case CSW_SMOKEGRENADE: SetMessage_WeaponList(id, 13, 1);         case CSW_ELITE: SetMessage_WeaponList(id, 10, 120);         case CSW_FIVESEVEN: SetMessage_WeaponList(id, 7, 100);         case CSW_UMP45: SetMessage_WeaponList(id, 6, 100);         case CSW_GALIL: SetMessage_WeaponList(id, 4, 90);         case CSW_FAMAS: SetMessage_WeaponList(id, 4, 90);         case CSW_USP: SetMessage_WeaponList(id, 6, 100);         case CSW_GLOCK18: SetMessage_WeaponList(id, 10, 120);         case CSW_MP5NAVY: SetMessage_WeaponList(id, 10, 120);         case CSW_M249: SetMessage_WeaponList(id, 3, 200);         case CSW_M3: SetMessage_WeaponList(id, 5, 32);         case CSW_M4A1: SetMessage_WeaponList(id, 4, 90);         case CSW_TMP: SetMessage_WeaponList(id, 10, 120);         case CSW_FLASHBANG: SetMessage_WeaponList(id, 11, 2);         case CSW_DEAGLE: SetMessage_WeaponList(id, 8, 35);         case CSW_SG552: SetMessage_WeaponList(id, 4, 90);         case CSW_AK47: SetMessage_WeaponList(id, 2, 90);         case CSW_KNIFE: SetMessage_WeaponList(id, -1, -1);         case CSW_P90: SetMessage_WeaponList(id, 7, 100);         default: return;     }     SetMessage_HideWeapon(id, 1<<6);     SetMessage_SetFOV(id, 89);     SetMessage_CurWeapon(id);     SetMessage_SetFOV(id, 90); } SetMessage_WeaponList(const id, const pAmmoId, const pAmmoMaxAmount) {     message_begin(MSG_ONE, g_msgids[1], .player = id); {         write_string(crosshairs[g_crosshair_type[id] - 1][g_crosshair_color[id] + 1]);         write_byte(pAmmoId);         write_byte(pAmmoMaxAmount);         write_byte(-1);         write_byte(-1);         write_byte(0);         write_byte(11);         write_byte(2);         write_byte(0);     }     message_end(); } SetMessage_SetFOV(const id, const FOV) {     message_begin(MSG_ONE, g_msgids[2], .player = id); {         write_byte(FOV);     }     message_end(); } SetMessage_CurWeapon(const id) {     new ammo;     get_user_weapon(id, ammo);     message_begin(MSG_ONE, g_msgids[3], .player = id); {         write_byte(1);         write_byte(2);         write_byte(ammo);     }     message_end(); } SetMessage_HideWeapon(const id, const byte) {     message_begin(MSG_ONE, g_msgids[0], .player = id); {         write_byte(byte);     }     message_end(); } #if defined NVAULT_SAVE #include <nvault> new g_vault; public plugin_cfg() {     g_vault = nvault_open("crosshairvault");     if(g_vault == INVALID_HANDLE) {         set_fail_state("Unknown nvault for crosshair");     } } public plugin_end() {     nvault_close(g_vault); } public client_authorized(id, const authid[]) {     g_crosshair_type[id] = nvault_get(g_vault, fmt("%s_type", authid));     g_crosshair_color[id] = nvault_get(g_vault, fmt("%s_color", authid)); } public client_disconnected(id) {     new authid[MAX_AUTHID_LENGTH];     get_user_authid(id, authid, charsmax(authid));     if(!g_crosshair_type[id]) {         if(nvault_get(g_vault, fmt("%s_type", authid))) {             nvault_remove(g_vault, fmt("%s_type", authid));             nvault_remove(g_vault, fmt("%s_authid", authid));         }         return;     }     new data[MAX_AUTHID_LENGTH+10];     num_to_str(g_crosshair_type[id], data, charsmax(data));     nvault_pset(g_vault, fmt("%s_type", authid), data);     num_to_str(g_crosshair_color[id], data, charsmax(data));     nvault_pset(g_vault, fmt("%s_color", authid), data); } #endif

Thank you! seems that Arukari posted the same version :)

+ARUKARI- 12-08-2022 23:10

Re: Please, Can you Fix the Red Crosshair?
 
Quote:

Hello, i did not know it was your plugin, are you still maintaining it?
No, it's not mine, I just Forked it.
It is something that has not been maintained for a long time and will be modified like ReviveKit if necessary.

Quote:

The zoom from bullpup or krieg are still with default crosshair, can it be changed?

Btw, maybe is the same scenario like with this request, since this is heavy related with weapon spread, is there any plugin you know that controls spread?
i am using one for RECOIL, but for example, spread is reduced but not to 0, or shooting with snipers without crosshair bullets dont go to center of screen.
The spread of Crosshair is completely client-side processing, so it is almost impossible to control it on the server side.
It can be replaced with a fixed sprite, as in this plug-in, but this is more difficult for custom weapons, as the settings increase each time they are used.

Ark_Procession 12-09-2022 00:34

Re: Please, Can you Fix the Red Crosshair?
 
Quote:

Originally Posted by +ARUKARI- (Post 2794810)
No, it's not mine, I just Forked it.
It is something that has not been maintained for a long time and will be modified like ReviveKit if necessary.


The spread of Crosshair is completely client-side processing, so it is almost impossible to control it on the server side.
It can be replaced with a fixed sprite, as in this plug-in, but this is more difficult for custom weapons, as the settings increase each time they are used.

i understand.

Some time ago, a scripter posted a plugin called aim realism, but ultimately it crashed my server no matter how many times he fixed the plugin.

Now, i don't know if it crashed because of the way he coded it, or because the mechanics were unstable.

But certainly i know it is possible to change the recoil spread, i was not talking about the crosshair resize.

Basically , make awp and scout shoot straight to the center of the camera, or cancel the spread of bullets somehow.

I use a no recoil plugin but is not enough.


All times are GMT -4. The time now is 10:32.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.