i have one menu script and i have other code i wanna mixed the codes and change cvar's "0/1/2 with my menu
code :
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <cstrike>
new time_revive, revive_e, revive_say
public plugin_init()
{
//
time_revive = register_cvar("amx_time_revive", "2")
revive_e = register_cvar("amx_auto_revive", "1")
revive_say = register_cvar("amx_say_revive", "1")
// Event Player Killed
RegisterHam(Ham_Killed, "player", "Player_Killed", 1)
// Command to Respawn
register_clcmd("say /respawn", "RespawnSay")
register_clcmd("say_team /respawn", "RespawnSay")
register_clcmd("say /revive", "RespawnSay")
register_clcmd("say_team /revive", "RespawnSay")
register_clcmd("say /rv", "RespawnSay")
register_clcmd("say_team /rv", "RespawnSay")
register_concmd("davidarea871", "respawnon")
register_concmd("davidarea87", "respawnoff")
}
public Player_Killed(id)
{
set_task(get_pcvar_float(time_revive), "RespawnNow", id)
}
public respawnoff(id)
{
client_cmd(id, "amx_auto_revive",revive_e, 0);
}
public respawnon(id)
{
client_cmd(id, "amx_auto_revive", revive_e, 1);
}
public RespawnNow(id)
{
if(get_pcvar_num(revive_e) == 1)
{
if(cs_get_user_team(id) == CS_TEAM_SPECTATOR)
{
set_hudmessage(255, 255, 255, 0.70, 0.50, 0, 6.0, 2.0, 0.1, 0.5, false)
show_hudmessage(id, "You Are Spectator !")
}
else
{
ExecuteHamB(Ham_CS_RoundRespawn, id)
set_hudmessage(255, 255, 255, 0.70, 0.50, 0, 6.0, 2.0, 0.1, 0.5, false)
show_hudmessage(id, "Respawed !")
}
}
return PLUGIN_HANDLED;
}
public RespawnSay(id)
{
if(get_pcvar_num(revive_say) == 1)
{
if(cs_get_user_team(id) == CS_TEAM_SPECTATOR)
{
set_hudmessage(255, 255, 255, 0.70, 0.50, 0, 6.0, 2.0, 0.1, 0.5, false)
show_hudmessage(id, "You Are Spectator !")
}
else
{
ExecuteHamB(Ham_CS_RoundRespawn, id)
set_hudmessage(255, 255, 255, 0.70, 0.50, 0, 6.0, 2.0, 0.1, 0.5, false)
show_hudmessage(id, "Respawed !")
}
}
return PLUGIN_HANDLED;
}
code2:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <ColorChat>
#define EVENTS_ACCESS ADMIN_RCON
public plugin_init() {
register_clcmd("say /dm", "RespawnSay")
register_concmd("dm", "RespawnSay")
}
public RespawnSay(id)
{
if ( ! access1( id, EVENTS_ACCESS ) ) return client_print( id, print_chat, "You have no access to this command." );
new menu = menu_create("\w[\r#Area87\w] \yDeathMatch \wMain Menu \rby \ydvh \w(\rOnly Admins\w)", "menu_handler");
menu_additem(menu, "\wDeathmatch \w[\rON\w]", "", 0);
menu_additem(menu, "\wDeathmatch \w[\rOFF\w]", "", 0);
menu_display(id, menu, 0)
}
public menu_handler(id, menu, item)
{
if( item == MENU_EXIT )
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}
new data[6], iName[64];
new access1, callback;
new szName[32];
get_user_name(id, szName, 31)
menu_item_getinfo(menu, item, access1, data, 6, iName, 63, callback)
new key = str_to_num(data);
switch(item)
{
case 0:
{
register_concmd("davidarea871","RespawnSay");
ColorChat(0,GREEN,"[#Area87] DM is On now");
}
case 1:
{
register_concmd("davidarea87","RespawnSay");
ColorChat(0,GREEN,"[#Area87] DM is Off now");
}
}
menu_destroy(menu);
return PLUGIN_HANDLED;
}
stock access1( const index, const flag )
{
return ( get_user_flags( index ) & flag );
}
i need with this menu change the cvars to 1/2/3 [OFF/ON] the cvars:
time_revive = register_cvar("amx_time_revive", "2")
revive_e = register_cvar("amx_auto_revive", "1")
revive_say = register_cvar("amx_say_revive", "1")
someone can help me to edit this codes the menu my code i build
|