Make a global variable like:
PHP Code:
new user_crosshair_type[33]
Then change this:
PHP Code:
menu_additem(menu, "Cross +", "1", 0)
menu_additem(menu, "Dot *", "2", 0)
menu_additem(menu, "Round o", "3", 0)
To this:
PHP Code:
menu_additem(menu, "Cross +", "43", 0) // actually this 0 is set by default, you don't need to write it
menu_additem(menu, "Dot *", "42", 0)
menu_additem(menu, "Round o", "111", 0)
Then change this:
PHP Code:
switch(str_to_num(data))
{
case 1: register_concmd(cross,"cross_crosshair")
case 2: register_concmd(cross,"dot_crosshair")
case 3: register_concmd(cross,"round_crosshair")
// Add more Options if you wish
}
To this:
PHP Code:
user_crosshair_type[id] = str_to_num(data)
Then change this:
PHP Code:
set_hudmessage(0, 255, 0, -1.0, -1.0, .holdtime = 1.0) // skip default values
ShowSyncHudMsg(id,sync, "o") // show crosshair HUD
To this
PHP Code:
set_hudmessage(0, 255, 0, -1.0, -1.0, .holdtime = 1.0) // skip default values
ShowSyncHudMsg(id,sync, "%c",user_crosshair_type[id]) // show crosshair HUD
And add:
PHP Code:
public client_connect(id) user_crosshair_type[id] = 111 // default crosshair is "o"
So here is how does it works:
We set the "info" of the crosshair menu options as numbers 43, 42, 111. These numbers are actually character indexes that represent a character. In our case these are the indexes of the crosshair HUD characters - "+", "*" and "o".
When we select an option, the menu passes the "info" parameter of menu_additem to the "data" string in the menu handler. So, now we can set the selected character to the "user_crosshair_type" variable to store the user HUD crosshair character.
Then when we display the HUD message, we use "%c", which gets a character index and transfers it to a character. We get that index from our user_crosshair_type variable, so every player will see his own selected HUD crosshair.
On client connect we set the default HUD character for the player - that's 111 or the "o" character.
Here I made a simple program that displays the character ID by given character.
I also attached the source code (compiled with DEV C++), ready to use .exe file is in the bin folder. (That's not a virus, lol)