hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2025.07.04. 14:51



Jelenlévő felhasználók

Jelenleg 404 felhasználó van jelen :: 0 regisztrált, 0 rejtett és 404 vendég

A legtöbb felhasználó (2761 fő) 2025.01.09. 20:06-kor tartózkodott itt.

Regisztrált felhasználók: nincs regisztrált felhasználóaz elmúlt 5 percben aktív felhasználók alapján

Utoljára aktív
Ahhoz hogy lásd ki volt utoljára aktív, be kell jelentkezned.



Az oldal teljeskörű
használatához regisztrálj.

Regisztráció

Kereső


Új téma nyitása Hozzászólás a témához  [4 hozzászólás ] 
Szerző Üzenet
HozzászólásElküldve:2012.07.31. 02:43 
Offline
Őskövület
Avatar

Csatlakozott:2013.01.01. 17:48
Hozzászólások:2441
Megköszönt másnak: 18 alkalommal
Megköszönték neki: 21 alkalommal
Hellósztok!

Valaki kitudja nekem javítani ezt a plugin, úgy, hogy az "rpg" parancsra jöjjön elő, csak ct-knek lehessen hasznáni, és hogy néhány fegyvert áttesz bal kézbe, csak a kés van jobb kézben és nem értem miért. Azt tudom, hogy ebben a pluginban van a bal kezes hiba.

