PDA

View Full Version : Simple Weapons Menu


kiarfuzzy
12-14-2016, 04:37
I'm looking a simple menu for guns equip on a csdm server. Something like this:

1. AWP + AK + Deagle + HE
2. AWP + m4a1 + Deagle + HE
3. AK + m4a1 + Deagle + HE

It should work like the default csdm menu. Display it when player joins and after the player makes his choice the menu disappears.
To reopen the menu player will have to write guns or /guns.

I found some plugins out there, but most of them have a lot of extra functions that i don't need, or doesn't really do what i need.

Relaxing
12-14-2016, 04:58
Edit them, you can do whatever you want if you do by yourself.

kiarfuzzy
12-14-2016, 07:22
Well if i knew how to do that I would... But as I said none of the plugins i found does all of the things I want and most of them have a lot of extra stuff that I wouldn't need. I want to keep it as simple as I can.

I found this one, which is fairly simple but doesn't have a menu...

#include <amxmodx>
#include <fun>
#include <cstrike>
#include <hamsandwich>

#define PLUGIN "Automatic Give Weapon In Respawn"
#define VERSION "1.0"
#define AUTHOR "[M]etrikcz"

new g_death, g_yes
new cvar_weapons_ct, cvar_weapons_tt, cvar_start, cvar_mode

new const weapon_max_bpammo[] = { -1, 52, -1, 90, 1, 32, 1, 100, 90, 1, 120, 100, 100, 90, 90, 90, 100, 120, 30, 120, 200, 32, 90, 120, 90, 2, 35, 90, 90, -1, 100 }
new const weapon_name[][] = { "", "weapon_p228", "", "weapon_scout", "weapon_hegrenade", "weapon_xm1014", "weapon_c4", "weapon_mac10",
"weapon_aug", "weapon_smokegrenade", "weapon_elite", "weapon_fiveseven", "weapon_ump45", "weapon_sg550",
"weapon_galil", "weapon_famas", "weapon_usp", "weapon_glock18", "weapon_awp", "weapon_mp5navy", "weapon_m249",
"weapon_m3", "weapon_m4a1", "weapon_tmp", "weapon_g3sg1", "weapon_flashbang", "weapon_deagle", "weapon_sg552",
"weapon_ak47", "weapon_knife", "weapon_p90" }

public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say /agw", "cmdAgw")
RegisterHam(Ham_Killed, "player", "fw_clientdeath_post", 1)
RegisterHam(Ham_Spawn, "player", "fw_playerspawn_post", 1)
cvar_start = register_cvar("AGW_start", "1") // Upon entering the server the player will automatically activate the option.
cvar_mode = register_cvar("AGW_mode", "0") // Always obtain weapons to revive?
cvar_weapons_ct = register_cvar("AGW_ct", "rvcug") // M4a1, Deagle, HE nade, FB nade, SM nade
cvar_weapons_tt = register_cvar("AGW_tt", "xvcug") // Ak47, .....
}
public client_putinserver(id) {
g_death |= (1 << (id & 31))
if(get_pcvar_num(cvar_start)) g_yes |= (1 << (id & 31))
else g_yes &= ~(1 << (id & 31))
}

public cmdAgw(id) {
if((g_yes & (1<<(id & 31)))) {
g_yes &= ~(1 << (id & 31))
client_print(id, print_chat, "Automatic Give Weapons: Desactivado.")
} else {
g_yes |= (1 << (id & 31))
client_print(id, print_chat, "Automatic Give Weapons: Activado.")
}
}

public fw_clientdeath_post(id)
g_death |= (1 << (id & 31))

public fw_playerspawn_post(id) {
if(is_user_alive(id))
set_task(0.1, "check_getweapons", id)
}

public check_getweapons(id) {
if(is_user_alive(id)) {
if(get_pcvar_num(cvar_mode) || ((g_death & (1<<(id & 31))) && (g_yes & (1<<(id & 31))))) {
g_death &= ~(1 << (id & 31))
give_weapons(id, cs_get_user_team(id))
}
}
}
give_weapons(id, CsTeams:team) {
new szflags[26], flags, num
get_pcvar_string(team == CS_TEAM_CT ? cvar_weapons_ct : cvar_weapons_tt, szflags, charsmax(szflags))

flags = read_flags(szflags)
for(new i = 0; i <= 25; i++) {
if(flags == 512 || flags & (1<<i)) { // 512 == * == ALL WEAPONS
switch(i) {
case 0: num = 1
case 1..3: num = (i+2)
case 4..13: num = (i+3)
case 14..24: num = (i+5)
case 25: num = 30
}
if(!user_has_weapon(id, num))
give_item(id, weapon_name[num])

cs_set_user_bpammo(id, num, weapon_max_bpammo[num])
}
}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang2058\\ f0\\ fs16 \n\\ par }
*/