|
Senior Member
Join Date: Oct 2006
Location: The internet
|

08-21-2009
, 06:07
Re: return ?
|
#1
|
PHP Code:
#include <amxmodx> #include <amxmisc> #include <fakemeta> #include <hamsandwich>
#define MAX_PLAYERS 32
new iconstatus, pcv_iloc new user_icons[MAX_PLAYERS+1][16] new g_RadioTimer[33] new the_flash new weapon_list[24]= { CSW_P228, CSW_SCOUT, CSW_XM1014, CSW_MAC10, CSW_AUG, CSW_ELITE, CSW_FIVESEVEN, CSW_UMP45, CSW_SG550, CSW_GALIL, CSW_FAMAS, CSW_USP, CSW_GLOCK18, CSW_AWP, CSW_MP5NAVY, CSW_M249, CSW_M3, CSW_M4A1, CSW_TMP, CSW_G3SG1, CSW_DEAGLE, CSW_SG552, CSW_AK47, CSW_P90 } public plugin_init() { register_plugin("Reload sounds", "1.0", "One") register_forward(FM_PlayerPreThink, "preThink") register_event("AmmoX", "draw_icon", "be") register_event("DeathMsg", "event_death", "a") register_event("CurWeapon" , "Cureweapon" , "be" , "1=1" ); pcv_iloc = register_cvar("amx_weapon_location", "1") check_icon_loc() } public Cureweapon(id) { /*remove_weapon_icon(id) check_icon_loc() if( get_pcvar_num(pcv_iloc) == 0 || is_user_bot(id) ) return static sprite[16], iwpn, clip, ammo
iwpn = get_user_weapon(id, clip, ammo) switch(iwpn) { case CSW_P228: sprite = "d_p228" case CSW_SCOUT: sprite = "d_scout" case CSW_HEGRENADE: sprite = "d_grenade" case CSW_XM1014: sprite = "d_xm1014" case CSW_MAC10: sprite = "d_mac10" case CSW_AUG: sprite = "d_aug" case CSW_SMOKEGRENADE: sprite = "d_flashbang" case CSW_ELITE: sprite = "d_elite" case CSW_FIVESEVEN: sprite = "d_fiveseven" case CSW_UMP45: sprite = "d_ump45" case CSW_SG550: sprite = "d_sg550" case CSW_GALIL: sprite = "d_galil" case CSW_FAMAS: sprite = "d_famas" case CSW_USP: sprite = "d_usp" case CSW_MP5NAVY: sprite = "d_mp5navy" case CSW_M249: sprite = "d_m249" case CSW_M3: sprite = "d_m3" case CSW_M4A1: sprite = "d_m4a1" case CSW_TMP: sprite = "d_tmp" case CSW_G3SG1: sprite = "d_g3sg1" case CSW_FLASHBANG: sprite = "d_flashbang" case CSW_DEAGLE: sprite = "d_deagle" case CSW_SG552: sprite = "d_sg552" case CSW_AK47: sprite = "d_ak47" case CSW_KNIFE: sprite = "d_knife" case CSW_P90: sprite = "d_p90" case CSW_GLOCK18: sprite = "d_glock18" case CSW_AWP: sprite = "d_awp" default: return } user_icons[id] = sprite draw_icon(id) return*/ } public draw_icon(id) { static iwpn, clip, ammo, icon_color[3] iwpn = get_user_weapon(id, clip, ammo) if ((ammo == 0 && clip == 0)) icon_color = {255, 0, 0} else if ( ammo==0 && iwpn!=CSW_KNIFE) icon_color = {255, 160, 0} else icon_color = {0, 160, 0} message_begin(MSG_ONE,iconstatus,{0,0,0},id) write_byte(the_flash) write_string(user_icons[id]) write_byte(icon_color[0]) write_byte(icon_color[1]) write_byte(icon_color[2]) message_end() } public remove_weapon_icon(id) { message_begin(MSG_ONE,iconstatus,{0,0,0},id) write_byte(0) write_string(user_icons[id]) message_end() } public event_death() { new id = read_data(2) if (!is_user_bot(id)) remove_weapon_icon(id) } public check_icon_loc() { new value = get_pcvar_num(pcv_iloc) if (value == 1) iconstatus = get_user_msgid("StatusIcon") else if (value == 2) iconstatus = get_user_msgid("Scenario") else iconstatus = 0 return PLUGIN_CONTINUE } public plugin_precache() { precache_sound("Reloading01.wav") precache_sound("Reloading02.wav") precache_sound("Reloading03.wav") precache_sound("Reloading04.wav") } public preThink(id) { if(g_RadioTimer[id] != 1) { new clip, ammo new button = pev(id,pev_button) static iwpn iwpn = get_user_weapon(id, clip, ammo) remove_weapon_icon(id) check_icon_loc() static sprite[16]//, iwpn, clip, ammo iwpn = get_user_weapon(id, clip, ammo) switch(iwpn) { case CSW_P228: sprite="d_p228"; case CSW_SCOUT: sprite="d_scout"; case CSW_HEGRENADE: sprite="d_grenade"; case CSW_XM1014: sprite="d_xm1014"; case CSW_MAC10: sprite="d_mac10"; case CSW_AUG: sprite="d_aug"; case CSW_SMOKEGRENADE: sprite="d_flashbang"; case CSW_ELITE: sprite="d_elite"; case CSW_FIVESEVEN: sprite="d_fiveseven"; case CSW_UMP45: sprite="d_ump45"; case CSW_SG550: sprite="d_sg550"; case CSW_GALIL: sprite="d_galil"; case CSW_FAMAS: sprite="d_famas"; case CSW_USP: sprite="d_usp"; case CSW_MP5NAVY: sprite="d_mp5navy"; case CSW_M249: sprite="d_m249"; case CSW_M3: sprite="d_m3"; case CSW_M4A1: sprite="d_m4a1"; case CSW_TMP: sprite="d_tmp"; case CSW_G3SG1: sprite="d_g3sg1"; case CSW_FLASHBANG: sprite="d_flashbang"; case CSW_DEAGLE: sprite="d_deagle"; case CSW_SG552: sprite="d_sg552"; case CSW_AK47: sprite="d_ak47"; case CSW_KNIFE: sprite="d_knife"; case CSW_P90: sprite="d_p90"; case CSW_GLOCK18: sprite="d_glock18"; case CSW_AWP: sprite="d_awp"; } user_icons[id] = sprite draw_icon(id) if(!(iwpn == CSW_C4)&&!(iwpn == CSW_KNIFE)&&!(iwpn == CSW_FLASHBANG)&&!(iwpn == CSW_HEGRENADE)&&!(iwpn == CSW_SMOKEGRENADE)&& button & IN_RELOAD && get_user_ammo(id, weapon_list[23], clip, ammo) && ammo <= 5 && clip <= 5) { new players[32],total, team_name[10] get_user_team(id,team_name, 9) get_players(players, total ,"ce", team_name) new name[32] get_user_name(id,name,31) for(new a=0; a < total; ++a) { client_print(players[a],print_chat,"%s (RADIO): Reloading.",name) switch(random_num(0,3)) { case 0: { emit_sound(id, CHAN_ITEM, "Reloading01.wav", 1.0, ATTN_NORM, 0, PITCH_NORM); } case 1: { emit_sound(id, CHAN_ITEM, "Reloading02.wav", 1.0, ATTN_NORM, 0, PITCH_NORM); } case 2: { emit_sound(id, CHAN_ITEM, "Reloading03.wav", 1.0, ATTN_NORM, 0, PITCH_NORM); } case 3: { emit_sound(id, CHAN_ITEM, "Reloading04.wav", 1.0, ATTN_NORM, 0, PITCH_NORM); } } the_flash = 2 g_RadioTimer[id] = 1 set_task(2.0,"radiotimer",id) } } } return PLUGIN_HANDLED } public radiotimer(id) { the_flash = 1 g_RadioTimer[id] = 0 return PLUGIN_HANDLED } public client_connect(id) { the_flash = 1 g_RadioTimer[id] = 0 } public client_disconnect(id) { the_flash = 1 g_RadioTimer[id] = 0 }
Not sure what the problem was, but I just rewrote some of it in a style I was comfortable with. (I had those sprite="" things lined up with tabs in amxx studio, sorry the php tags broke them apart)
__________________
Last edited by Bad_Bud; 08-21-2009 at 06:13.
|
|