Kód:
  1. /* AMX Mod X script

  2.  

  3. :: Bazooka ::

  4.  

  5. !!IMPORTANT!!

  6. There is only ONE known bug:

  7. If you are user-guiding a rocket and the round ends before that rocket blows up,

  8. you will NOT be able to fire again unless you restart the plugin.

  9.  

  10. Commands:

  11.  

  12. amx_bazooka | spawn a bazooka in front of you (works in spectator mode too, admin only)

  13.  

  14. amx_bazooka_give <@all or name/id> <amount> | give someone a bazooka (admin only)

  15.  

  16. amx_bazooka_startround <mode restrictions> <round restart 1|0> | start the bazooka arena (admin only)

  17.  

  18. amx_bazooka_endarena <set ammo> | specify new ammo for everyonea nd end bazooka arena (set to -1 to leave everyone's ammo alone, admin only)

  19.  

  20. Say buybazooka in chat to open a buy menu. (everyone)

  21.  

  22. Say bazookahelp in chat to open the help file. (everyone)

  23.  

  24. Cvars:

  25.  

  26. amx_bazooka_dropping :: can a player drop his bazooka?? (default: 1)

  27.  

  28. amx_bazooka_ammo :: how much ammo has the bazooka?? (default: 3)

  29.  

  30. amx_bazooka_arena :: If set to 1 every player will recieve a bazooka with unlimited ammo

  31. at the start of the next round. While this mode is activated it requires

  32. a direct hit to kill someone. It is also advisable to restrict the other modes.

  33.  

  34. amx_bazooka_cost :: how much does the bazooka cost to buy it?? (default: 8000)

  35.  

  36. amx_bazooka_buyable :: is it possible to buy the bazooka?? (default: 1)

  37.  

  38. amx_bazooka_damageradius :: How big is the damage radius (default: 250)

  39.  

  40. amx_bazooka_maxdamage :: when you are in the center, how much HP do you loose?? (default: 150)

  41.  

  42. amx_bazooka_restrict :: resrict certain modes: a = Normal, b = Heat-Seeking, c = User-Guided

  43.  

  44. amx_bazooka_reloadtime :: how much time (in seconds) it takes to reload the bazooka (default: 2.5)

  45.  

  46. amx_bazooka_trailtime :: How long the bazooka trails stay in the air (best at 30)

  47.  

  48. amx_bazooka_velocity :: This only affects how fast the heat-seeking and normal rockets go (best at 700)

  49.  

  50. amx_bazooka_teamcolors :: set to 1 to use team colors (CT = blue, T = red) or set to anything else to have random colors

  51.  

  52. amx_bazooka_gib :: set to 1 to cause gib explosion if the damage is > 100 and also enough to kill the person

  53.  

  54. Special thanks to:

  55.  

  56. -=STN=- MaGe

  57. KaOs

  58. RadidEskimo

  59. Freecode

  60. EJL

  61. JTP10181

  62. PaintLancer

  63. Kaddar

  64. Vexd

  65. twistedeuphoria

  66. XxAvalanchexX

  67. pimp daddy

  68. Ronkkrop

  69. More for making the original bazooka plugin

  70. mike_cao for his awesome gore plugin

  71.  

  72. Notes:

  73. 1. From what i've tested on my server people seem to like team colors better than random colors.

  74. 2. I've bound some keys to bazooka arena like so:

  75. bind "PGDN" "amx_bazooka_arena 0;amx_bazooka_maxdamage 150;amx_bazooka_damageradius 250;amx_bazooka_restrict 1;sv_gravity 800;amx_say Bazooka Arena OFF"

  76. bind "PGUP" "amx_bazooka_arena 1;amx_bazooka_maxdamage 999999;amx_bazooka_damageradius 40;amx_bazooka_restrict 1;sv_gravity 150;amx_bazooka_give @all 1;amx_say Bazooka Arena ON;amx_say say 'bazookahelp' for more information on Bazookas"

  77. 3. When you have Bazooka arena enabled it's fun to change the reload times.

  78. Skill mode: reloadtime is 2.5

  79. Rapid Fire mode: reloadtime is 0

  80. This has gotten good feedback on my test server.

  81. 4. people are intrigued by a bazooka in CS 1.6, advertise this in your server name.

  82. */

  83.  

  84. // Set this value to 1 if you are using Condition Zero

  85. // I have NOT tested this plugin with CZ so I do not know if it will work

  86. #define CZERO 0

  87.  

  88. #inculde <amxmodx>

  89. #include <fakemeta>

  90. #include <engine>

  91. #include <fun>

  92. #include <cstrike>

  93. #include <amxmisc>

  94. #include <entity_maths> //this has the function for the "heat-seeking" rockets

  95.  

  96. #define TE_EXPLOSION            3

  97. #define TE_EXPLFLAG_NONE        0

  98. #define TE_SMOKE                5

  99. #define TE_BLOODSPRITE          115

  100. #define TE_BLOODSTREAM          101

  101. #define TE_MODEL                106

  102. #define TE_WORLDDECAL           116

  103. #define BA_NORMAL               (1<<0) // "a"

  104. #define BA_HEAT                 (1<<1) // "b"

  105. #define BA_USER                 (1<<2) // "c"

  106.  

  107. new g_sModelIndexFireball, g_sModelIndexSmoke, rocketsmoke

  108. new bool:CanShoot[32], Munni[32], mode[32], bool:allow_shooting, user_controll[32], bool:hasBazooka[32]

  109. 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

  110. new gHealthIndex[33], bool:cantplantbomb, bool:cantswitch, iFlags, modetext[64]

  111.  

  112. public plugin_init() {

  113.         register_plugin("BazookaAdvanced", "1.3", "Major Victory")

  114.         register_concmd("amx_bazooka", "drop_rpg", ADMIN_LEVEL_A)

  115.         register_concmd("amx_bazooka_give", "cmdBazooka_give", ADMIN_LEVEL_A, "<@all or name/id> <amount>")

  116.        

  117.         register_concmd("amx_bazooka_startarena", "cmdBazooka_StartArena", ADMIN_LEVEL_A, "<mode restrictions> <round restart 1|0>")

  118.         register_concmd("amx_bazooka_endarena", "cmdBazooka_EndArena", ADMIN_LEVEL_A, "<set ammo>")

  119.        

  120.         register_cvar("amx_bazooka_dropping", "1")// can a player drop a bazooka

  121.         register_cvar("amx_bazooka_ammo", "1")// how much ammo per bazooka

  122.         register_cvar("amx_bazooka_damageradius", "250")

  123.         register_cvar("amx_bazooka_maxdamage", "150")

  124.         register_cvar("amx_bazooka_cost", "2500")// how much one bazooka costs

  125.         register_cvar("amx_bazooka_arena", "0")// requires direct hit to kill

  126.         register_cvar("amx_bazooka_buyable", "1")//diasbles/enables the buy menu

  127.         register_cvar("amx_bazooka_restrict", "bc") // a = Normal | b = Heat-Seeking | c = User-Guided

  128.         register_cvar("amx_bazooka_reloadtime", "2.5")// in seconds

  129.         register_cvar("amx_bazooka_trailtime", "30")// roughly 3 seconds

  130.         register_cvar("amx_bazooka_velocity", "700")

  131.         register_cvar("amx_bazooka_teamcolors", "1")// set to 1 for team colored trails

  132.         register_cvar("amx_bazooka_gib", "1")// set to 1 for gib deaths (may cause lag on slower computers)

  133.        

  134.         register_clcmd("say", "handle_say")

  135.         register_clcmd("say_team", "handle_say")

  136.        

  137.         register_event("DeathMsg", "player_die", "a")

  138.         register_event("CurWeapon", "check_model", "be")

  139.         register_event("TextMsg", "bomb_msg", "b", "2=#C4_Plant_At_Bomb_Spot")

  140.         register_event("ResetHUD","event_respawn","be","1=1")  

  141.         register_logevent("round_end", 2, "1=Round_End")

  142.         register_logevent("round_start", 2, "1=Round_Start")

  143.        

  144.         register_clcmd("drop", "handle_drop")

  145.        

  146.         register_forward(FM_PlayerPreThink, "forward_playerprethink")

  147.         register_forward(FM_SetModel, "forward_setmodel")

  148.        

  149.         register_menu("Bazooka Menu", 1023, "do_bazookamenu")

  150.         register_logevent("bombplant",3,"2=Planted_The_Bomb")

  151. }

  152.  

  153. public plugin_precache() {

  154.         precache_model("models/rpgrocket.mdl")

  155.         precache_model("models/w_rpg.mdl")

  156.         precache_model("models/v_rpg.mdl")

  157.         precache_model("models/p_rpg.mdl")

  158.         precache_sound("weapons/rocketfire1.wav")

  159.         precache_sound("items/gunpickup4.wav")

  160.         precache_sound("weapons/nuke_fly.wav")// <-- this is the only non-game sound file, make sure you have it

  161.         precache_sound("weapons/dryfire1.wav")

  162.         spr_blood_drop = precache_model("sprites/blood.spr")

  163.         spr_blood_spray = precache_model("sprites/bloodspray.spr")

  164.         mdl_gib_flesh = precache_model("models/Fleshgibs.mdl")

  165.         mdl_gib_head = precache_model("models/GIB_Skull.mdl")

  166.         mdl_gib_legbone = precache_model("models/GIB_Legbone.mdl")

  167.         mdl_gib_lung = precache_model("models/GIB_Lung.mdl")

  168.         mdl_gib_meat = precache_model("models/GIB_B_Gib.mdl")

  169.         mdl_gib_spine = precache_model("models/GIB_B_Bone.mdl")

  170.         g_sModelIndexFireball = precache_model("sprites/zerogxplode.spr")

  171.         g_sModelIndexSmoke  = precache_model("sprites/steam1.spr")

  172.         rocketsmoke = precache_model("sprites/smoke.spr")

  173. }

  174.  

  175. public get_restrict_flags() {

  176.         new sFlags[24]

  177.         get_cvar_string("amx_bazooka_restrict",sFlags,24)

  178.         iFlags = read_flags(sFlags)

  179. }

  180.  

  181. public bomb_msg(id) {

  182.         if (cs_get_user_plant(id) != 1)

  183.                 client_print(id,print_center,"")

  184. }

  185.  

  186. public bombplant() {   

  187.         cantplantbomb = true

  188. }

  189.  

  190. public round_end() {

  191.         set_task(4.8, "round_prestart")

  192.         set_task(5.0, "player_spawn")

  193.         set_task(5.2, "bazooka_arena")

  194. }

  195.  

  196. public round_prestart() {

  197.         allow_shooting = false

  198.         cantplantbomb = true

  199.         cantswitch = true

  200. }

  201.  

  202. public round_start() {

  203.         allow_shooting = true

  204.         cantplantbomb = false

  205.         cantswitch = false

  206. }

  207.  

  208. public bazooka_arena(id) {

  209.         if (get_cvar_num("amx_bazooka_arena") == 1) {

  210.                 new players[32], count

  211.                 get_players(players, count)

  212.                 for (new i = 0; i < count; i++) {

  213.                         give_item(players[i], "weapon_c4")

  214.                         hasBazooka[players[i]] = true

  215.                         allow_shooting = true

  216.                         CanShoot[players[i]] = true

  217.                         cs_set_user_plant(players[i],0,0)

  218.                         console_cmd(id ,"amx_bazooka_damageradius 40")

  219.                         console_cmd(id ,"amx_bazooka_maxdamage 999999")

  220.                         client_print(players[i], print_chat, "[Bazooka] Bazooka Arena is ON! say ^"bazookahelp^" for more info")

  221.                         client_print(players[i], print_center, "Time to make things go BOOM!")

  222.                 }

  223.         }

  224.        

  225.         return PLUGIN_HANDLED

  226. }

  227.  

  228. public cmdBazooka_StartArena(id,level,cid) {

  229.         if (!cmd_access(id, level, cid, 3)) {

  230.                 return PLUGIN_HANDLED

  231.         }

  232.         new arg[6],arg2[2],argument2,players[32], count

  233.         read_argv(1,arg,5)

  234.         read_argv(2,arg2,1)

  235.         argument2 = str_to_num(arg2)

  236.         console_cmd(id, "amx_bazooka_arena 1")

  237.         console_cmd(id, "amx_bazooka_give @all 1")

  238.         console_cmd(id, "amx_bazooka_restrict %s",arg)

  239.         get_players(players, count)

  240.         for (new i = 0; i < count; i++) {

  241.                 ammo_hud(players[i], 0)

  242.                 ammo_hud(players[i], 1)

  243.                 emit_sound(players[i], CHAN_ITEM, "items/gunpickup2.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)  

  244.                 client_print(players[i], print_chat, "[Bazooka] Bazooka Arena has been turned ON")

  245.         }

  246.         if (argument2 == 1) {

  247.                 console_cmd(id, "sv_restartround 1")

  248.         }

  249.         return PLUGIN_HANDLED

  250. }

  251.  

  252. public cmdBazooka_EndArena(id,level,cid) {

  253.         if (!cmd_access(id, level, cid, 2)) {

  254.                 return PLUGIN_HANDLED

  255.         }

  256.         new arg[5],argument1,players[32], count

  257.         read_argv(1,arg,4)

  258.         argument1 = str_to_num(arg)

  259.         console_cmd(id, "amx_bazooka_arena 0")

  260.         if (argument1 >= 0) {

  261.                 get_players(players, count)

  262.                 for (new i = 0; i < count; i++) {

  263.                         Munni[players[i]] = argument1

  264.                         ammo_hud(players[i], 0)

  265.                         ammo_hud(players[i], 1)

  266.                         client_print(players[i], print_chat, "[Bazooka] Bazooka Arena has been turned OFF")

  267.                 }

  268.         }

  269.         return PLUGIN_HANDLED

  270. }

  271.  

  272. public fire_rocket(id) {

  273.         ammo_hud(id, 0)

  274.         ammo_hud(id, 1)

  275.         CanShoot[id] = false

  276.        

  277.         new data[1]

  278.         data[0] = id

  279.         new rtime = get_cvar_num("amx_bazooka_reloadtime")

  280.         if (cs_get_user_plant(id) != 1){

  281.                 set_task((rtime + 0.0), "rpg_reload", id+9477, data, 1)

  282.                 if ((Munni[id] <= 0) && (get_cvar_num("amx_bazooka_arena") != 1)) {

  283.                         emit_sound(id, CHAN_WEAPON, "weapons/dryfire1.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

  284.                         return PLUGIN_HANDLED

  285.                 }

  286.                 else{

  287.                         new Float:StartOrigin[3], Float:Angle[3]

  288.                        

  289.                         new PlayerOrigin[3]

  290.                         get_user_origin(id, PlayerOrigin, 1)

  291.                        

  292.                         StartOrigin[0] = float(PlayerOrigin[0])

  293.                         StartOrigin[1] = float(PlayerOrigin[1])

  294.                         StartOrigin[2] = float(PlayerOrigin[2])

  295.                        

  296.                         entity_get_vector(id, EV_VEC_v_angle, Angle)

  297.                         Angle[0] = Angle[0] * -1.0

  298.                         new RocketEnt = create_entity("info_target")

  299.                         entity_set_string(RocketEnt, EV_SZ_classname, "rpgrocket")

  300.                         entity_set_model(RocketEnt, "models/rpgrocket.mdl")

  301.                         entity_set_origin(RocketEnt, StartOrigin)

  302.                         entity_set_vector(RocketEnt, EV_VEC_angles, Angle)

  303.                        

  304.                         new Float:MinBox[3] = {-1.0, -1.0, -1.0}

  305.                         new Float:MaxBox[3] = {1.0, 1.0, 1.0}

  306.                         entity_set_vector(RocketEnt, EV_VEC_mins, MinBox)

  307.                         entity_set_vector(RocketEnt, EV_VEC_maxs, MaxBox)

  308.                        

  309.                         entity_set_int(RocketEnt, EV_INT_solid, 2)

  310.                         entity_set_int(RocketEnt, EV_INT_movetype, 5)

  311.                         entity_set_edict(RocketEnt, EV_ENT_owner, id)

  312.                        

  313.                         new Float:Velocity[3]

  314.                         new myvelocity = get_cvar_num("amx_bazooka_velocity")

  315.                         VelocityByAim(id, myvelocity, Velocity)

  316.                         entity_set_vector(RocketEnt, EV_VEC_velocity, Velocity)

  317.                        

  318.                         emit_sound(RocketEnt, CHAN_WEAPON, "weapons/rocketfire1.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

  319.                         emit_sound(RocketEnt, CHAN_VOICE, "weapons/nuke_fly.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

  320.                        

  321.                         if (get_cvar_num("amx_bazooka_arena") != 1) {

  322.                                 ammo_hud(id, 0)

  323.                                 Munni[id]--

  324.                                 ammo_hud(id, 1)

  325.                         }

  326.                         new CsTeams:iTeam =cs_get_user_team(id)

  327.                         new trailtime =get_cvar_num("amx_bazooka_trailtime")

  328.                         new colorr =random_num(0,255)

  329.                         new colorg =random_num(0,255)

  330.                         new colorb =random_num(0,255)

  331.                         if (get_cvar_num("amx_bazooka_teamcolors") == 1) {

  332.                                 switch(iTeam) {

  333.                                         case CS_TEAM_T: { //if team T color=red

  334.                                                 message_begin(MSG_BROADCAST, SVC_TEMPENTITY)

  335.                                                 write_byte(22)

  336.                                                 write_short(RocketEnt)

  337.                                                 write_short(rocketsmoke)

  338.                                                 write_byte(trailtime)

  339.                                                 write_byte(3)

  340.                                                 write_byte(255)

  341.                                                 write_byte(0)

  342.                                                 write_byte(0)

  343.                                                 write_byte(255)

  344.                                                 message_end()

  345.                                         }

  346.                                         case CS_TEAM_CT: { // if team CT color=blue

  347.                                                 message_begin(MSG_BROADCAST, SVC_TEMPENTITY)

  348.                                                 write_byte(22)

  349.                                                 write_short(RocketEnt)

  350.                                                 write_short(rocketsmoke)

  351.                                                 write_byte(trailtime)

  352.                                                 write_byte(3)

  353.                                                 write_byte(0)

  354.                                                 write_byte(0)

  355.                                                 write_byte(255)

  356.                                                 write_byte(255)

  357.                                                 message_end()

  358.                                         }

  359.                                 }

  360.                         }

  361.                         else { // random colors anyone?

  362.                                 message_begin(MSG_BROADCAST, SVC_TEMPENTITY)

  363.                                 write_byte(22)

  364.                                 write_short(RocketEnt)

  365.                                 write_short(rocketsmoke)

  366.                                 write_byte(trailtime)

  367.                                 write_byte(3)

  368.                                 write_byte(colorr)

  369.                                 write_byte(colorg)

  370.                                 write_byte(colorb)

  371.                                 write_byte(255)

  372.                                 message_end()

  373.                         }

  374.                        

  375.                         if (mode[id] == 2) {

  376.                                 new info[1]

  377.                                 info[0] = RocketEnt

  378.                                 set_task(1.0, "find_and_follow", 0, info, 1)

  379.                         }

  380.                         else if (mode[id] == 3) {

  381.                                 entity_set_int(RocketEnt, EV_INT_rendermode, 1)

  382.                                 attach_view(id, RocketEnt)

  383.                                 user_controll[id] = RocketEnt

  384.                         }

  385.                         return PLUGIN_HANDLED

  386.                 }

  387.                 return PLUGIN_HANDLED

  388.         }

  389.         return PLUGIN_HANDLED

  390. }

  391.  

  392. public rpg_reload(data[]) {

  393.         CanShoot[data[0]] = true

  394. }

  395.  

  396. public find_and_follow(info[]) {

  397.         new RocketEnt = info[0]

  398.         new Float:shortestDist = 10000.0

  399.         new nearestPlayer = 0

  400.        

  401.         if (is_valid_ent(RocketEnt)) {

  402.                 new players[32], count

  403.                 get_players(players, count)

  404.                 for (new i = 0; i < count; i++) {

  405.                         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)))) {

  406.                                 new Float:PlayerOrigin[3], Float:RocketOrigin[3]

  407.                                 entity_get_vector(players[i], EV_VEC_origin, PlayerOrigin)

  408.                                 entity_get_vector(RocketEnt, EV_VEC_origin, RocketOrigin)

  409.                                

  410.                                 new Float:distance = vector_distance(PlayerOrigin, RocketOrigin)

  411.                                

  412.                                 if (distance <= shortestDist) {

  413.                                         shortestDist = distance

  414.                                         nearestPlayer = players[i]

  415.                                 }

  416.                         }

  417.                 }

  418.         }

  419.        

  420.         if (nearestPlayer > 0) {

  421.                 new data[2]

  422.                 data[0] = RocketEnt

  423.                 data[1] = nearestPlayer

  424.                 set_task(0.1, "follow_and_catch", RocketEnt, data, 2, "b")

  425.         }

  426.         else {

  427.                 pfn_touch(RocketEnt, 0)

  428.         }

  429. }

  430.  

  431. public follow_and_catch(data[]) {

  432.         new RocketEnt = data[0]

  433.         new target = data[1]

  434.         new myvelocity = get_cvar_num("amx_bazooka_velocity")

  435.        

  436.         if (is_user_alive(target) && is_valid_ent(RocketEnt)) {

  437.                 entity_set_follow(RocketEnt, target, (myvelocity+0.0))

  438.                

  439.                 new Float:Velocity[3]

  440.                 new Float:NewAngle[3]

  441.                 entity_get_vector(RocketEnt, EV_VEC_velocity, Velocity)

  442.                 vector_to_angle(Velocity, NewAngle)

  443.                 entity_set_vector(RocketEnt, EV_VEC_angles, NewAngle)

  444.         }

  445.         else {

  446.                 remove_task(RocketEnt)

  447.                 new info[1]

  448.                 info[0] = RocketEnt

  449.                 set_task(0.1, "find_and_follow", 0, data, 1)

  450.         }

  451. }

  452.  

  453. public pfn_touch(ptr, ptd) {

  454.         new ClassName[32]

  455.         new ClassNameptd[32]

  456.         if ((ptr > 0) && is_valid_ent(ptr)) {

  457.                 entity_get_string(ptr, EV_SZ_classname, ClassName, 31)

  458.         }

  459.         if ((ptd > 0) && is_valid_ent(ptd)) {

  460.                 entity_get_string(ptd, EV_SZ_classname, ClassNameptd, 31)

  461.         }

  462.         if (equal(ClassName, "rpgrocket")) {

  463.                 if (equal(ClassNameptd, "func_breakable")) {

  464.                         force_use(ptr,ptd)

  465.                         remove_task(ptr)

  466.                 }

  467.                 remove_task(ptr)

  468.                 new Float:EndOrigin[3]

  469.                 entity_get_vector(ptr, EV_VEC_origin, EndOrigin)

  470.                

  471.                 message_begin( MSG_BROADCAST, SVC_TEMPENTITY)  // Explosion

  472.                 write_byte(TE_EXPLOSION)

  473.                 write_coord(floatround(EndOrigin[0]))

  474.                 write_coord(floatround(EndOrigin[1]))

  475.                 write_coord(floatround(EndOrigin[2])+5)

  476.                 write_short(g_sModelIndexFireball)

  477.                 write_byte(random_num(0,20) + 20)

  478.                 write_byte(12) // framerate

  479.                 write_byte(TE_EXPLFLAG_NONE)

  480.                 message_end()

  481.                

  482.                 message_begin(MSG_BROADCAST, SVC_TEMPENTITY)  // Smoke

  483.                 write_byte(TE_SMOKE)

  484.                 write_coord(floatround(EndOrigin[0]))

  485.                 write_coord(floatround(EndOrigin[1]))

  486.                 write_coord(floatround(EndOrigin[2])+15)

  487.                 write_short(g_sModelIndexSmoke)

  488.                 write_byte(60)

  489.                 write_byte(10)

  490.                 message_end()

  491.                 new maxdamage = get_cvar_num("amx_bazooka_maxdamage")

  492.                 new damageradius = get_cvar_num("amx_bazooka_damageradius")

  493.                

  494.                 new PlayerPos[3], distance, damage

  495.                 for (new i = 1; i < 32; i++) {

  496.                         if (is_user_alive(i) == 1) {

  497.                                 get_user_origin(i, PlayerPos)

  498.                                

  499.                                 new NonFloatEndOrigin[3]

  500.                                 NonFloatEndOrigin[0] = floatround(EndOrigin[0])

  501.                                 NonFloatEndOrigin[1] = floatround(EndOrigin[1])

  502.                                 NonFloatEndOrigin[2] = floatround(EndOrigin[2])

  503.                                

  504.                                 distance = get_distance(PlayerPos, NonFloatEndOrigin)

  505.                                 if (distance <= damageradius) {  // Screenshake Radius

  506.                                         message_begin(MSG_ONE, get_user_msgid("ScreenShake"), {0,0,0}, i)  // Shake Screen

  507.                                         write_short(1<<14)

  508.                                         write_short(1<<14)

  509.                                         write_short(1<<14)

  510.                                         message_end()

  511.                                        

  512.                                         damage = maxdamage - floatround(floatmul(float(maxdamage), floatdiv(float(distance), float(damageradius))))

  513.                                         new attacker = entity_get_edict(ptr, EV_ENT_owner)

  514.                                        

  515.                                         if (!get_user_godmode(i)) {

  516.                                                

  517.                                                 if (get_user_team(attacker) != get_user_team(i)) {

  518.                                                        

  519.                                                         if (damage < get_user_health(i)) {

  520.                                                                 set_user_health(i, get_user_health(i) - damage)

  521.                                                         }

  522.                                                         else {

  523.                                                                 set_msg_block(get_user_msgid("DeathMsg"), BLOCK_SET)

  524.                                                                 user_kill(i, 1)

  525.                                                                 set_msg_block(get_user_msgid("DeathMsg"), BLOCK_NOT)

  526.                                                                

  527.                                                                 message_begin(MSG_BROADCAST, get_user_msgid("DeathMsg"))  // Kill-Log oben rechts

  528.                                                                 write_byte(attacker)  // Attacker

  529.                                                                 write_byte(i)  // Victim

  530.                                                                 write_byte(0)  // Headshot

  531.                                                                 write_string("bazooka")

  532.                                                                 message_end()

  533.                                                                 if (damage > 100 && get_cvar_num("amx_bazooka_gib") == 1) { //begin gibs and effects (made by mike_cao)

  534.                                                                         new iOrigin[3]

  535.                                                                         get_user_origin(i,iOrigin) // Effects

  536.                                                                         fx_trans(i,0)

  537.                                                                         fx_gib_explode(iOrigin,3)

  538.                                                                         fx_blood_large(iOrigin,5)

  539.                                                                         fx_blood_small(iOrigin,15)

  540.                                                                         iOrigin[2] = iOrigin[2]-20 // Hide body

  541.                                                                         set_user_origin(i,iOrigin)

  542.                                                                 } //end gibs and effects

  543.                                                                 set_user_frags(attacker, get_user_frags(attacker) + 1)

  544.                                                                 if (get_cvar_num("amx_bazooka_gib") == 1) {

  545.                                                                         client_print(attacker, print_center, "LOLERS! You just splattered that guy's guts everywhere!")

  546.                                                                 }

  547.                                                                

  548.                                                         }

  549.                                                 }

  550.                                                 if (get_user_team(attacker) == get_user_team(i)) {

  551.                                                        

  552.                                                         if (attacker == i) {

  553.                                                                

  554.                                                                 if (damage < get_user_health(i)) {

  555.                                                                         set_user_health(i, get_user_health(i) - damage)

  556.                                                                 }

  557.                                                                 else {

  558.                                                                         set_msg_block(get_user_msgid("DeathMsg"), BLOCK_SET)

  559.                                                                         user_kill(i, 1)

  560.                                                                         set_msg_block(get_user_msgid("DeathMsg"), BLOCK_NOT)

  561.                                                                        

  562.                                                                         message_begin(MSG_BROADCAST, get_user_msgid("DeathMsg")) // Kill-Log oben rechts

  563.                                                                         write_byte(attacker)  // Attacker

  564.                                                                         write_byte(i)  // Victim

  565.                                                                         write_byte(0)  // Headshot

  566.                                                                         write_string("bazooka")

  567.                                                                         message_end()

  568.                                                                         if ((damage > 100) && get_cvar_num("amx_bazooka_gib") == 1) { //begin gibs and effects (made by mike_cao)

  569.                                                                                 new iOrigin[3]

  570.                                                                                 get_user_origin(i,iOrigin)// Effects

  571.                                                                                 fx_trans(i,0)

  572.                                                                                 fx_gib_explode(iOrigin,3)

  573.                                                                                 fx_blood_large(iOrigin,5)

  574.                                                                                 fx_blood_small(iOrigin,15)

  575.                                                                                 iOrigin[2] = iOrigin[2]-20 // Hide body

  576.                                                                                 set_user_origin(i,iOrigin)

  577.                                                                         } //end gibs and effects

  578.                                                                         set_user_frags(attacker, get_user_frags(attacker) - 1)

  579.                                                                         if (get_cvar_num("amx_bazooka_gib") == 1){

  580.                                                                                 client_print(attacker, print_center, "Great! Now everyone knows what you had for supper!")

  581.                                                                         }

  582.                                                                         else {

  583.                                                                                 client_print(attacker, print_center, "You do know this thing explodes right?")

  584.                                                                         }

  585.                                                                        

  586.                                                                 }

  587.                                                         }

  588.                                                         else {

  589.                                                                 if (get_cvar_num("mp_friendlyfire")) {

  590.                                                                         if (damage < get_user_health(i)) {

  591.                                                                                 set_user_health(i, get_user_health(i) - damage)

  592.                                                                                 client_print(attacker, print_center, "You injured a teammate! Watch your aim!")

  593.                                                                         }

  594.                                                                         else {

  595.                                                                                 set_msg_block(get_user_msgid("DeathMsg"), BLOCK_SET)

  596.                                                                                 user_kill(i, 1)

  597.                                                                                 set_msg_block(get_user_msgid("DeathMsg"), BLOCK_NOT)

  598.                                                                                

  599.                                                                                 message_begin(MSG_BROADCAST, get_user_msgid("DeathMsg"))  // Kill-Log oben rechts

  600.                                                                                 write_byte(attacker)  // Attacker                                                                               write_byte(i)  // Victim

  601.                                                                                 write_byte(0)  // Headshot

  602.                                                                                 write_string("bazooka")

  603.                                                                                 message_end()

  604.                                                                                 if (damage > 100 && get_cvar_num("amx_bazooka_gib") == 1) { //begin gibs and effects (made by mike_cao)

  605.                                                                                         new iOrigin[3]

  606.                                                                                         get_user_origin(i,iOrigin)// Effects

  607.                                                                                         fx_trans(i,0)

  608.                                                                                         fx_gib_explode(iOrigin,3)

  609.                                                                                         fx_blood_large(iOrigin,5)

  610.                                                                                         fx_blood_small(iOrigin,15)

  611.                                                                                         iOrigin[2] = iOrigin[2]-20 // Hide body

  612.                                                                                         set_user_origin(i,iOrigin)

  613.                                                                                 } //end gibs and effects

  614.                                                                                 set_user_frags(attacker, get_user_frags(attacker) - 1)

  615.                                                                                 if (get_cvar_num("amx_bazooka_gib") == 1){

  616.                                                                                         client_print(attacker, print_center, "OMFG's!! You just splattered a teammate!")

  617.                                                                                 }

  618.                                                                                 else{

  619.                                                                                         client_print(attacker, print_center, "LOL! That teammate is probably not too happy now!")

  620.                                                                                 }

  621.                                                                         }

  622.                                                                 }

  623.                                                         }

  624.                                                 }

  625.                                         }

  626.                                 }

  627.                         }

  628.                 }

  629.                 attach_view(entity_get_edict(ptr, EV_ENT_owner), entity_get_edict(ptr, EV_ENT_owner))

  630.                 user_controll[entity_get_edict(ptr, EV_ENT_owner)] = 0

  631.                 remove_entity(ptr)

  632.         }

  633.        

  634.        

  635.         if (equal(ClassName, "rpg") || equal(ClassName, "rpg_temp")) {

  636.                 new Picker[32]

  637.                 if ((ptd > 0) && is_valid_ent(ptd)) {

  638.                         entity_get_string(ptd, EV_SZ_classname, Picker, 31)

  639.                 }

  640.                 if (equal(Picker, "player")) {

  641.                         give_item(ptd, "weapon_c4")

  642.                         hasBazooka[ptd] = true

  643.                         Munni[ptd] = Munni[ptd] + entity_get_int(ptr, EV_INT_iuser1)

  644.                         client_print(ptd, print_chat, "[Bazooka] You have picked up a bazooka!")

  645.                         ammo_hud(ptd, 0)

  646.                         ammo_hud(ptd, 1)

  647.                         emit_sound(ptd, CHAN_WEAPON, "items/gunpickup2.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

  648.                         remove_entity(ptr)

  649.                 }

  650.         }

  651. }

  652.  

  653. public drop_rpg(id, level, cid) {

  654.         if (!cmd_access(id, level, cid, 1)) {

  655.                 return PLUGIN_HANDLED

  656.         }      

  657.         new Float:PlayerOrigin[3], Float:End[3], Float:Return[3], Float:TraceDirection[3]

  658.         entity_get_vector(id, EV_VEC_origin, PlayerOrigin)

  659.         VelocityByAim(id, 64, TraceDirection)

  660.        

  661.         End[0] = TraceDirection[0] + PlayerOrigin[0]

  662.         End[1] = TraceDirection[1] + PlayerOrigin[1]

  663.         End[2] = TraceDirection[2] + PlayerOrigin[2]

  664.        

  665.         trace_line(id, PlayerOrigin, End, Return)

  666.         Return[2] = PlayerOrigin[2]

  667.        

  668.         new RPG = create_entity("info_target")

  669.         entity_set_string(RPG, EV_SZ_classname, "rpg")

  670.         entity_set_model(RPG, "models/w_rpg.mdl")

  671.         entity_set_origin(RPG, Return)

  672.        

  673.         new Float:MinBox[3] = {-16.0, -16.0, 0.0}

  674.         new Float:MaxBox[3] = {16.0, 16.0, 16.0}

  675.         entity_set_vector(RPG, EV_VEC_mins, MinBox)

  676.         entity_set_vector(RPG, EV_VEC_maxs, MaxBox)

  677.        

  678.         entity_set_int(RPG, EV_INT_solid, 1)

  679.         entity_set_int(RPG, EV_INT_movetype, 6)

  680.        

  681.         entity_set_int(RPG, EV_INT_iuser1, get_cvar_num("amx_bazooka_ammo"))

  682.        

  683.         return PLUGIN_HANDLED

  684. }

  685.  

  686. public client_PreThink(id) {

  687.         if (is_user_alive(id)) {

  688.                 new weaponid, clip, ammo

  689.                 weaponid = get_user_weapon(id, clip, ammo)

  690.                 if ((weaponid == CSW_C4) && hasBazooka[id]) {

  691.                         new attack = get_user_button(id) & IN_ATTACK

  692.                         new oldattack = get_user_oldbutton(id) & IN_ATTACK

  693.                         new attack2 = get_user_button(id) & IN_ATTACK2

  694.                         new oldattack2 = get_user_oldbutton(id) & IN_ATTACK2

  695.                         new CsTeams:iTeam =cs_get_user_team(id)

  696.                         if (attack && !oldattack  && (cs_get_user_plant(id) != 1)) {

  697.                                 get_restrict_flags()

  698.                                 if (mode[id] != 1 && ((iFlags&BA_USER) || (iFlags&BA_HEAT))) {

  699.                                         mode[id] = 1

  700.                                         if (CanShoot[id] && allow_shooting && (user_controll[id] == 0)) {

  701.                                                 fire_rocket(id)

  702.                                         }

  703.                                 }

  704.                                 else {

  705.                                         if (CanShoot[id] && allow_shooting && (user_controll[id] == 0)) {

  706.                                                 fire_rocket(id)

  707.                                         }

  708.                                 }

  709.                                

  710.                         }

  711.                         else if (attack2 && !oldattack2) {

  712.                                 switch(mode[id]) {

  713.                                         case 1: {

  714.                                                 get_restrict_flags()

  715.                                                 if ((iFlags&BA_HEAT) != BA_HEAT) {

  716.                                                         mode[id] = 2

  717.                                                         modetext = "Heat-Seeking"

  718.                                                         ammo_hud(id, 0)

  719.                                                         ammo_hud(id, 1)

  720.                                                         check_model(id)

  721.                                                         emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

  722.                                                         emit_sound(id, CHAN_WEAPON, "items/nvg_on.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

  723.                                                         client_print(id, print_center, "Heat-Seeking Mode")

  724.                                                 }

  725.                                                 else if ((iFlags&BA_USER) != BA_USER) {

  726.                                                         mode[id] = 3

  727.                                                         modetext = "User-Guided"

  728.                                                         ammo_hud(id, 0)

  729.                                                         ammo_hud(id, 1)

  730.                                                         check_model(id)

  731.                                                         emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

  732.                                                         emit_sound(id, CHAN_WEAPON, "items/gunpickup4.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

  733.                                                         client_print(id, print_center, "User-Guided Mode")

  734.                                                 }

  735.                                                 else {

  736.                                                         if (!cantplantbomb && !cantswitch && iTeam&CS_TEAM_T) {

  737.                                                                 cantswitch = true

  738.                                                                 mode[id] = 4

  739.                                                                 modetext = "C4"                                                

  740.                                                                 ammo_hud(id, 0)

  741.                                                                 ammo_hud(id, 1)

  742.                                                                 cs_set_user_plant(id,1,1)

  743.                                                                 check_model(id)

  744.                                                                 emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

  745.                                                                 client_print(id, print_center, "Switching to C4 Bomb")

  746.                                                         }

  747.                                                         else if (cantplantbomb || cantswitch || iTeam&CS_TEAM_CT){

  748.                                                                 mode[id] = 1

  749.                                                                 modetext = "Bazooka"

  750.                                                                 ammo_hud(id, 0)

  751.                                                                 ammo_hud(id, 1)

  752.                                                                 check_model(id)

  753.                                                                 emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

  754.                                                                 client_print(id, print_center, "The other modes are restricted")

  755.                                                         }

  756.                                                 }

  757.                                         }

  758.                                         case 2: {

  759.                                                 get_restrict_flags()

  760.                                                 if ((iFlags&BA_USER) != BA_USER) {

  761.                                                         mode[id] = 3

  762.                                                         modetext = "User-Guided"

  763.                                                         ammo_hud(id, 0)

  764.                                                         ammo_hud(id, 1)

  765.                                                         check_model(id)

  766.                                                         emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

  767.                                                         emit_sound(id, CHAN_WEAPON, "items/gunpickup4.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

  768.                                                         client_print(id, print_center, "User-Guided Mode")

  769.                                                 }

  770.                                                 else if (iFlags&BA_USER && ((iFlags&BA_NORMAL) != BA_NORMAL)) {

  771.                                                         if (!cantplantbomb && !cantswitch && iTeam&CS_TEAM_T) {

  772.                                                                 cantswitch = true

  773.                                                                 mode[id] = 4

  774.                                                                 modetext = "C4"

  775.                                                                 ammo_hud(id, 0)

  776.                                                                 ammo_hud(id, 1)

  777.                                                                 cs_set_user_plant(id,1,1)

  778.                                                                 check_model(id)

  779.                                                                 emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

  780.                                                                 client_print(id, print_center, "Switching to C4 Bomb")

  781.                                                         }

  782.                                                         else if (cantplantbomb || cantswitch || iTeam&CS_TEAM_CT){

  783.                                                                 mode[id] = 1

  784.                                                                 modetext = "Bazooka"

  785.                                                                 ammo_hud(id, 0)

  786.                                                                 ammo_hud(id, 1)

  787.                                                                 check_model(id)

  788.                                                                 emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

  789.                                                                 client_print(id, print_center, "Normal Mode")

  790.                                                         }

  791.                                                 }

  792.                                                 else {

  793.                                                         mode[id] = 2

  794.                                                         modetext = "Heat-Seeking"

  795.                                                         ammo_hud(id, 0)

  796.                                                         ammo_hud(id, 1)

  797.                                                         check_model(id)

  798.                                                         emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

  799.                                                         client_print(id, print_center, "The other modes are restricted")

  800.                                                 }

  801.                                         }

  802.                                         case 3: {

  803.                                                 get_restrict_flags()

  804.                                                 if ((iFlags&BA_NORMAL) != BA_NORMAL) {

  805.                                                         if (!cantplantbomb && !cantswitch && iTeam&CS_TEAM_T) {

  806.                                                                 cantswitch = true

  807.                                                                 mode[id] = 4

  808.                                                                 modetext = "C4"

  809.                                                                 ammo_hud(id, 0)

  810.                                                                 ammo_hud(id, 1)

  811.                                                                 cs_set_user_plant(id,1,1)

  812.                                                                 check_model(id)

  813.                                                                 emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

  814.                                                                 client_print(id, print_center, "Switching to C4 Bomb")

  815.                                                         }

  816.                                                         else if (cantplantbomb || cantswitch || iTeam&CS_TEAM_CT){

  817.                                                                 mode[id] = 1

  818.                                                                 modetext = "Bazooka"

  819.                                                                 ammo_hud(id, 0)

  820.                                                                 ammo_hud(id, 1)

  821.                                                                 check_model(id)

  822.                                                                 emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

  823.                                                                 client_print(id, print_center, "Normal Mode")

  824.                                                         }

  825.                                                 }

  826.                                                 else if ((iFlags&BA_HEAT) != BA_HEAT){

  827.                                                         mode[id] = 2

  828.                                                         modetext = "Heat-Seeking"

  829.                                                         ammo_hud(id, 0)

  830.                                                         ammo_hud(id, 1)

  831.                                                         check_model(id)

  832.                                                         emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

  833.                                                         emit_sound(id, CHAN_WEAPON, "items/nvg_on.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

  834.                                                         client_print(id, print_center, "Heat-Seeking Mode")

  835.                                                 }

  836.                                                 else {

  837.                                                         mode[id] = 3

  838.                                                         modetext = "User-Guided"

  839.                                                         ammo_hud(id, 0)

  840.                                                         ammo_hud(id, 1)

  841.                                                         check_model(id)

  842.                                                         emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

  843.                                                         client_print(id, print_center, "The other modes are restricted")

  844.                                                 }

  845.                                         }

  846.                                         case 4: {

  847.                                                 get_restrict_flags()

  848.                                                 if ((iFlags&BA_NORMAL) != BA_NORMAL) {

  849.                                                         cantswitch = false

  850.                                                         mode[id] = 1

  851.                                                         modetext = "Bazooka"

  852.                                                         ammo_hud(id, 0)

  853.                                                         ammo_hud(id, 1)

  854.                                                         cs_set_user_plant(id,0,0)

  855.                                                         check_model(id)

  856.                                                         emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

  857.                                                         client_print(id, print_center, "Switching to Bazooka") 

  858.                                                 }

  859.                                                 else if ((iFlags&BA_HEAT) != BA_HEAT) {

  860.                                                         cantswitch = false

  861.                                                         mode[id] = 2

  862.                                                         modetext = "Heat-Seeking"

  863.                                                         ammo_hud(id, 0)

  864.                                                         ammo_hud(id, 1)

  865.                                                         cs_set_user_plant(id,0,0)

  866.                                                         check_model(id)

  867.                                                         emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

  868.                                                         emit_sound(id, CHAN_WEAPON, "items/nvg_on.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

  869.                                                         client_print(id, print_center, "Heat-Seeking Mode")

  870.                                                 }

  871.                                                 else if ((iFlags&BA_USER) != BA_USER) {

  872.                                                         cantswitch = false

  873.                                                         mode[id] = 3

  874.                                                         modetext = "User-Guided"

  875.                                                         ammo_hud(id, 0)

  876.                                                         ammo_hud(id, 1)

  877.                                                         cs_set_user_plant(id,0,0)

  878.                                                         check_model(id)

  879.                                                         emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

  880.                                                         emit_sound(id, CHAN_WEAPON, "items/gunpickup4.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

  881.                                                         client_print(id, print_center, "User-Guided Mode")

  882.                                                 }

  883.                                                 else {

  884.                                                         cantswitch = true

  885.                                                         mode[id] = 4

  886.                                                         modetext = "C4"

  887.                                                         ammo_hud(id, 0)

  888.                                                         ammo_hud(id, 1)

  889.                                                         cs_set_user_plant(id,1,1)

  890.                                                         check_model(id)

  891.                                                         emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

  892.                                                         client_print(id, print_center, "The other modes are restricted")

  893.                                                 }

  894.                                         }

  895.                                 }

  896.                         }

  897.                 }      

  898.         }      

  899.         if (user_controll[id] > 0) {

  900.                 new RocketEnt = user_controll[id]

  901.                 if (is_valid_ent(RocketEnt)) {

  902.                         new Float:Velocity[3]

  903.                         VelocityByAim(id, 500, Velocity)

  904.                         entity_set_vector(RocketEnt, EV_VEC_velocity, Velocity)

  905.                         new Float:NewAngle[3]

  906.                         entity_get_vector(id, EV_VEC_v_angle, NewAngle)

  907.                         entity_set_vector(RocketEnt, EV_VEC_angles, NewAngle)

  908.                 }

  909.                 else {

  910.                         attach_view(id, id)

  911.                 }

  912.         }

  913.         return FMRES_IGNORED

  914. }

  915.  

  916. public forward_setmodel(entity, model[]) {

  917.         if (!is_valid_ent(entity)) {

  918.                 return FMRES_IGNORED

  919.         }

  920.         if (equal(model, "models/w_backpack.mdl")) {

  921.                 client_print(0, print_center, "")

  922.                 new ClassName[32]

  923.                 entity_get_string(entity, EV_SZ_classname, ClassName, 31)

  924.                

  925.                 if (equal(ClassName, "weaponbox")) {

  926.                        

  927.                         remove_entity(entity)

  928.                        

  929.                         return FMRES_SUPERCEDE

  930.                 }

  931.         }

  932.         return FMRES_IGNORED

  933. }

  934.  

  935. public check_model(id) {

  936.         new weaponid, clip, ammo

  937.         weaponid = get_user_weapon(id, clip, ammo)

  938.         if ((weaponid == CSW_C4) && (cs_get_user_plant(id) != 1) && (mode[id] != 4)) {

  939.                 ammo_hud(id, 0)

  940.                 ammo_hud(id, 1)

  941.                 entity_set_string(id, EV_SZ_viewmodel, "models/v_rpg.mdl")

  942.                 entity_set_string(id, EV_SZ_weaponmodel, "models/p_rpg.mdl")

  943.         }

  944.         else if ((weaponid == CSW_C4) && (cs_get_user_plant(id) == 1) && (mode[id] == 4)) {

  945.                 ammo_hud(id, 0)

  946.                 ammo_hud(id, 1)

  947.                 entity_set_string(id, EV_SZ_viewmodel, "models/v_c4.mdl")

  948.                 entity_set_string(id, EV_SZ_weaponmodel, "models/p_c4.mdl")

  949.         }

  950.         return PLUGIN_HANDLED

  951. }

  952.  

  953. public client_connect(id) {

  954.         CanShoot[id] = true

  955.         Munni[id] = 0

  956.         mode[id] = 1

  957.         hasBazooka[id] = false

  958. }

  959.  

  960. ammo_hud(id, show) {

  961.         new AmmoHud[65]

  962.         if (get_cvar_num("amx_bazooka_arena") == 1) {

  963.                 format(AmmoHud, 64, "Rockets: Infinite | Mode: %s",modetext)

  964.         }

  965.         else {

  966.                 format(AmmoHud, 64, "Rockets: %i | Mode: %s", Munni[id],modetext)

  967.         }

  968.        

  969.         if (show) {

  970.                 message_begin(MSG_ONE, get_user_msgid("StatusText"), {0,0,0}, id)

  971.                 write_byte(0)

  972.                 write_string(AmmoHud)

  973.                 message_end()

  974.         }

  975.         else {

  976.                 message_begin(MSG_ONE, get_user_msgid("StatusText"), {0,0,0}, id)

  977.                 write_byte(0)

  978.                 write_string("")

  979.                 message_end()

  980.         }

  981. }

  982.  

  983. public player_die(id) {

  984.        

  985.         new victim

  986.         victim = read_data(2)

  987.         ammo_hud(victim, 0)

  988.         Munni[victim] = 0

  989.         hasBazooka[victim] = false

  990.         if ((cs_get_user_plant(victim) == 1) || cantswitch) {

  991.                 cs_set_user_plant(victim,0,0)

  992.                 cantswitch  = false

  993.         }

  994. }

  995.  

  996. public player_spawn() {

  997.         new players[32], count

  998.         get_players(players, count)

  999.         for (new i = 0; i < count; i++) {

  1000.                 if (is_user_alive(players[i])) {

  1001.                         new v_oldmodel[64], p_oldmodel[64]

  1002.                         entity_get_string(players[i], EV_SZ_viewmodel, v_oldmodel, 63)

  1003.                         entity_get_string(players[i], EV_SZ_weaponmodel, p_oldmodel, 63)

  1004.                         if (equal(v_oldmodel, "models/v_rpg.mdl") || equal(p_oldmodel, "models/p_rpg.mdl")) {

  1005.                                 if (!hasBazooka[players[i]]) {

  1006.                                         new weaponid, clip, ammo

  1007.                                         weaponid = get_user_weapon(players[i], clip, ammo)

  1008.                                        

  1009.                                         new weaponname[64]

  1010.                                         get_weaponname(weaponid, weaponname, 63)

  1011.                                        

  1012.                                         new v_model[64], p_model[64]

  1013.                                         format(v_model, 63, "%s", weaponname)

  1014.                                         format(p_model, 63, "%s", weaponname)

  1015.                                        

  1016.                                         replace(v_model, 63, "weapon_", "v_")

  1017.                                         format(v_model, 63, "models/%s.mdl", v_model)

  1018.                                         entity_set_string(players[i], EV_SZ_viewmodel, v_model)

  1019.                                        

  1020.                                         replace(p_model, 63, "weapon_", "p_")

  1021.                                         format(p_model, 63, "models/%s.mdl", p_model)

  1022.                                         entity_set_string(players[i], EV_SZ_weaponmodel, p_model)

  1023.                                 }

  1024.                         }

  1025.                 }

  1026.         }

  1027.        

  1028.         new TempRocket = find_ent_by_class(-1, "rpgrocket")

  1029.         while (TempRocket > 0) {

  1030.                 remove_entity(TempRocket)

  1031.                 TempRocket = find_ent_by_class(TempRocket, "rpgrocket")

  1032.         }

  1033.        

  1034.         new TempRPG = find_ent_by_class(-1, "rpg_temp")

  1035.         while (TempRPG > 0) {

  1036.                 remove_entity(TempRPG)

  1037.                 TempRPG = find_ent_by_class(TempRPG, "rpg_temp")

  1038.         }

  1039.        

  1040.         return PLUGIN_HANDLED

  1041. }

  1042.  

  1043. public handle_drop(id) {

  1044.         if (read_argc() > 1) {

  1045.                 new weapon[17]

  1046.                 read_argv(1, weapon, 16)

  1047.                 if (equal(weapon, "weapon_c4")) {

  1048.                         new weapons[32], count

  1049.                         get_user_weapons(id, weapons, count)

  1050.                         for (new i = 0; i < count; i++) {

  1051.                                 if (weapons[i] == 6) {

  1052.                                         if (get_cvar_num("amx_bazooka_dropping") == 1) {

  1053.                                                 drop_rpg_temp(id)

  1054.                                         }

  1055.                                         else {

  1056.                                                 client_print(id, print_center, "This weapon cannot be dropped")

  1057.                                                 return PLUGIN_HANDLED

  1058.                                         }

  1059.                                 }

  1060.                         }

  1061.                 }

  1062.         }

  1063.         else {

  1064.                 new weaponid, clip, ammo

  1065.                 weaponid = get_user_weapon(id, clip, ammo)

  1066.                 if (weaponid == CSW_C4) {

  1067.                         if (get_cvar_num("amx_bazooka_dropping") == 1) {

  1068.                                 drop_rpg_temp(id)

  1069.                         }

  1070.                         else {

  1071.                                 client_print(id, print_center, "This weapon cannot be dropped")

  1072.                                 return PLUGIN_HANDLED

  1073.                         }

  1074.                 }

  1075.         }

  1076.        

  1077.         return PLUGIN_CONTINUE

  1078. }

  1079.  

  1080. public drop_rpg_temp(id) {

  1081.        

  1082.         new Float:PlayerOrigin[3], Float:End[3], Float:Return[3], Float:TraceDirection[3], Float:Angles[3]

  1083.         entity_get_vector(id, EV_VEC_origin, PlayerOrigin)

  1084.         entity_get_vector(id, EV_VEC_angles, Angles)

  1085.         VelocityByAim(id, 200, TraceDirection)

  1086.        

  1087.         End[0] = TraceDirection[0] + PlayerOrigin[0]

  1088.         End[1] = TraceDirection[1] + PlayerOrigin[1]

  1089.         End[2] = TraceDirection[2] + PlayerOrigin[2]

  1090.        

  1091.         trace_line(id, PlayerOrigin, End, Return)

  1092.         Return[2] = PlayerOrigin[2]

  1093.        

  1094.         new RPG = create_entity("info_target")

  1095.         entity_set_string(RPG, EV_SZ_classname, "rpg_temp")

  1096.         entity_set_model(RPG, "models/w_rpg.mdl")

  1097.         entity_set_origin(RPG, Return)

  1098.        

  1099.         Angles[0] = 0.0

  1100.         Angles[2] = 0.0

  1101.        

  1102.         entity_set_vector(RPG, EV_VEC_angles, Angles)

  1103.        

  1104.         new Float:MinBox[3] = {-16.0, -16.0, 0.0}

  1105.         new Float:MaxBox[3] = {16.0, 16.0, 16.0}

  1106.         entity_set_vector(RPG, EV_VEC_mins, MinBox)

  1107.         entity_set_vector(RPG, EV_VEC_maxs, MaxBox)

  1108.        

  1109.         entity_set_int(RPG, EV_INT_solid, 1)

  1110.         entity_set_int(RPG, EV_INT_movetype, 6)

  1111.        

  1112.         entity_set_int(RPG, EV_INT_iuser1, Munni[id])

  1113.        

  1114.         Munni[id] = 0

  1115.         hasBazooka[id] = false

  1116.        

  1117.         return PLUGIN_HANDLED

  1118. }

  1119.  

  1120. public handle_say(id) {

  1121.         new command[32]

  1122.         read_argv(1, command, 31)

  1123.        

  1124.         if (equal(command, "buybazooka")) {

  1125.                 if (is_user_alive(id)) {

  1126.                         if (get_cvar_num("amx_bazooka_buyable") == 1) {

  1127.                                 show_buymenu(id)

  1128.                         }

  1129.                         else {

  1130.                                 client_print(id, print_chat, "[Bazooka] The buymenu is disabled!")

  1131.                         }

  1132.                 }

  1133.                 else {

  1134.                         client_print(id, print_chat, "[Bazooka] You cannot buy a Bazooka while you are dead!")

  1135.                 }

  1136.         }

  1137.         if (equal(command, "bazookahelp"))

  1138.                 {

  1139.                 // Display Help File from amxx/configs/bazooka_help.htm

  1140.                 new szHelpFile[64], szCustomDir[32]

  1141.                 get_customdir( szCustomDir, 31 )

  1142.                 format( szHelpFile, 63, "%s/bazooka_help.htm", szCustomDir )

  1143.                 show_motd( id, szHelpFile, "Bazooka - Help" )

  1144.                 return PLUGIN_CONTINUE

  1145.         }

  1146.        

  1147.         return PLUGIN_CONTINUE

  1148. }

  1149.  

  1150. public show_buymenu(id) {

  1151.        

  1152.         new MenuBody[256]

  1153.         new len = format(MenuBody, 255, "\yBuy Item^n^n")

  1154.         len = len + format(MenuBody[len], 255 - len, "\w1. Bazooka\R$%d^n", get_cvar_num("amx_bazooka_cost"))

  1155.         len = len + format(MenuBody[len], 255 - len, "^n\w0. Exit^n")

  1156.        

  1157.         new keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9)

  1158.        

  1159.         show_menu(id, keys, MenuBody, -1, "Bazooka Menu")

  1160.        

  1161.         return PLUGIN_HANDLED

  1162. }

  1163.  

  1164. public cmdBazooka_give(id, level, cid) {

  1165.         if (!cmd_access(id, level, cid, 3)) {

  1166.                 return PLUGIN_HANDLED

  1167.         }

  1168.        

  1169.         new arg[32], arg2[8], name2[32], ammo

  1170.         ammo=get_cvar_num("amx_bazooka_ammo")

  1171.         read_argv(1,arg,31)

  1172.         read_argv(2,arg2,7)

  1173.         if ( equali(arg,"@all") )

  1174.                 {

  1175.                 new plist[32],pnum

  1176.                 get_players(plist,pnum,"a")

  1177.                 if (pnum==0)

  1178.                         {

  1179.                         console_print(id,"[Bazooka] This client is invalid")

  1180.                         return PLUGIN_HANDLED

  1181.                 }

  1182.                 for (new i=0; i<pnum; i++)

  1183.                         {

  1184.                         give_item(plist[i], "weapon_c4")

  1185.                         hasBazooka[plist[i]] = true

  1186.                         Munni[plist[i]] += ((str_to_num(arg2))*ammo)

  1187.                         ammo_hud(plist[i], 0)

  1188.                         ammo_hud(plist[i], 1)

  1189.                         check_model(id)

  1190.                         client_print(plist[i], print_chat, "[Bazooka] The Admin gave you a bazooka with %s rockets!",arg2)

  1191.                         client_print(plist[i], print_chat, "[Bazooka] Switch to the bomb weapon or weapon slot 5 to use it")

  1192.                         console_print(id,"[Bazooka] Gave all players bazookas with %s rockets",arg2)

  1193.                 }

  1194.         }

  1195.         else

  1196.         {

  1197.                 get_user_name(id,name2,31)

  1198.                 new player = cmd_target(id,arg,7)

  1199.                 if (!player)

  1200.                         {

  1201.                         console_print(id,"[Bazooka] Give Bazooka Failed")

  1202.                         return PLUGIN_HANDLED

  1203.                 }

  1204.                 new name[32]

  1205.                 get_user_name(player,name,31)

  1206.                 give_item(player, "weapon_c4")

  1207.                 hasBazooka[player] = true

  1208.                 Munni[player] += ((str_to_num(arg2))*ammo)

  1209.                 ammo_hud(player, 0)

  1210.                 ammo_hud(player, 1)

  1211.                 check_model(id)

  1212.                 console_print(id,"[Bazooka] Gave %s %s Bazookas",name,arg2)

  1213.                 client_print(player, print_chat, "[Bazooka] The Admin gave you a bazooka with %s rockets!",arg2)

  1214.                 client_print(player, print_chat, "[Bazooka] Switch to the bomb weapon or weapon slot 5 to use it.")

  1215.                 return PLUGIN_HANDLED

  1216.         }

  1217.         return PLUGIN_HANDLED

  1218. }

  1219.  

  1220. public do_bazookamenu(id, key) {

  1221.         switch(key) {

  1222.                 case 0: {

  1223.                         if (cs_get_user_money(id) >= get_cvar_num("amx_bazooka_cost")) {

  1224.                                

  1225.                                 give_item(id, "weapon_c4")

  1226.                                 hasBazooka[id] = true

  1227.                                 Munni[id] = Munni[id] + get_cvar_num("amx_bazooka_ammo")

  1228.                                 ammo_hud(id, 0)

  1229.                                 ammo_hud(id, 1)

  1230.                                 cs_set_user_money(id, cs_get_user_money(id) - get_cvar_num("amx_bazooka_cost"))

  1231.                                 client_print(id, print_chat, "[Bazooka] You have successfully bought a bazooka!")

  1232.                                 client_print(id, print_chat, "[Bazooka] What are you going to do now!?")

  1233.                         }

  1234.                         else {

  1235.                                 client_print(id, print_center, "Oh no you don't! You're too poor to buy one of these suckers!")

  1236.                         }

  1237.                 }

  1238.                 case 9: {

  1239.                 }

  1240.                 default: {

  1241.                         show_buymenu(id)

  1242.                 }

  1243.         }

  1244.        

  1245.         return PLUGIN_HANDLED

  1246. }

  1247. /************************************************************

  1248. * GIB FUNCTIONS (made by mike_cao)

  1249. ************************************************************/

  1250.  

  1251. public event_respawn(id)

  1252.         {

  1253.         gHealthIndex[id] = get_user_health(id)

  1254.         fx_trans(id,255)

  1255.         return PLUGIN_CONTINUE

  1256. }

  1257.  

  1258. static fx_trans(player,amount)

  1259. {

  1260.         set_user_rendering(player,kRenderFxNone,0,0,0,kRenderTransAlpha,amount)

  1261.         return PLUGIN_CONTINUE

  1262. }

  1263.  

  1264. static fx_blood_small(origin[3],num)

  1265. {

  1266.         // Blood decals

  1267.         #if CZERO

  1268.         static const blood_small[8] = {202,203,204,205,206,207,208,209}

  1269.         #else

  1270.         static const blood_small[7] = {190,191,192,193,194,195,197}

  1271.         #endif 

  1272.         // Small splash

  1273.         for (new j = 0; j < num; j++) {

  1274.                 message_begin(MSG_BROADCAST,SVC_TEMPENTITY)

  1275.                 write_byte(TE_WORLDDECAL)

  1276.                 write_coord(origin[0]+random_num(-100,100))

  1277.                 write_coord(origin[1]+random_num(-100,100))

  1278.                 write_coord(origin[2]-36)

  1279.                 write_byte(blood_small[random_num(0,6)]) // index

  1280.                 message_end()

  1281.         }

  1282. }

  1283.  

  1284. static fx_blood_large(origin[3],num)

  1285. {

  1286.         // Blood decals

  1287.         #if CZERO

  1288.         static const blood_large[2] = {216,217}

  1289.         #else

  1290.         static const blood_large[2] = {204,205}

  1291.         #endif

  1292.        

  1293.         // Large splash

  1294.         for (new i = 0; i < num; i++) {

  1295.                 message_begin(MSG_BROADCAST,SVC_TEMPENTITY)

  1296.                 write_byte(TE_WORLDDECAL)

  1297.                 write_coord(origin[0]+random_num(-50,50))

  1298.                 write_coord(origin[1]+random_num(-50,50))

  1299.                 write_coord(origin[2]-36)

  1300.                 write_byte(blood_large[random_num(0,1)]) // index

  1301.                 message_end()

  1302.         }

  1303. }

  1304.  

  1305. static fx_gib_explode(origin[3],num)

  1306. {

  1307.         new flesh[3], x, y, z

  1308.         flesh[0] = mdl_gib_flesh

  1309.         flesh[1] = mdl_gib_meat

  1310.         flesh[2] = mdl_gib_legbone

  1311.        

  1312.         // Gib explosion

  1313.         // Head

  1314.         message_begin(MSG_BROADCAST,SVC_TEMPENTITY)

  1315.         write_byte(TE_MODEL)

  1316.         write_coord(origin[0])

  1317.         write_coord(origin[1])

  1318.         write_coord(origin[2])

  1319.         write_coord(random_num(-100,100))

  1320.         write_coord(random_num(-100,100))

  1321.         write_coord(random_num(100,200))

  1322.         write_angle(random_num(0,360))

  1323.         write_short(mdl_gib_head)

  1324.         write_byte(0) // bounce

  1325.         write_byte(500) // life

  1326.         message_end()

  1327.        

  1328.         // Spine

  1329.         message_begin(MSG_BROADCAST,SVC_TEMPENTITY)

  1330.         write_byte(TE_MODEL)

  1331.         write_coord(origin[0])

  1332.         write_coord(origin[1])

  1333.         write_coord(origin[2])

  1334.         write_coord(random_num(-100,100))

  1335.         write_coord(random_num(-100,100))

  1336.         write_coord(random_num(100,200))

  1337.         write_angle(random_num(0,360))

  1338.         write_short(mdl_gib_spine)

  1339.         write_byte(0) // bounce

  1340.         write_byte(500) // life

  1341.         message_end()

  1342.        

  1343.         // Lung

  1344.         for(new i = 0; i < random_num(1,2); i++) {

  1345.                 message_begin(MSG_BROADCAST,SVC_TEMPENTITY)

  1346.                 write_byte(TE_MODEL)

  1347.                 write_coord(origin[0])

  1348.                 write_coord(origin[1])

  1349.                 write_coord(origin[2])

  1350.                 write_coord(random_num(-100,100))

  1351.                 write_coord(random_num(-100,100))

  1352.                 write_coord(random_num(100,200))

  1353.                 write_angle(random_num(0,360))

  1354.                 write_short(mdl_gib_lung)

  1355.                 write_byte(0) // bounce

  1356.                 write_byte(500) // life

  1357.                 message_end()

  1358.         }

  1359.        

  1360.         // Parts, 10 times

  1361.         for(new i = 0; i < 10; i++) {

  1362.                 message_begin(MSG_BROADCAST,SVC_TEMPENTITY)

  1363.                 write_byte(TE_MODEL)

  1364.                 write_coord(origin[0])

  1365.                 write_coord(origin[1])

  1366.                 write_coord(origin[2])

  1367.                 write_coord(random_num(-100,100))

  1368.                 write_coord(random_num(-100,100))

  1369.                 write_coord(random_num(100,200))

  1370.                 write_angle(random_num(0,360))

  1371.                 write_short(flesh[random_num(0,2)])

  1372.                 write_byte(0) // bounce

  1373.                 write_byte(500) // life

  1374.                 message_end()

  1375.         }

  1376.        

  1377.         // Blood

  1378.         for(new i = 0; i < num; i++) {

  1379.                 x = random_num(-100,100)

  1380.                 y = random_num(-100,100)

  1381.                 z = random_num(0,100)

  1382.                 for(new j = 0; j < 3; j++) {

  1383.                         message_begin(MSG_BROADCAST,SVC_TEMPENTITY)

  1384.                         write_byte(TE_BLOODSPRITE)

  1385.                         write_coord(origin[0]+(x*j))

  1386.                         write_coord(origin[1]+(y*j))

  1387.                         write_coord(origin[2]+(z*j))

  1388.                         write_short(spr_blood_spray)

  1389.                         write_short(spr_blood_drop)

  1390.                         write_byte(229) // color index

  1391.                         write_byte(15) // size

  1392.                         message_end()

  1393.                 }

  1394.         }

  1395. }


A hozzászólást 1 alkalommal szerkesztették, utoljára Anonymous 2012.07.31. 12:19-kor.

Hozzászólás jelentése
Vissza a tetejére
   
HozzászólásElküldve:2012.07.31. 13:19 
Offline
Őskövület
Avatar

Csatlakozott:2013.01.01. 17:48
Hozzászólások:2441
Megköszönt másnak: 18 alkalommal
Megköszönték neki: 21 alkalommal
Ötlet?


Hozzászólás jelentése
Vissza a tetejére
   
HozzászólásElküldve:2012.07.31. 14:16 
Offline
Őstag

Csatlakozott:2011.06.12. 20:51
Hozzászólások:1089
Megköszönt másnak: 3 alkalommal
Megköszönték neki: 44 alkalommal
az model hiba hogy ball kézbe van

_________________
[img]semmi[/img]


Hozzászólás jelentése
Vissza a tetejére
   
HozzászólásElküldve:2012.07.31. 16:04 
Offline
Őskövület
Avatar

Csatlakozott:2013.01.01. 17:48
Hozzászólások:2441
Megköszönt másnak: 18 alkalommal
Megköszönték neki: 21 alkalommal
Érdekes... edig minden jobb kézben volt, kivéve a kés mert az balkezes model, és amikor betettem ezt a plugint mindent át tett bal kézbe ...


Hozzászólás jelentése
Vissza a tetejére
   
Hozzászólások megjelenítése: Rendezés 
Új téma nyitása Hozzászólás a témához  [4 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 6 vendég


Nyithatsz új témákat ebben a fórumban.
Válaszolhatsz egy témára ebben a fórumban.
Nem szerkesztheted a hozzászólásaidat ebben a fórumban.
Nem törölheted a hozzászólásaidat ebben a fórumban.
Nem küldhetsz csatolmányokat ebben a fórumban.

Keresés:
Ugrás:  
Powered by phpBB® Forum Software © phpBB Limited
Magyar fordítás © Magyar phpBB Közösség
Portal: Kiss Portal Extension © Michael O'Toole