Hey All. I decided it was time to sit down to right a menu, so you can change Alliances and Occupation ("Races" and "Classes") in the mod i'm working on. I cannot get the menu to work though. I can see it, it looks fine; it just doesn't
DO anything. Not sure what's wrong, I've looked at a few examples and it looks ok to me.
Code:
//regsiter menu in plugin_init
register_menucmd(register_menuid("Select an Alliance"), 1023, "SetAlliance")
register_clcmd("AllianceMenu", "ShowAllianceMenu")
//menu vars in the vars.inc file
new Menu[1024]
new MKeys3 = (1<<0|1<<1|1<<2|1<<9)
//show the menu in the menus.inc file
public ShowAllianceMenu(id)
{
format(Menu, 1023, "Select Alliance:^n^n1. Zionists^n2. Machines^n3. Exiles^n^n0. Cancel")
show_menu(id, MKeys3, Menu)
return PLUGIN_HANDLED
}
//handle the menu events in the menus.inc file
//allow user to set alliance
public SetAlliance(id, key)
{
//Debug
client_print(0, print_chat, "Applying Menu Code!")
//display current alliance to user
new CurrentAlliance[8]
if(PlayerAlliance[id] == 0)
format(CurrentAlliance, 8, "Bluepill")
if(PlayerAlliance[id] == 1)
format(CurrentAlliance, 8, "Zionists")
if(PlayerAlliance[id] == 2)
format(CurrentAlliance, 8, "Machines")
if(PlayerAlliance[id] == 0)
format(CurrentAlliance, 8, "Exiles")
//Debug
client_print (id, print_chat, "You are currently allied with the %s", CurrentAlliance)
//key will start at zero
if (key == 0)
{
return PLUGIN_HANDLED
} else if (key == 1) {
PlayerAlliance[id] = 1
client_print(id, print_chat, "You will now train for the Zionists!")
} else if (key == 2) {
PlayerAlliance[id] = 2
client_print(id, print_chat, "You will now train for the Machines!")
} else if (key == 3) {
PlayerAlliance[id] = 3
client_print(id, print_chat, "You will now train for the Exiles!")
}
SaveAlliance(id)
return PLUGIN_HANDLED
}
Now, when I type AllianceMenu in the console, the menu comes up. I hit a key and it goes away, but I don't see any of the debug messages. Also, I created a GetAlliance procedure that tells me a user's alliance. By this check, the alliancevar for that player is never changed.
Also, I want this menu to show when a new player logs in for the fisrt time. I added a call to the procedure (ShowAllianceMenu(id)), but it doesn't show when I delete my vault.ini file and log in. Also, I don't see any of the debug messages there. I think it's because the code is run
BEFORE you get
into the server. Is there a way to catch an event for say, when they join a team?
If somebody could answer all that i'd be really grateful

Thanx
__________________
"What then is truth? Truths are illusions which we have forgotten are illusions - they are metaphors that have become worn out... this (truth) is the duty to lie according to a fixed convention.
-Friedrich Nietzsche