Участник
Пользователь
- Сообщения
- 59
- Реакции
- 6
Обратите внимание, если вы хотите заключить сделку с этим пользователем, он заблокирован
- Ошибка
-
Скриншот
- Компилятор
- Локальный
- Amx Mod X
- Исходный код
-
// I have NOT tested this plugin with CZ so I do not know if it will work
#define CZERO 0
#include <fakemeta>
#include <engine>
#include <fun>
#include <cstrike>
#include <amxmisc>
#include <entity_maths> //this has the function for the "heat-seeking" rockets
#define TE_EXPLOSION 3
#define TE_EXPLFLAG_NONE 0
#define TE_SMOKE 5
#define TE_BLOODSPRITE 115
#define TE_BLOODSTREAM 101
#define TE_MODEL 106
#define TE_WORLDDECAL 116
#define BA_NORMAL (1<<0) // "a"
#define BA_HEAT (1<<1) // "b"
#define BA_USER (1<<2) // "c"
new g_sModelIndexFireball, g_sModelIndexSmoke, rocketsmoke
new bool:CanShoot[32], Munni[32], mode[32], bool:allow_shooting, user_controll[32], bool:hasBazooka[32]
new mdl_gib_flesh, mdl_gib_head, mdl_gib_legbone, mdl_gib_lung, mdl_gib_meat, mdl_gib_spine, spr_blood_drop, spr_blood_spray
new gHealthIndex[33], bool:cantplantbomb, bool:cantswitch, iFlags, modetext[64]
public plugin_init() {
register_plugin("BazookaAdvanced", "1.3", "Major Victory")
register_concmd("amx_bazooka", "drop_rpg", ADMIN_LEVEL_A)
register_concmd("amx_bazooka_give", "cmdBazooka_give", ADMIN_LEVEL_A, "<@all or name/id> <amount>")
register_concmd("amx_bazooka_startarena", "cmdBazooka_StartArena", ADMIN_LEVEL_A, "<mode restrictions> <round restart 1|0>")
register_concmd("amx_bazooka_endarena", "cmdBazooka_EndArena", ADMIN_LEVEL_A, "<set ammo>")
register_cvar("amx_bazooka_dropping", "1")// can a player drop a bazooka
register_cvar("amx_bazooka_ammo", "1")// how much ammo per bazooka
register_cvar("amx_bazooka_damageradius", "250")
register_cvar("amx_bazooka_maxdamage", "150")
register_cvar("amx_bazooka_cost", "2500")// how much one bazooka costs
register_cvar("amx_bazooka_arena", "0")// requires direct hit to kill
register_cvar("amx_bazooka_buyable", "1")//diasbles/enables the buy menu
register_cvar("amx_bazooka_restrict", "bc") // a = Normal | b = Heat-Seeking | c = User-Guided
register_cvar("amx_bazooka_reloadtime", "2.5")// in seconds
register_cvar("amx_bazooka_trailtime", "30")// roughly 3 seconds
register_cvar("amx_bazooka_velocity", "700")
register_cvar("amx_bazooka_teamcolors", "1")// set to 1 for team colored trails
register_cvar("amx_bazooka_gib", "1")// set to 1 for gib deaths (may cause lag on slower computers)
register_clcmd("say", "handle_say")
register_clcmd("say_team", "handle_say")
register_event("DeathMsg", "player_die", "a")
register_event("CurWeapon", "check_model", "be")
register_event("TextMsg", "bomb_msg", "b", "2=#C4_Plant_At_Bomb_Spot")
register_event("ResetHUD","event_respawn","be","1=1")
register_logevent("round_end", 2, "1=Round_End")
register_logevent("round_start", 2, "1=Round_Start")
register_clcmd("drop", "handle_drop")
register_forward(FM_PlayerPreThink, "forward_playerprethink")
register_forward(FM_SetModel, "forward_setmodel")
register_menu("Bazooka Menu", 1023, "do_bazookamenu")
register_logevent("bombplant",3,"2=Planted_The_Bomb")
}
public plugin_precache() {
precache_model("models/rpgrocket.mdl")
precache_model("models/w_rpg.mdl")
precache_model("models/v_rpg.mdl")
precache_model("models/p_rpg.mdl")
precache_sound("weapons/rocketfire1.wav")
precache_sound("items/gunpickup4.wav")
precache_sound("weapons/nuke_fly.wav")// <-- this is the only non-game sound file, make sure you have it
precache_sound("weapons/dryfire1.wav")
spr_blood_drop = precache_model("sprites/blood.spr")
spr_blood_spray = precache_model("sprites/bloodspray.spr")
mdl_gib_flesh = precache_model("models/Fleshgibs.mdl")
mdl_gib_head = precache_model("models/GIB_Skull.mdl")
mdl_gib_legbone = precache_model("models/GIB_Legbone.mdl")
mdl_gib_lung = precache_model("models/GIB_Lung.mdl")
mdl_gib_meat = precache_model("models/GIB_B_Gib.mdl")
mdl_gib_spine = precache_model("models/GIB_B_Bone.mdl")
g_sModelIndexFireball = precache_model("sprites/zerogxplode.spr")
g_sModelIndexSmoke = precache_model("sprites/steam1.spr")
rocketsmoke = precache_model("sprites/smoke.spr")
}
public get_restrict_flags() {
new sFlags[24]
get_cvar_string("amx_bazooka_restrict",sFlags,24)
iFlags = read_flags(sFlags)
}
public bomb_msg(id) {
if (cs_get_user_plant(id) != 1)
client_print(id,print_center,"")
}
public bombplant() {
cantplantbomb = true
}
public round_end() {
set_task(4.8, "round_prestart")
set_task(5.0, "player_spawn")
set_task(5.2, "bazooka_arena")
}
public round_prestart() {
allow_shooting = false
cantplantbomb = true
cantswitch = true
}
public round_start() {
allow_shooting = true
cantplantbomb = false
cantswitch = false
}
public bazooka_arena(id) {
if (get_cvar_num("amx_bazooka_arena") == 1) {
new players[32], count
get_players(players, count)
for (new i = 0; i < count; i++) {
give_item(players[i], "weapon_c4")
hasBazooka[players[i]] = true
allow_shooting = true
CanShoot[players[i]] = true
cs_set_user_plant(players[i],0,0)
console_cmd(id ,"amx_bazooka_damageradius 40")
console_cmd(id ,"amx_bazooka_maxdamage 999999")
client_print(players[i], print_chat, "[Bazooka] Bazooka Arena is ON! say ^"bazookahelp^" for more info")
client_print(players[i], print_center, "Time to make things go BOOM!")
}
}
return PLUGIN_HANDLED
}
public cmdBazooka_StartArena(id,level,cid) {
if (!cmd_access(id, level, cid, 3)) {
return PLUGIN_HANDLED
}
new arg[6],arg2[2],argument2,players[32], count
read_argv(1,arg,5)
read_argv(2,arg2,1)
argument2 = str_to_num(arg2)
console_cmd(id, "amx_bazooka_arena 1")
console_cmd(id, "amx_bazooka_give @all 1")
console_cmd(id, "amx_bazooka_restrict %s",arg)
get_players(players, count)
for (new i = 0; i < count; i++) {
ammo_hud(players[i], 0)
ammo_hud(players[i], 1)
emit_sound(players[i], CHAN_ITEM, "items/gunpickup2.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
client_print(players[i], print_chat, "[Bazooka] Bazooka Arena has been turned ON")
}
if (argument2 == 1) {
console_cmd(id, "sv_restartround 1")
}
return PLUGIN_HANDLED
}
public cmdBazooka_EndArena(id,level,cid) {
if (!cmd_access(id, level, cid, 2)) {
return PLUGIN_HANDLED
}
new arg[5],argument1,players[32], count
read_argv(1,arg,4)
argument1 = str_to_num(arg)
console_cmd(id, "amx_bazooka_arena 0")
if (argument1 >= 0) {
get_players(players, count)
for (new i = 0; i < count; i++) {
Munni[players[i]] = argument1
ammo_hud(players[i], 0)
ammo_hud(players[i], 1)
client_print(players[i], print_chat, "[Bazooka] Bazooka Arena has been turned OFF")
}
}
return PLUGIN_HANDLED
}
public fire_rocket(id) {
ammo_hud(id, 0)
ammo_hud(id, 1)
CanShoot[id] = false
new data[1]
data[0] = id
new rtime = get_cvar_num("amx_bazooka_reloadtime")
if (cs_get_user_plant(id) != 1){
set_task((rtime + 0.0), "rpg_reload", id+9477, data, 1)
if ((Munni[id] <= 0) && (get_cvar_num("amx_bazooka_arena") != 1)) {
emit_sound(id, CHAN_WEAPON, "weapons/dryfire1.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
return PLUGIN_HANDLED
}
else{
new Float:StartOrigin[3], Float:Angle[3]
new PlayerOrigin[3]
get_user_origin(id, PlayerOrigin, 1)
StartOrigin[0] = float(PlayerOrigin[0])
StartOrigin[1] = float(PlayerOrigin[1])
StartOrigin[2] = float(PlayerOrigin[2])
entity_get_vector(id, EV_VEC_v_angle, Angle)
Angle[0] = Angle[0] * -1.0
new RocketEnt = create_entity("info_target")
entity_set_string(RocketEnt, EV_SZ_classname, "rpgrocket")
entity_set_model(RocketEnt, "models/rpgrocket.mdl")
entity_set_origin(RocketEnt, StartOrigin)
entity_set_vector(RocketEnt, EV_VEC_angles, Angle)
new Float:MinBox[3] = {-1.0, -1.0, -1.0}
new Float:MaxBox[3] = {1.0, 1.0, 1.0}
entity_set_vector(RocketEnt, EV_VEC_mins, MinBox)
entity_set_vector(RocketEnt, EV_VEC_maxs, MaxBox)
entity_set_int(RocketEnt, EV_INT_solid, 2)
entity_set_int(RocketEnt, EV_INT_movetype, 5)
entity_set_edict(RocketEnt, EV_ENT_owner, id)
new Float:Velocity[3]
new myvelocity = get_cvar_num("amx_bazooka_velocity")
VelocityByAim(id, myvelocity, Velocity)
entity_set_vector(RocketEnt, EV_VEC_velocity, Velocity)
emit_sound(RocketEnt, CHAN_WEAPON, "weapons/rocketfire1.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
emit_sound(RocketEnt, CHAN_VOICE, "weapons/nuke_fly.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
if (get_cvar_num("amx_bazooka_arena") != 1) {
ammo_hud(id, 0)
Munni[id]--
ammo_hud(id, 1)
}
new CsTeams:iTeam =cs_get_user_team(id)
new trailtime =get_cvar_num("amx_bazooka_trailtime")
new colorr =random_num(0,255)
new colorg =random_num(0,255)
new colorb =random_num(0,255)
if (get_cvar_num("amx_bazooka_teamcolors") == 1) {
switch(iTeam) {
case CS_TEAM_T: { //if team T color=red
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(22)
write_short(RocketEnt)
write_short(rocketsmoke)
write_byte(trailtime)
write_byte(3)
write_byte(255)
write_byte(0)
write_byte(0)
write_byte(255)
message_end()
}
case CS_TEAM_CT: { // if team CT color=blue
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(22)
write_short(RocketEnt)
write_short(rocketsmoke)
write_byte(trailtime)
write_byte(3)
write_byte(0)
write_byte(0)
write_byte(255)
write_byte(255)
message_end()
}
}
}
else { // random colors anyone?
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(22)
write_short(RocketEnt)
write_short(rocketsmoke)
write_byte(trailtime)
write_byte(3)
write_byte(colorr)
write_byte(colorg)
write_byte(colorb)
write_byte(255)
message_end()
}
if (mode[id] == 2) {
new info[1]
info[0] = RocketEnt
set_task(1.0, "find_and_follow", 0, info, 1)
}
else if (mode[id] == 3) {
entity_set_int(RocketEnt, EV_INT_rendermode, 1)
attach_view(id, RocketEnt)
user_controll[id] = RocketEnt
}
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
public rpg_reload(data[]) {
CanShoot[data[0]] = true
}
public find_and_follow(info[]) {
new RocketEnt = info[0]
new Float:shortestDist = 10000.0
new nearestPlayer = 0
if (is_valid_ent(RocketEnt)) {
new players[32], count
get_players(players, count)
for (new i = 0; i < count; i++) {
if (is_user_alive(players[i]) && (entity_get_edict(RocketEnt, EV_ENT_owner) != players[i]) && (get_user_team(players[i]) != get_user_team(entity_get_edict(RocketEnt, EV_ENT_owner)))) {
new Float:PlayerOrigin[3], Float:RocketOrigin[3]
entity_get_vector(players[i], EV_VEC_origin, PlayerOrigin)
entity_get_vector(RocketEnt, EV_VEC_origin, RocketOrigin)
new Float:distance = vector_distance(PlayerOrigin, RocketOrigin)
if (distance <= shortestDist) {
shortestDist = distance
nearestPlayer = players[i]
}
}
}
}
if (nearestPlayer > 0) {
new data[2]
data[0] = RocketEnt
data[1] = nearestPlayer
set_task(0.1, "follow_and_catch", RocketEnt, data, 2, "b")
}
else {
pfn_touch(RocketEnt, 0)
}
}
public follow_and_catch(data[]) {
new RocketEnt = data[0]
new target = data[1]
new myvelocity = get_cvar_num("amx_bazooka_velocity")
if (is_user_alive(target) && is_valid_ent(RocketEnt)) {
entity_set_follow(RocketEnt, target, (myvelocity+0.0))
new Float:Velocity[3]
new Float:NewAngle[3]
entity_get_vector(RocketEnt, EV_VEC_velocity, Velocity)
vector_to_angle(Velocity, NewAngle)
entity_set_vector(RocketEnt, EV_VEC_angles, NewAngle)
}
else {
remove_task(RocketEnt)
new info[1]
info[0] = RocketEnt
set_task(0.1, "find_and_follow", 0, data, 1)
}
}
public pfn_touch(ptr, ptd) {
new ClassName[32]
new ClassNameptd[32]
if ((ptr > 0) && is_valid_ent(ptr)) {
entity_get_string(ptr, EV_SZ_classname, ClassName, 31)
}
if ((ptd > 0) && is_valid_ent(ptd)) {
entity_get_string(ptd, EV_SZ_classname, ClassNameptd, 31)
}
if (equal(ClassName, "rpgrocket")) {
if (equal(ClassNameptd, "func_breakable")) {
force_use(ptr,ptd)
remove_task(ptr)
}
remove_task(ptr)
new Float:EndOrigin[3]
entity_get_vector(ptr, EV_VEC_origin, EndOrigin)
message_begin( MSG_BROADCAST, SVC_TEMPENTITY) // Explosion
write_byte(TE_EXPLOSION)
write_coord(floatround(EndOrigin[0]))
write_coord(floatround(EndOrigin[1]))
write_coord(floatround(EndOrigin[2])+5)
write_short(g_sModelIndexFireball)
write_byte(random_num(0,20) + 20)
write_byte(12) // framerate
write_byte(TE_EXPLFLAG_NONE)
message_end()
message_begin(MSG_BROADCAST, SVC_TEMPENTITY) // Smoke
write_byte(TE_SMOKE)
write_coord(floatround(EndOrigin[0]))
write_coord(floatround(EndOrigin[1]))
write_coord(floatround(EndOrigin[2])+15)
write_short(g_sModelIndexSmoke)
write_byte(60)
write_byte(10)
message_end()
new maxdamage = get_cvar_num("amx_bazooka_maxdamage")
new damageradius = get_cvar_num("amx_bazooka_damageradius")
new PlayerPos[3], distance, damage
for (new i = 1; i < 32; i++) {
if (is_user_alive(i) == 1) {
get_user_origin(i, PlayerPos)
new NonFloatEndOrigin[3]
NonFloatEndOrigin[0] = floatround(EndOrigin[0])
NonFloatEndOrigin[1] = floatround(EndOrigin[1])
NonFloatEndOrigin[2] = floatround(EndOrigin[2])
distance = get_distance(PlayerPos, NonFloatEndOrigin)
if (distance <= damageradius) { // Screenshake Radius
message_begin(MSG_ONE, get_user_msgid("ScreenShake"), {0,0,0}, i) // Shake Screen
write_short(1<<14)
write_short(1<<14)
write_short(1<<14)
message_end()
damage = maxdamage - floatround(floatmul(float(maxdamage), floatdiv(float(distance), float(damageradius))))
new attacker = entity_get_edict(ptr, EV_ENT_owner)
if (!get_user_godmode(i)) {
if (get_user_team(attacker) != get_user_team(i)) {
if (damage < get_user_health(i)) {
set_user_health(i, get_user_health(i) - damage)
}
else {
set_msg_block(get_user_msgid("DeathMsg"), BLOCK_SET)
user_kill(i, 1)
set_msg_block(get_user_msgid("DeathMsg"), BLOCK_NOT)
message_begin(MSG_BROADCAST, get_user_msgid("DeathMsg")) // Kill-Log oben rechts
write_byte(attacker) // Attacker
write_byte(i) // Victim
write_byte(0) // Headshot
write_string("bazooka")
message_end()
if (damage > 100 && get_cvar_num("amx_bazooka_gib") == 1) { //begin gibs and effects (made by mike_cao)
new iOrigin[3]
get_user_origin(i,iOrigin) // Effects
fx_trans(i,0)
fx_gib_explode(iOrigin,3)
fx_blood_large(iOrigin,5)
fx_blood_small(iOrigin,15)
iOrigin[2] = iOrigin[2]-20 // Hide body
set_user_origin(i,iOrigin)
} //end gibs and effects
set_user_frags(attacker, get_user_frags(attacker) + 1)
if (get_cvar_num("amx_bazooka_gib") == 1) {
client_print(attacker, print_center, "LOLERS! You just splattered that guy's guts everywhere!")
}
}
}
if (get_user_team(attacker) == get_user_team(i)) {
if (attacker == i) {
if (damage < get_user_health(i)) {
set_user_health(i, get_user_health(i) - damage)
}
else {
set_msg_block(get_user_msgid("DeathMsg"), BLOCK_SET)
user_kill(i, 1)
set_msg_block(get_user_msgid("DeathMsg"), BLOCK_NOT)
message_begin(MSG_BROADCAST, get_user_msgid("DeathMsg")) // Kill-Log oben rechts
write_byte(attacker) // Attacker
write_byte(i) // Victim
write_byte(0) // Headshot
write_string("bazooka")
message_end()
if ((damage > 100) && get_cvar_num("amx_bazooka_gib") == 1) { //begin gibs and effects (made by mike_cao)
new iOrigin[3]
get_user_origin(i,iOrigin)// Effects
fx_trans(i,0)
fx_gib_explode(iOrigin,3)
fx_blood_large(iOrigin,5)
fx_blood_small(iOrigin,15)
iOrigin[2] = iOrigin[2]-20 // Hide body
set_user_origin(i,iOrigin)
} //end gibs and effects
set_user_frags(attacker, get_user_frags(attacker) - 1)
if (get_cvar_num("amx_bazooka_gib") == 1){
client_print(attacker, print_center, "Great! Now everyone knows what you had for supper!")
}
else {
client_print(attacker, print_center, "You do know this thing explodes right?")
}
}
}
else {
if (get_cvar_num("mp_friendlyfire")) {
if (damage < get_user_health(i)) {
set_user_health(i, get_user_health(i) - damage)
client_print(attacker, print_center, "You injured a teammate! Watch your aim!")
}
else {
set_msg_block(get_user_msgid("DeathMsg"), BLOCK_SET)
user_kill(i, 1)
set_msg_block(get_user_msgid("DeathMsg"), BLOCK_NOT)
message_begin(MSG_BROADCAST, get_user_msgid("DeathMsg")) // Kill-Log oben rechts
write_byte(attacker) // Attacker write_byte(i) // Victim
write_byte(0) // Headshot
write_string("bazooka")
message_end()
if (damage > 100 && get_cvar_num("amx_bazooka_gib") == 1) { //begin gibs and effects (made by mike_cao)
new iOrigin[3]
get_user_origin(i,iOrigin)// Effects
fx_trans(i,0)
fx_gib_explode(iOrigin,3)
fx_blood_large(iOrigin,5)
fx_blood_small(iOrigin,15)
iOrigin[2] = iOrigin[2]-20 // Hide body
set_user_origin(i,iOrigin)
} //end gibs and effects
set_user_frags(attacker, get_user_frags(attacker) - 1)
if (get_cvar_num("amx_bazooka_gib") == 1){
client_print(attacker, print_center, "OMFG's!! You just splattered a teammate!")
}
else{
client_print(attacker, print_center, "LOL! That teammate is probably not too happy now!")
}
}
}
}
}
}
}
}
}
attach_view(entity_get_edict(ptr, EV_ENT_owner), entity_get_edict(ptr, EV_ENT_owner))
user_controll[entity_get_edict(ptr, EV_ENT_owner)] = 0
remove_entity(ptr)
}
if (equal(ClassName, "rpg") || equal(ClassName, "rpg_temp")) {
new Picker[32]
if ((ptd > 0) && is_valid_ent(ptd)) {
entity_get_string(ptd, EV_SZ_classname, Picker, 31)
}
if (equal(Picker, "player")) {
give_item(ptd, "weapon_c4")
hasBazooka[ptd] = true
Munni[ptd] = Munni[ptd] + entity_get_int(ptr, EV_INT_iuser1)
client_print(ptd, print_chat, "[Bazooka] You have picked up a bazooka!")
ammo_hud(ptd, 0)
ammo_hud(ptd, 1)
emit_sound(ptd, CHAN_WEAPON, "items/gunpickup2.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
remove_entity(ptr)
}
}
}
public drop_rpg(id, level, cid) {
if (!cmd_access(id, level, cid, 1)) {
return PLUGIN_HANDLED
}
new Float:PlayerOrigin[3], Float:End[3], Float:Return[3], Float:TraceDirection[3]
entity_get_vector(id, EV_VEC_origin, PlayerOrigin)
VelocityByAim(id, 64, TraceDirection)
End[0] = TraceDirection[0] + PlayerOrigin[0]
End[1] = TraceDirection[1] + PlayerOrigin[1]
End[2] = TraceDirection[2] + PlayerOrigin[2]
trace_line(id, PlayerOrigin, End, Return)
Return[2] = PlayerOrigin[2]
new RPG = create_entity("info_target")
entity_set_string(RPG, EV_SZ_classname, "rpg")
entity_set_model(RPG, "models/w_rpg.mdl")
entity_set_origin(RPG, Return)
new Float:MinBox[3] = {-16.0, -16.0, 0.0}
new Float:MaxBox[3] = {16.0, 16.0, 16.0}
entity_set_vector(RPG, EV_VEC_mins, MinBox)
entity_set_vector(RPG, EV_VEC_maxs, MaxBox)
entity_set_int(RPG, EV_INT_solid, 1)
entity_set_int(RPG, EV_INT_movetype, 6)
entity_set_int(RPG, EV_INT_iuser1, get_cvar_num("amx_bazooka_ammo"))
return PLUGIN_HANDLED
}
public client_PreThink(id) {
if (is_user_alive(id)) {
new weaponid, clip, ammo
weaponid = get_user_weapon(id, clip, ammo)
if ((weaponid == CSW_C4) && hasBazooka[id]) {
new attack = get_user_button(id) & IN_ATTACK
new oldattack = get_user_oldbutton(id) & IN_ATTACK
new attack2 = get_user_button(id) & IN_ATTACK2
new oldattack2 = get_user_oldbutton(id) & IN_ATTACK2
new CsTeams:iTeam =cs_get_user_team(id)
if (attack && !oldattack && (cs_get_user_plant(id) != 1)) {
get_restrict_flags()
if (mode[id] != 1 && ((iFlags&BA_USER) || (iFlags&BA_HEAT))) {
mode[id] = 1
if (CanShoot[id] && allow_shooting && (user_controll[id] == 0)) {
fire_rocket(id)
}
}
else {
if (CanShoot[id] && allow_shooting && (user_controll[id] == 0)) {
fire_rocket(id)
}
}
}
else if (attack2 && !oldattack2) {
switch(mode[id]) {
case 1: {
get_restrict_flags()
if ((iFlags&BA_HEAT) != BA_HEAT) {
mode[id] = 2
modetext = "Heat-Seeking"
ammo_hud(id, 0)
ammo_hud(id, 1)
check_model(id)
emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
emit_sound(id, CHAN_WEAPON, "items/nvg_on.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
client_print(id, print_center, "Heat-Seeking Mode")
}
else if ((iFlags&BA_USER) != BA_USER) {
mode[id] = 3
modetext = "User-Guided"
ammo_hud(id, 0)
ammo_hud(id, 1)
check_model(id)
emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
emit_sound(id, CHAN_WEAPON, "items/gunpickup4.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
client_print(id, print_center, "User-Guided Mode")
}
else {
if (!cantplantbomb && !cantswitch && iTeam&CS_TEAM_T) {
cantswitch = true
mode[id] = 4
modetext = "C4"
ammo_hud(id, 0)
ammo_hud(id, 1)
cs_set_user_plant(id,1,1)
check_model(id)
emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
client_print(id, print_center, "Switching to C4 Bomb")
}
else if (cantplantbomb || cantswitch || iTeam&CS_TEAM_CT){
mode[id] = 1
modetext = "Bazooka"
ammo_hud(id, 0)
ammo_hud(id, 1)
check_model(id)
emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
client_print(id, print_center, "The other modes are restricted")
}
}
}
case 2: {
get_restrict_flags()
if ((iFlags&BA_USER) != BA_USER) {
mode[id] = 3
modetext = "User-Guided"
ammo_hud(id, 0)
ammo_hud(id, 1)
check_model(id)
emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
emit_sound(id, CHAN_WEAPON, "items/gunpickup4.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
client_print(id, print_center, "User-Guided Mode")
}
else if (iFlags&BA_USER && ((iFlags&BA_NORMAL) != BA_NORMAL)) {
if (!cantplantbomb && !cantswitch && iTeam&CS_TEAM_T) {
cantswitch = true
mode[id] = 4
modetext = "C4"
ammo_hud(id, 0)
ammo_hud(id, 1)
cs_set_user_plant(id,1,1)
check_model(id)
emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
client_print(id, print_center, "Switching to C4 Bomb")
}
else if (cantplantbomb || cantswitch || iTeam&CS_TEAM_CT){
mode[id] = 1
modetext = "Bazooka"
ammo_hud(id, 0)
ammo_hud(id, 1)
check_model(id)
emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
client_print(id, print_center, "Normal Mode")
}
}
else {
mode[id] = 2
modetext = "Heat-Seeking"
ammo_hud(id, 0)
ammo_hud(id, 1)
check_model(id)
emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
client_print(id, print_center, "The other modes are restricted")
}
}
case 3: {
get_restrict_flags()
if ((iFlags&BA_NORMAL) != BA_NORMAL) {
if (!cantplantbomb && !cantswitch && iTeam&CS_TEAM_T) {
cantswitch = true
mode[id] = 4
modetext = "C4"
ammo_hud(id, 0)
ammo_hud(id, 1)
cs_set_user_plant(id,1,1)
check_model(id)
emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
client_print(id, print_center, "Switching to C4 Bomb")
}
else if (cantplantbomb || cantswitch || iTeam&CS_TEAM_CT){
mode[id] = 1
modetext = "Bazooka"
ammo_hud(id, 0)
ammo_hud(id, 1)
check_model(id)
emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
client_print(id, print_center, "Normal Mode")
}
}
else if ((iFlags&BA_HEAT) != BA_HEAT){
mode[id] = 2
modetext = "Heat-Seeking"
ammo_hud(id, 0)
ammo_hud(id, 1)
check_model(id)
emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
emit_sound(id, CHAN_WEAPON, "items/nvg_on.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
client_print(id, print_center, "Heat-Seeking Mode")
}
else {
mode[id] = 3
modetext = "User-Guided"
ammo_hud(id, 0)
ammo_hud(id, 1)
check_model(id)
emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
client_print(id, print_center, "The other modes are restricted")
}
}
case 4: {
get_restrict_flags()
if ((iFlags&BA_NORMAL) != BA_NORMAL) {
cantswitch = false
mode[id] = 1
modetext = "Bazooka"
ammo_hud(id, 0)
ammo_hud(id, 1)
cs_set_user_plant(id,0,0)
check_model(id)
emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
client_print(id, print_center, "Switching to Bazooka")
}
else if ((iFlags&BA_HEAT) != BA_HEAT) {
cantswitch = false
mode[id] = 2
modetext = "Heat-Seeking"
ammo_hud(id, 0)
ammo_hud(id, 1)
cs_set_user_plant(id,0,0)
check_model(id)
emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
emit_sound(id, CHAN_WEAPON, "items/nvg_on.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
client_print(id, print_center, "Heat-Seeking Mode")
}
else if ((iFlags&BA_USER) != BA_USER) {
cantswitch = false
mode[id] = 3
modetext = "User-Guided"
ammo_hud(id, 0)
ammo_hud(id, 1)
cs_set_user_plant(id,0,0)
check_model(id)
emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
emit_sound(id, CHAN_WEAPON, "items/gunpickup4.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
client_print(id, print_center, "User-Guided Mode")
}
else {
cantswitch = true
mode[id] = 4
modetext = "C4"
ammo_hud(id, 0)
ammo_hud(id, 1)
cs_set_user_plant(id,1,1)
check_model(id)
emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
client_print(id, print_center, "The other modes are restricted")
}
}
}
}
}
}
if (user_controll[id] > 0) {
new RocketEnt = user_controll[id]
if (is_valid_ent(RocketEnt)) {
new Float:Velocity[3]
VelocityByAim(id, 500, Velocity)
entity_set_vector(RocketEnt, EV_VEC_velocity, Velocity)
new Float:NewAngle[3]
entity_get_vector(id, EV_VEC_v_angle, NewAngle)
entity_set_vector(RocketEnt, EV_VEC_angles, NewAngle)
}
else {
attach_view(id, id)
}
}
return FMRES_IGNORED
}
public forward_setmodel(entity, model[]) {
if (!is_valid_ent(entity)) {
return FMRES_IGNORED
}
if (equal(model, "models/w_backpack.mdl")) {
client_print(0, print_center, "")
new ClassName[32]
entity_get_string(entity, EV_SZ_classname, ClassName, 31)
if (equal(ClassName, "weaponbox")) {
remove_entity(entity)
return FMRES_SUPERCEDE
}
}
return FMRES_IGNORED
}
public check_model(id) {
new weaponid, clip, ammo
weaponid = get_user_weapon(id, clip, ammo)
if ((weaponid == CSW_C4) && (cs_get_user_plant(id) != 1) && (mode[id] != 4)) {
ammo_hud(id, 0)
ammo_hud(id, 1)
entity_set_string(id, EV_SZ_viewmodel, "models/v_rpg.mdl")
entity_set_string(id, EV_SZ_weaponmodel, "models/p_rpg.mdl")
}
else if ((weaponid == CSW_C4) && (cs_get_user_plant(id) == 1) && (mode[id] == 4)) {
ammo_hud(id, 0)
ammo_hud(id, 1)
entity_set_string(id, EV_SZ_viewmodel, "models/v_c4.mdl")
entity_set_string(id, EV_SZ_weaponmodel, "models/p_c4.mdl")
}
return PLUGIN_HANDLED
}
public client_connect(id) {
CanShoot[id] = true
Munni[id] = 0
mode[id] = 1
hasBazooka[id] = false
}
ammo_hud(id, show) {
new AmmoHud[65]
if (get_cvar_num("amx_bazooka_arena") == 1) {
format(AmmoHud, 64, "Rockets: Infinite | Mode: %s",modetext)
}
else {
format(AmmoHud, 64, "Rockets: %i | Mode: %s", Munni[id],modetext)
}
if (show) {
message_begin(MSG_ONE, get_user_msgid("StatusText"), {0,0,0}, id)
write_byte(0)
write_string(AmmoHud)
message_end()
}
else {
message_begin(MSG_ONE, get_user_msgid("StatusText"), {0,0,0}, id)
write_byte(0)
write_string("")
message_end()
}
}
public player_die(id) {
new victim
victim = read_data(2)
ammo_hud(victim, 0)
Munni[victim] = 0
hasBazooka[victim] = false
if ((cs_get_user_plant(victim) == 1) || cantswitch) {
cs_set_user_plant(victim,0,0)
cantswitch = false
}
}
public player_spawn() {
new players[32], count
get_players(players, count)
for (new i = 0; i < count; i++) {
if (is_user_alive(players[i])) {
new v_oldmodel[64], p_oldmodel[64]
entity_get_string(players[i], EV_SZ_viewmodel, v_oldmodel, 63)
entity_get_string(players[i], EV_SZ_weaponmodel, p_oldmodel, 63)
if (equal(v_oldmodel, "models/v_rpg.mdl") || equal(p_oldmodel, "models/p_rpg.mdl")) {
if (!hasBazooka[players[i]]) {
new weaponid, clip, ammo
weaponid = get_user_weapon(players[i], clip, ammo)
new weaponname[64]
get_weaponname(weaponid, weaponname, 63)
new v_model[64], p_model[64]
format(v_model, 63, "%s", weaponname)
format(p_model, 63, "%s", weaponname)
replace(v_model, 63, "weapon_", "v_")
format(v_model, 63, "models/%s.mdl", v_model)
entity_set_string(players[i], EV_SZ_viewmodel, v_model)
replace(p_model, 63, "weapon_", "p_")
format(p_model, 63, "models/%s.mdl", p_model)
entity_set_string(players[i], EV_SZ_weaponmodel, p_model)
}
}
}
}
new TempRocket = find_ent_by_class(-1, "rpgrocket")
while (TempRocket > 0) {
remove_entity(TempRocket)
TempRocket = find_ent_by_class(TempRocket, "rpgrocket")
}
new TempRPG = find_ent_by_class(-1, "rpg_temp")
while (TempRPG > 0) {
remove_entity(TempRPG)
TempRPG = find_ent_by_class(TempRPG, "rpg_temp")
}
return PLUGIN_HANDLED
}
public handle_drop(id) {
if (read_argc() > 1) {
new weapon[17]
read_argv(1, weapon, 16)
if (equal(weapon, "weapon_c4")) {
new weapons[32], count
get_user_weapons(id, weapons, count)
for (new i = 0; i < count; i++) {
if (weapons[i] == 6) {
if (get_cvar_num("amx_bazooka_dropping") == 1) {
drop_rpg_temp(id)
}
else {
client_print(id, print_center, "This weapon cannot be dropped")
return PLUGIN_HANDLED
}
}
}
}
}
else {
new weaponid, clip, ammo
weaponid = get_user_weapon(id, clip, ammo)
if (weaponid == CSW_C4) {
if (get_cvar_num("amx_bazooka_dropping") == 1) {
drop_rpg_temp(id)
}
else {
client_print(id, print_center, "This weapon cannot be dropped")
return PLUGIN_HANDLED
}
}
}
return PLUGIN_CONTINUE
}
public drop_rpg_temp(id) {
new Float:PlayerOrigin[3], Float:End[3], Float:Return[3], Float:TraceDirection[3], Float:Angles[3]
entity_get_vector(id, EV_VEC_origin, PlayerOrigin)
entity_get_vector(id, EV_VEC_angles, Angles)
VelocityByAim(id, 200, TraceDirection)
End[0] = TraceDirection[0] + PlayerOrigin[0]
End[1] = TraceDirection[1] + PlayerOrigin[1]
End[2] = TraceDirection[2] + PlayerOrigin[2]
trace_line(id, PlayerOrigin, End, Return)
Return[2] = PlayerOrigin[2]
new RPG = create_entity("info_target")
entity_set_string(RPG, EV_SZ_classname, "rpg_temp")
entity_set_model(RPG, "models/w_rpg.mdl")
entity_set_origin(RPG, Return)
Angles[0] = 0.0
Angles[2] = 0.0
entity_set_vector(RPG, EV_VEC_angles, Angles)
new Float:MinBox[3] = {-16.0, -16.0, 0.0}
new Float:MaxBox[3] = {16.0, 16.0, 16.0}
entity_set_vector(RPG, EV_VEC_mins, MinBox)
entity_set_vector(RPG, EV_VEC_maxs, MaxBox)
entity_set_int(RPG, EV_INT_solid, 1)
entity_set_int(RPG, EV_INT_movetype, 6)
entity_set_int(RPG, EV_INT_iuser1, Munni[id])
Munni[id] = 0
hasBazooka[id] = false
return PLUGIN_HANDLED
}
public handle_say(id) {
new command[32]
read_argv(1, command, 31)
if (equal(command, "buybazooka")) {
if (is_user_alive(id)) {
if (get_cvar_num("amx_bazooka_buyable") == 1) {
show_buymenu(id)
}
else {
client_print(id, print_chat, "[Bazooka] The buymenu is disabled!")
}
}
else {
client_print(id, print_chat, "[Bazooka] You cannot buy a Bazooka while you are dead!")
}
}
if (equal(command, "bazookahelp"))
{
// Display Help File from amxx/configs/bazooka_help.htm
new szHelpFile[64], szCustomDir[32]
get_customdir( szCustomDir, 31 )
format( szHelpFile, 63, "%s/bazooka_help.htm", szCustomDir )
show_motd( id, szHelpFile, "Bazooka - Help" )
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}
public show_buymenu(id) {
new MenuBody[256]
new len = format(MenuBody, 255, "\yBuy Item^n^n")
len = len + format(MenuBody[len], 255 - len, "\w1. Bazooka\R$%d^n", get_cvar_num("amx_bazooka_cost"))
len = len + format(MenuBody[len], 255 - len, "^n\w0. Exit^n")
new keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9)
show_menu(id, keys, MenuBody, -1, "Bazooka Menu")
return PLUGIN_HANDLED
}
public cmdBazooka_give(id, level, cid) {
if (!cmd_access(id, level, cid, 3)) {
return PLUGIN_HANDLED
}
new arg[32], arg2[8], name2[32], ammo
ammo=get_cvar_num("amx_bazooka_ammo")
read_argv(1,arg,31)
read_argv(2,arg2,7)
if ( equali(arg,"@all") )
{
new plist[32],pnum
get_players(plist,pnum,"a")
if (pnum==0)
{
console_print(id,"[Bazooka] This client is invalid")
return PLUGIN_HANDLED
}
for (new i=0; i<pnum; i++)
{
give_item(plist[i], "weapon_c4")
hasBazooka[plist[i]] = true
Munni[plist[i]] += ((str_to_num(arg2))*ammo)
ammo_hud(plist[i], 0)
ammo_hud(plist[i], 1)
check_model(id)
client_print(plist[i], print_chat, "[Bazooka] The Admin gave you a bazooka with %s rockets!",arg2)
client_print(plist[i], print_chat, "[Bazooka] Switch to the bomb weapon or weapon slot 5 to use it")
console_print(id,"[Bazooka] Gave all players bazookas with %s rockets",arg2)
}
}
else
{
get_user_name(id,name2,31)
new player = cmd_target(id,arg,7)
if (!player)
{
console_print(id,"[Bazooka] Give Bazooka Failed")
return PLUGIN_HANDLED
}
new name[32]
get_user_name(player,name,31)
give_item(player, "weapon_c4")
hasBazooka[player] = true
Munni[player] += ((str_to_num(arg2))*ammo)
ammo_hud(player, 0)
ammo_hud(player, 1)
check_model(id)
console_print(id,"[Bazooka] Gave %s %s Bazookas",name,arg2)
client_print(player, print_chat, "[Bazooka] The Admin gave you a bazooka with %s rockets!",arg2)
client_print(player, print_chat, "[Bazooka] Switch to the bomb weapon or weapon slot 5 to use it.")
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
public do_bazookamenu(id, key) {
switch(key) {
case 0: {
if (cs_get_user_money(id) >= get_cvar_num("amx_bazooka_cost")) {
give_item(id, "weapon_c4")
hasBazooka[id] = true
Munni[id] = Munni[id] + get_cvar_num("amx_bazooka_ammo")
ammo_hud(id, 0)
ammo_hud(id, 1)
cs_set_user_money(id, cs_get_user_money(id) - get_cvar_num("amx_bazooka_cost"))
client_print(id, print_chat, "[Bazooka] You have successfully bought a bazooka!")
client_print(id, print_chat, "[Bazooka] What are you going to do now!?")
}
else {
client_print(id, print_center, "Oh no you don't! You're too poor to buy one of these suckers!")
}
}
case 9: {
}
default: {
show_buymenu(id)
}
}
return PLUGIN_HANDLED
}
/************************************************************
* GIB FUNCTIONS (made by mike_cao)
************************************************************/
public event_respawn(id)
{
gHealthIndex[id] = get_user_health(id)
fx_trans(id,255)
return PLUGIN_CONTINUE
}
static fx_trans(player,amount)
{
set_user_rendering(player,kRenderFxNone,0,0,0,kRenderTransAlpha,amount)
return PLUGIN_CONTINUE
}
static fx_blood_small(origin[3],num)
{
// Blood decals
#if CZERO
static const blood_small[8] = {202,203,204,205,206,207,208,209}
#else
static const blood_small[7] = {190,191,192,193,194,195,197}
#endif
// Small splash
for (new j = 0; j < num; j++) {
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
write_byte(TE_WORLDDECAL)
write_coord(origin[0]+random_num(-100,100))
write_coord(origin[1]+random_num(-100,100))
write_coord(origin[2]-36)
write_byte(blood_small[random_num(0,6)]) // index
message_end()
}
}
static fx_blood_large(origin[3],num)
{
// Blood decals
#if CZERO
static const blood_large[2] = {216,217}
#else
static const blood_large[2] = {204,205}
#endif
// Large splash
for (new i = 0; i < num; i++) {
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
write_byte(TE_WORLDDECAL)
write_coord(origin[0]+random_num(-50,50))
write_coord(origin[1]+random_num(-50,50))
write_coord(origin[2]-36)
write_byte(blood_large[random_num(0,1)]) // index
message_end()
}
}
static fx_gib_explode(origin[3],num)
{
new flesh[3], x, y, z
flesh[0] = mdl_gib_flesh
flesh[1] = mdl_gib_meat
flesh[2] = mdl_gib_legbone
// Gib explosion
// Head
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
write_byte(TE_MODEL)
write_coord(origin[0])
write_coord(origin[1])
write_coord(origin[2])
write_coord(random_num(-100,100))
write_coord(random_num(-100,100))
write_coord(random_num(100,200))
write_angle(random_num(0,360))
write_short(mdl_gib_head)
write_byte(0) // bounce
write_byte(500) // life
message_end()
// Spine
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
write_byte(TE_MODEL)
write_coord(origin[0])
write_coord(origin[1])
write_coord(origin[2])
write_coord(random_num(-100,100))
write_coord(random_num(-100,100))
write_coord(random_num(100,200))
write_angle(random_num(0,360))
write_short(mdl_gib_spine)
write_byte(0) // bounce
write_byte(500) // life
message_end()
// Lung
for(new i = 0; i < random_num(1,2); i++) {
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
write_byte(TE_MODEL)
write_coord(origin[0])
write_coord(origin[1])
write_coord(origin[2])
write_coord(random_num(-100,100))
write_coord(random_num(-100,100))
write_coord(random_num(100,200))
write_angle(random_num(0,360))
write_short(mdl_gib_lung)
write_byte(0) // bounce
write_byte(500) // life
message_end()
}
// Parts, 10 times
for(new i = 0; i < 10; i++) {
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
write_byte(TE_MODEL)
write_coord(origin[0])
write_coord(origin[1])
write_coord(origin[2])
write_coord(random_num(-100,100))
write_coord(random_num(-100,100))
write_coord(random_num(100,200))
write_angle(random_num(0,360))
write_short(flesh[random_num(0,2)])
write_byte(0) // bounce
write_byte(500) // life
message_end()
}
// Blood
for(new i = 0; i < num; i++) {
x = random_num(-100,100)
y = random_num(-100,100)
z = random_num(0,100)
for(new j = 0; j < 3; j++) {
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
write_byte(TE_BLOODSPRITE)
write_coord(origin[0]+(x*j))
write_coord(origin[1]+(y*j))
write_coord(origin[2]+(z*j))
write_short(spr_blood_spray)
write_short(spr_blood_drop)
write_byte(229) // color index
write_byte(15) // size
message_end()
}
}
}
Что нужно плагину , 2 этих инклюда обновил , плагин для 1.8.1 ??
В этой теме было размещено решение! Перейти к решению.
Download all Attachments
-
40.6 KB Просмотры: 616
-
13.8 KB Просмотры: 577