The Menu appears, but if I hit 1, 2, 3, 4, 5, 6 or 0 it disappears and nothing happens.
Code:
#include <amxmodx>
#include <engine>
#include <fun>
#define VERSION "1.0"
new Float:origin[99][3]
new bool:been_before_a[33]
new bool:been_before_b[33]
new bool:been_before_c[33]
new bool:wait_three[33]
public plugin_init()
{
register_plugin("Teleportation Device",VERSION,"Silencer")
register_menucmd(register_menuid("Teleportation Device"),(1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<9),"TDTeleChoice")
register_concmd("telemenu","TDTele",0,"- Open the Teleportation Device menu")
register_cvar("amx_teleportation_device","1",FCVAR_SERVER)
}
public plugin_precache()
{
precache_sound("ambience/loader_hydra1.wav")
precache_sound("ambience/particle_suck1.wav")
}
public client_disconnect(id)
{
been_before_a[id]=false
been_before_b[id]=false
been_before_c[id]=false
wait_three[id]=false
origin[id][0]=0.0
origin[id][1]=0.0
origin[id][2]=0.0
origin[id+33][0]=0.0
origin[id+33][1]=0.0
origin[id+33][2]=0.0
origin[id+66][0]=0.0
origin[id+66][1]=0.0
origin[id+66][2]=0.0
}
public TDInformation(id)
{
if(get_cvar_num("amx_teleportation_device")>=1)
{
if(is_user_connected(id))
{
new name[32]
get_user_name(id,name,31)
client_print(id,print_chat,"[TD] Hello, %s. Teleportation Device is enabled - Bind a Key to ^"telemenu^".",name)
}
}
}
public client_putinserver(id)
{
set_task(5.0,"TDInformation",id)
}
public TDUnWait(id)
{
wait_three[id]=false
}
public TDWait(id)
{
wait_three[id]=true
set_task(3.0,"TDUnWait",id)
}
public TDTele(id)
{
if(get_cvar_num("amx_teleportation_device")>=1)
{
new menuBody[1024]
format(menuBody,1023,"Teleporation Device^n^n^n^n^n1. Teleport to Destination A^n^n2. Teleport to Destination B^n^n3. Teleport to Destination C^n^n^n4. Save to Destination A^n^n5. Save to Destination B^n^n6. Save to Destination C^n^n^n^n0. Cancel")
show_menu(id,(1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<9),menuBody)
}
else
{
client_print(id,print_chat,"[TD] Teleportation Device is currently disabled.")
}
}
public TDTeleChoice(id,key)
{
switch(key)
{
case 0:
{
if(wait_three[id])
{
client_print(id,print_chat,"[TD] The Teleportation Device has a decay time of 3 seconds between every action. Please wait.")
}
else
{
if(get_cvar_num("amx_teleportation_device")>=1)
{
if(been_before_a[id])
{
if(is_user_alive(id))
{
entity_set_origin(id,origin[id])
client_print(id,print_chat,"[TD] You were teleported to destination saved to Slot A.")
emit_sound(id,4,"ambience/particle_suck1.wav",0.9,0.8,0,109)
TDWait(id)
}
else
{
client_print(id,print_chat,"[TD] Dead people lie on the ground. They do not use their Teleportation Device, for example...")
}
}
else
{
client_print(id,print_chat,"[TD] You do not have saved a destination to Slot A on this connection, yet.")
}
}
else
{
client_print(id,print_chat,"[TD] Teleportation Device is currently disabled.")
}
}
}
case 1:
{
if(wait_three[id])
{
client_print(id,print_chat,"[TD] The Teleportation Device has a decay time of 3 seconds between every action. Please wait.")
}
else
{
if(get_cvar_num("amx_teleportation_device")>=1)
{
if(been_before_b[id])
{
if(is_user_alive(id))
{
entity_set_origin(id,origin[id+33])
client_print(id,print_chat,"[TD] You were teleported to destination saved to Slot B.")
emit_sound(id,4,"ambience/particle_suck1.wav",0.9,0.8,0,109)
TDWait(id)
}
else
{
client_print(id,print_chat,"[TD] Dead people lie on the ground. They do not use their Teleportation Device, for example...")
}
}
else
{
client_print(id,print_chat,"[TD] You do not have saved a destination to Slot B on this connection, yet.")
}
}
else
{
client_print(id,print_chat,"[TD] Teleportation Device is currently disabled.")
}
}
}
case 2:
{
if(wait_three[id])
{
client_print(id,print_chat,"[TD] The Teleportation Device has a decay time of 3 seconds between every action. Please wait.")
}
else
{
if(get_cvar_num("amx_teleportation_device")>=1)
{
if(been_before_c[id])
{
if(is_user_alive(id))
{
entity_set_origin(id,origin[id+66])
client_print(id,print_chat,"[TD] You were teleported to destination saved to Slot C.")
emit_sound(id,4,"ambience/particle_suck1.wav",0.9,0.8,0,109)
TDWait(id)
}
else
{
client_print(id,print_chat,"[TD] Dead people lie on the ground. They do not use their Teleportation Device, for example...")
}
}
else
{
client_print(id,print_chat,"[TD] You do not have saved a destination to Slot C on this connection, yet.")
}
}
else
{
client_print(id,print_chat,"[TD] Teleportation Device is currently disabled.")
}
}
}
case 3:
{
if(wait_three[id])
{
client_print(id,print_chat,"[TD] The Teleportation Device has a decay time of 3 seconds between every action. Please wait.")
}
else
{
if(get_cvar_num("amx_teleportation_device")>=1)
{
if(is_user_alive(id))
{
if(get_user_button(id)&IN_DUCK)
{
client_print(id,print_chat,"[TD] Saving location while ducking is permitted.")
}
else
{
if(!been_before_a[id])
{
been_before_a[id]=true
}
entity_get_vector(id,EV_VEC_origin,origin[id])
client_print(id,print_chat,"[TD] Your current Location was saved to Slot A.")
emit_sound(id,4,"ambience/loader_hydra1.wav",0.7,0.8,0,100)
TDWait(id)
}
}
else
{
client_print(id,print_chat,"[TD] Dead people lie on the ground. They do not use their Teleportation Device, for example...")
}
}
else
{
client_print(id,print_chat,"[TD] Teleportation Device is currently disabled.")
}
}
}
case 4:
{
if(wait_three[id])
{
client_print(id,print_chat,"[TD] The Teleportation Device has a decay time of 3 seconds between every action. Please wait.")
}
else
{
if(get_cvar_num("amx_teleportation_device")>=1)
{
if(is_user_alive(id))
{
if(get_user_button(id)&IN_DUCK)
{
client_print(id,print_chat,"[TD] Saving location while ducking is permitted.")
}
else
{
if(!been_before_b[id])
{
been_before_b[id]=true
}
entity_get_vector(id,EV_VEC_origin,origin[id+33])
client_print(id,print_chat,"[TD] Your current Location was saved to Slot B.")
emit_sound(id,4,"ambience/loader_hydra1.wav",0.7,0.8,0,100)
TDWait(id)
}
}
else
{
client_print(id,print_chat,"[TD] Dead people lie on the ground. They do not use their Teleportation Device, for example...")
}
}
else
{
client_print(id,print_chat,"[TD] Teleportation Device is currently disabled.")
}
}
}
case 5:
{
if(wait_three[id])
{
client_print(id,print_chat,"[TD] The Teleportation Device has a decay time of 3 seconds between every action. Please wait.")
}
else
{
if(get_cvar_num("amx_teleportation_device")>=1)
{
if(is_user_alive(id))
{
if(get_user_button(id)&IN_DUCK)
{
client_print(id,print_chat,"[TD] Saving location while ducking is permitted.")
}
else
{
if(!been_before_c[id])
{
been_before_c[id]=true
}
entity_get_vector(id,EV_VEC_origin,origin[id+66])
client_print(id,print_chat,"[TD] Your current Location was saved to Slot C.")
emit_sound(id,4,"ambience/loader_hydra1.wav",0.7,0.8,0,100)
TDWait(id)
}
}
else
{
client_print(id,print_chat,"[TD] Dead people lie on the ground. They do not use their Teleportation Device, for example...")
}
}
else
{
client_print(id,print_chat,"[TD] Teleportation Device is currently disabled.")
}
}
}
case 9:
{
// Do nothing = Close Menu
}
}
return PLUGIN_HANDLED
}