Raised This Month: $51 Target: $400
 12% 

hey


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Magicher0ex
Member
Join Date: Dec 2019
Old 04-21-2021 , 11:27   hey
Reply With Quote #1

Hey can anyone make it only "Cross","Cross_P"
No others crosshairs

PHP 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.4"
#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_NAMEPLUGIN_VERSPLUGIN_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(id0);
    }
}

public 
plugin_precache() {
    for(new 
0sizeof(crosshairs); i++) {
        for(new 
1sizeof(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(menufmt("Change Crosshair Type \dCurrent: %s"crosshairs[g_crosshair_type[id] - 1][0]), "1");
        
menu_additem(menufmt("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(idmenu);
    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(menuitem_datacharsmax(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] + 1sizeof(crosshairs));
            
Change_Crosshair(idweapon);
        }
        case 
2: {
            
g_crosshair_color[id] = Calc(g_crosshair_color[id] + 1sizeof(colors) - 1);
            
Change_Crosshair(idweapon);
        }
        case 
3: {
            
SetMessage_HideWeapon(id0);
            
g_crosshair_type[id] = 0;
        }
    }
    @
clcmd_crosshair(id);
    return 
PLUGIN_HANDLED;
}

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

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

    new 
weapon read_data(2);
    
Change_Crosshair(idweapon);
}

Change_Crosshair(const id, const weapon) {
    switch(
weapon) {
        case 
CSW_P228SetMessage_WeaponList(id952);
        case 
CSW_HEGRENADESetMessage_WeaponList(id121);
        case 
CSW_XM1014SetMessage_WeaponList(id532);
        case 
CSW_C4SetMessage_WeaponList(id141);
        case 
CSW_MAC10SetMessage_WeaponList(id6100);
        case 
CSW_AUGSetMessage_WeaponList(id490);
        case 
CSW_SMOKEGRENADESetMessage_WeaponList(id131);
        case 
CSW_ELITESetMessage_WeaponList(id10120);
        case 
CSW_FIVESEVENSetMessage_WeaponList(id7100);
        case 
CSW_UMP45SetMessage_WeaponList(id6100);
        case 
CSW_GALILSetMessage_WeaponList(id490);
        case 
CSW_FAMASSetMessage_WeaponList(id490);
        case 
CSW_USPSetMessage_WeaponList(id6100);
        case 
CSW_GLOCK18SetMessage_WeaponList(id10120);
        case 
CSW_MP5NAVYSetMessage_WeaponList(id10120);
        case 
CSW_M249SetMessage_WeaponList(id3200);
        case 
CSW_M3SetMessage_WeaponList(id532);
        case 
CSW_M4A1SetMessage_WeaponList(id490);
        case 
CSW_TMPSetMessage_WeaponList(id10120);
        case 
CSW_FLASHBANGSetMessage_WeaponList(id112);
        case 
CSW_DEAGLESetMessage_WeaponList(id835);
        case 
CSW_SG552SetMessage_WeaponList(id490);
        case 
CSW_AK47SetMessage_WeaponList(id290);
        case 
CSW_KNIFESetMessage_WeaponList(id, -1, -1);
        case 
CSW_P90SetMessage_WeaponList(id7100);
        default: return;
    }

    
SetMessage_HideWeapon(id1<<6);
    
SetMessage_SetFOV(id89);
    
SetMessage_CurWeapon(id);
    
SetMessage_SetFOV(id90);
}

SetMessage_WeaponList(const id, const pAmmoId, const pAmmoMaxAmount) {
    
message_begin(MSG_ONEg_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_ONEg_msgids[2], .player id); {
        
write_byte(FOV);
    }
    
message_end();
}

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

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

SetMessage_HideWeapon(const id, const byte) {
    
message_begin(MSG_ONEg_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_vaultfmt("%s_type"authid));
    
g_crosshair_color[id] = nvault_get(g_vaultfmt("%s_color"authid));
}

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

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

    new 
data[MAX_AUTHID_LENGTH+10];

    
num_to_str(g_crosshair_type[id], datacharsmax(data));
    
nvault_pset(g_vaultfmt("%s_type"authid), data);

    
num_to_str(g_crosshair_color[id], datacharsmax(data));
    
nvault_pset(g_vaultfmt("%s_color"authid), data);
}
#endif 
Magicher0ex is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:20.


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