hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.05.24. 06:09



Jelenlévő felhasználók

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

A legtöbb felhasználó (1565 fő) 2020.11.21. 11:26-kor tartózkodott itt.

Regisztrált felhasználók: Majestic-12 [Bot] 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  [ 1 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: Rakéta
HozzászólásElküldve: 2012.10.21. 01:59 
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
Üdv!

Ebben a pluginban:
[ablak]
SMA Forráskód: [ Mindet kijelol ]
  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. #include <fakemeta>
  89. #include <engine>
  90. #include <fun>
  91. #include <cstrike>
  92. #include <amxmisc>
  93. #include <entity_maths> //this has the function for the "heat-seeking" rockets
  94.  
  95. #define TE_EXPLOSION 3
  96. #define TE_EXPLFLAG_NONE 0
  97. #define TE_SMOKE 5
  98. #define TE_BLOODSPRITE 115
  99. #define TE_BLOODSTREAM 101
  100. #define TE_MODEL 106
  101. #define TE_WORLDDECAL 116
  102. #define BA_NORMAL (1<<0) // "a"
  103. #define BA_HEAT (1<<1) // "b"
  104. #define BA_USER (1<<2) // "c"
  105.  
  106. new g_sModelIndexFireball, g_sModelIndexSmoke, rocketsmoke
  107. new bool:CanShoot[32], Munni[32], mode[32], bool:allow_shooting, user_controll[32], bool:hasBazooka[32]
  108. 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
  109. new gHealthIndex[33], bool:cantplantbomb, bool:cantswitch, iFlags, modetext[64]
  110.  
  111. public plugin_init() {
  112. register_plugin("BazookaAdvanced", "1.3", "Major Victory")
  113. register_concmd("amx_bazooka", "drop_rpg", ADMIN_LEVEL_A)
  114. register_concmd("amx_bazooka_give", "cmdBazooka_give", ADMIN_LEVEL_A, "<@all or name/id> <amount>")
  115.  
  116. register_concmd("amx_bazooka_startarena", "cmdBazooka_StartArena", ADMIN_LEVEL_A, "<mode restrictions> <round restart 1|0>")
  117. register_concmd("amx_bazooka_endarena", "cmdBazooka_EndArena", ADMIN_LEVEL_A, "<set ammo>")
  118.  
  119. register_cvar("amx_bazooka_dropping", "1")// can a player drop a bazooka
  120. register_cvar("amx_bazooka_ammo", "1")// how much ammo per bazooka
  121. register_cvar("amx_bazooka_damageradius", "250")
  122. register_cvar("amx_bazooka_maxdamage", "150")
  123. register_cvar("amx_bazooka_cost", "2500")// how much one bazooka costs
  124. register_cvar("amx_bazooka_arena", "0")// requires direct hit to kill
  125. register_cvar("amx_bazooka_buyable", "1")//diasbles/enables the buy menu
  126. register_cvar("amx_bazooka_restrict", "bc") // a = Normal | b = Heat-Seeking | c = User-Guided
  127. register_cvar("amx_bazooka_reloadtime", "2.5")// in seconds
  128. register_cvar("amx_bazooka_trailtime", "30")// roughly 3 seconds
  129. register_cvar("amx_bazooka_velocity", "700")
  130. register_cvar("amx_bazooka_teamcolors", "1")// set to 1 for team colored trails
  131. register_cvar("amx_bazooka_gib", "1")// set to 1 for gib deaths (may cause lag on slower computers)
  132.  
  133. register_clcmd("say", "handle_say")
  134. register_clcmd("say_team", "handle_say")
  135.  
  136. register_event("DeathMsg", "player_die", "a")
  137. register_event("CurWeapon", "check_model", "be")
  138. register_event("TextMsg", "bomb_msg", "b", "2=#C4_Plant_At_Bomb_Spot")
  139. register_event("ResetHUD","event_respawn","be","1=1")
  140. register_logevent("round_end", 2, "1=Round_End")
  141. register_logevent("round_start", 2, "1=Round_Start")
  142.  
  143. register_clcmd("drop", "handle_drop")
  144.  
  145. register_forward(FM_PlayerPreThink, "forward_playerprethink")
  146. register_forward(FM_SetModel, "forward_setmodel")
  147.  
  148. register_menu("Bazooka Menu", 1023, "do_bazookamenu")
  149. register_logevent("bombplant",3,"2=Planted_The_Bomb")
  150. }
  151.  
  152. public plugin_precache() {
  153. precache_model("models/rpgrocket.mdl")
  154. precache_model("models/w_rpg.mdl")
  155. precache_model("models/v_rpg.mdl")
  156. precache_model("models/p_rpg.mdl")
  157. precache_sound("weapons/rocketfire1.wav")
  158. precache_sound("items/gunpickup4.wav")
  159. precache_sound("weapons/nuke_fly.wav")// <-- this is the only non-game sound file, make sure you have it
  160. precache_sound("weapons/dryfire1.wav")
  161. spr_blood_drop = precache_model("sprites/blood.spr")
  162. spr_blood_spray = precache_model("sprites/bloodspray.spr")
  163. mdl_gib_flesh = precache_model("models/Fleshgibs.mdl")
  164. mdl_gib_head = precache_model("models/GIB_Skull.mdl")
  165. mdl_gib_legbone = precache_model("models/GIB_Legbone.mdl")
  166. mdl_gib_lung = precache_model("models/GIB_Lung.mdl")
  167. mdl_gib_meat = precache_model("models/GIB_B_Gib.mdl")
  168. mdl_gib_spine = precache_model("models/GIB_B_Bone.mdl")
  169. g_sModelIndexFireball = precache_model("sprites/zerogxplode.spr")
  170. g_sModelIndexSmoke = precache_model("sprites/steam1.spr")
  171. rocketsmoke = precache_model("sprites/smoke.spr")
  172. }
  173.  
  174. public get_restrict_flags() {
  175. new sFlags[24]
  176. get_cvar_string("amx_bazooka_restrict",sFlags,24)
  177. iFlags = read_flags(sFlags)
  178. }
  179.  
  180. public bomb_msg(id) {
  181. if (cs_get_user_plant(id) != 1)
  182. client_print(id,print_center,"")
  183. }
  184.  
  185. public bombplant() {
  186. cantplantbomb = true
  187. }
  188.  
  189. public round_end() {
  190. set_task(4.8, "round_prestart")
  191. set_task(5.0, "player_spawn")
  192. set_task(5.2, "bazooka_arena")
  193. }
  194.  
  195. public round_prestart() {
  196. allow_shooting = false
  197. cantplantbomb = true
  198. cantswitch = true
  199. }
  200.  
  201. public round_start() {
  202. allow_shooting = true
  203. cantplantbomb = false
  204. cantswitch = false
  205. }
  206.  
  207. public bazooka_arena(id) {
  208. if (get_cvar_num("amx_bazooka_arena") == 1) {
  209. new players[32], count
  210. get_players(players, count)
  211. for (new i = 0; i < count; i++) {
  212. give_item(players[i], "weapon_c4")
  213. hasBazooka[players[i]] = true
  214. allow_shooting = true
  215. CanShoot[players[i]] = true
  216. cs_set_user_plant(players[i],0,0)
  217. console_cmd(id ,"amx_bazooka_damageradius 40")
  218. console_cmd(id ,"amx_bazooka_maxdamage 999999")
  219. client_print(players[i], print_chat, "[Bazooka] Bazooka Arena is ON! say ^"bazookahelp^" for more info")
  220. client_print(players[i], print_center, "Time to make things go BOOM!")
  221. }
  222. }
  223.  
  224. return PLUGIN_HANDLED
  225. }
  226.  
  227. public cmdBazooka_StartArena(id,level,cid) {
  228. if (!cmd_access(id, level, cid, 3)) {
  229. return PLUGIN_HANDLED
  230. }
  231. new arg[6],arg2[2],argument2,players[32], count
  232. read_argv(1,arg,5)
  233. read_argv(2,arg2,1)
  234. argument2 = str_to_num(arg2)
  235. console_cmd(id, "amx_bazooka_arena 1")
  236. console_cmd(id, "amx_bazooka_give @all 1")
  237. console_cmd(id, "amx_bazooka_restrict %s",arg)
  238. get_players(players, count)
  239. for (new i = 0; i < count; i++) {
  240. ammo_hud(players[i], 0)
  241. ammo_hud(players[i], 1)
  242. emit_sound(players[i], CHAN_ITEM, "items/gunpickup2.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  243. client_print(players[i], print_chat, "[Bazooka] Bazooka Arena has been turned ON")
  244. }
  245. if (argument2 == 1) {
  246. console_cmd(id, "sv_restartround 1")
  247. }
  248. return PLUGIN_HANDLED
  249. }
  250.  
  251. public cmdBazooka_EndArena(id,level,cid) {
  252. if (!cmd_access(id, level, cid, 2)) {
  253. return PLUGIN_HANDLED
  254. }
  255. new arg[5],argument1,players[32], count
  256. read_argv(1,arg,4)
  257. argument1 = str_to_num(arg)
  258. console_cmd(id, "amx_bazooka_arena 0")
  259. if (argument1 >= 0) {
  260. get_players(players, count)
  261. for (new i = 0; i < count; i++) {
  262. Munni[players[i]] = argument1
  263. ammo_hud(players[i], 0)
  264. ammo_hud(players[i], 1)
  265. client_print(players[i], print_chat, "[Bazooka] Bazooka Arena has been turned OFF")
  266. }
  267. }
  268. return PLUGIN_HANDLED
  269. }
  270.  
  271. public fire_rocket(id) {
  272. ammo_hud(id, 0)
  273. ammo_hud(id, 1)
  274. CanShoot[id] = false
  275.  
  276. new data[1]
  277. data[0] = id
  278. new rtime = get_cvar_num("amx_bazooka_reloadtime")
  279. if (cs_get_user_plant(id) != 1){
  280. set_task((rtime + 0.0), "rpg_reload", id+9477, data, 1)
  281. if ((Munni[id] <= 0) && (get_cvar_num("amx_bazooka_arena") != 1)) {
  282. emit_sound(id, CHAN_WEAPON, "weapons/dryfire1.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  283. return PLUGIN_HANDLED
  284. }
  285. else{
  286. new Float:StartOrigin[3], Float:Angle[3]
  287.  
  288. new PlayerOrigin[3]
  289. get_user_origin(id, PlayerOrigin, 1)
  290.  
  291. StartOrigin[0] = float(PlayerOrigin[0])
  292. StartOrigin[1] = float(PlayerOrigin[1])
  293. StartOrigin[2] = float(PlayerOrigin[2])
  294.  
  295. entity_get_vector(id, EV_VEC_v_angle, Angle)
  296. Angle[0] = Angle[0] * -1.0
  297. new RocketEnt = create_entity("info_target")
  298. entity_set_string(RocketEnt, EV_SZ_classname, "rpgrocket")
  299. entity_set_model(RocketEnt, "models/rpgrocket.mdl")
  300. entity_set_origin(RocketEnt, StartOrigin)
  301. entity_set_vector(RocketEnt, EV_VEC_angles, Angle)
  302.  
  303. new Float:MinBox[3] = {-1.0, -1.0, -1.0}
  304. new Float:MaxBox[3] = {1.0, 1.0, 1.0}
  305. entity_set_vector(RocketEnt, EV_VEC_mins, MinBox)
  306. entity_set_vector(RocketEnt, EV_VEC_maxs, MaxBox)
  307.  
  308. entity_set_int(RocketEnt, EV_INT_solid, 2)
  309. entity_set_int(RocketEnt, EV_INT_movetype, 5)
  310. entity_set_edict(RocketEnt, EV_ENT_owner, id)
  311.  
  312. new Float:Velocity[3]
  313. new myvelocity = get_cvar_num("amx_bazooka_velocity")
  314. VelocityByAim(id, myvelocity, Velocity)
  315. entity_set_vector(RocketEnt, EV_VEC_velocity, Velocity)
  316.  
  317. emit_sound(RocketEnt, CHAN_WEAPON, "weapons/rocketfire1.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  318. emit_sound(RocketEnt, CHAN_VOICE, "weapons/nuke_fly.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  319.  
  320. if (get_cvar_num("amx_bazooka_arena") != 1) {
  321. ammo_hud(id, 0)
  322. Munni[id]--
  323. ammo_hud(id, 1)
  324. }
  325. new CsTeams:iTeam =cs_get_user_team(id)
  326. new trailtime =get_cvar_num("amx_bazooka_trailtime")
  327. new colorr =random_num(0,255)
  328. new colorg =random_num(0,255)
  329. new colorb =random_num(0,255)
  330. if (get_cvar_num("amx_bazooka_teamcolors") == 1) {
  331. switch(iTeam) {
  332. case CS_TEAM_T: { //if team T color=red
  333. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  334. write_byte(22)
  335. write_short(RocketEnt)
  336. write_short(rocketsmoke)
  337. write_byte(trailtime)
  338. write_byte(3)
  339. write_byte(255)
  340. write_byte(0)
  341. write_byte(0)
  342. write_byte(255)
  343. message_end()
  344. }
  345. case CS_TEAM_CT: { // if team CT color=blue
  346. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  347. write_byte(22)
  348. write_short(RocketEnt)
  349. write_short(rocketsmoke)
  350. write_byte(trailtime)
  351. write_byte(3)
  352. write_byte(0)
  353. write_byte(0)
  354. write_byte(255)
  355. write_byte(255)
  356. message_end()
  357. }
  358. }
  359. }
  360. else { // random colors anyone?
  361. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  362. write_byte(22)
  363. write_short(RocketEnt)
  364. write_short(rocketsmoke)
  365. write_byte(trailtime)
  366. write_byte(3)
  367. write_byte(colorr)
  368. write_byte(colorg)
  369. write_byte(colorb)
  370. write_byte(255)
  371. message_end()
  372. }
  373.  
  374. if (mode[id] == 2) {
  375. new info[1]
  376. info[0] = RocketEnt
  377. set_task(1.0, "find_and_follow", 0, info, 1)
  378. }
  379. else if (mode[id] == 3) {
  380. entity_set_int(RocketEnt, EV_INT_rendermode, 1)
  381. attach_view(id, RocketEnt)
  382. user_controll[id] = RocketEnt
  383. }
  384. return PLUGIN_HANDLED
  385. }
  386. return PLUGIN_HANDLED
  387. }
  388. return PLUGIN_HANDLED
  389. }
  390.  
  391. public rpg_reload(data[]) {
  392. CanShoot[data[0]] = true
  393. }
  394.  
  395. public find_and_follow(info[]) {
  396. new RocketEnt = info[0]
  397. new Float:shortestDist = 10000.0
  398. new nearestPlayer = 0
  399.  
  400. if (is_valid_ent(RocketEnt)) {
  401. new players[32], count
  402. get_players(players, count)
  403. for (new i = 0; i < count; i++) {
  404. 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)))) {
  405. new Float:PlayerOrigin[3], Float:RocketOrigin[3]
  406. entity_get_vector(players[i], EV_VEC_origin, PlayerOrigin)
  407. entity_get_vector(RocketEnt, EV_VEC_origin, RocketOrigin)
  408.  
  409. new Float:distance = vector_distance(PlayerOrigin, RocketOrigin)
  410.  
  411. if (distance <= shortestDist) {
  412. shortestDist = distance
  413. nearestPlayer = players[i]
  414. }
  415. }
  416. }
  417. }
  418.  
  419. if (nearestPlayer > 0) {
  420. new data[2]
  421. data[0] = RocketEnt
  422. data[1] = nearestPlayer
  423. set_task(0.1, "follow_and_catch", RocketEnt, data, 2, "b")
  424. }
  425. else {
  426. pfn_touch(RocketEnt, 0)
  427. }
  428. }
  429.  
  430. public follow_and_catch(data[]) {
  431. new RocketEnt = data[0]
  432. new target = data[1]
  433. new myvelocity = get_cvar_num("amx_bazooka_velocity")
  434.  
  435. if (is_user_alive(target) && is_valid_ent(RocketEnt)) {
  436. entity_set_follow(RocketEnt, target, (myvelocity+0.0))
  437.  
  438. new Float:Velocity[3]
  439. new Float:NewAngle[3]
  440. entity_get_vector(RocketEnt, EV_VEC_velocity, Velocity)
  441. vector_to_angle(Velocity, NewAngle)
  442. entity_set_vector(RocketEnt, EV_VEC_angles, NewAngle)
  443. }
  444. else {
  445. remove_task(RocketEnt)
  446. new info[1]
  447. info[0] = RocketEnt
  448. set_task(0.1, "find_and_follow", 0, data, 1)
  449. }
  450. }
  451.  
  452. public pfn_touch(ptr, ptd) {
  453. new ClassName[32]
  454. new ClassNameptd[32]
  455. if ((ptr > 0) && is_valid_ent(ptr)) {
  456. entity_get_string(ptr, EV_SZ_classname, ClassName, 31)
  457. }
  458. if ((ptd > 0) && is_valid_ent(ptd)) {
  459. entity_get_string(ptd, EV_SZ_classname, ClassNameptd, 31)
  460. }
  461. if (equal(ClassName, "rpgrocket")) {
  462. if (equal(ClassNameptd, "func_breakable")) {
  463. force_use(ptr,ptd)
  464. remove_task(ptr)
  465. }
  466. remove_task(ptr)
  467. new Float:EndOrigin[3]
  468. entity_get_vector(ptr, EV_VEC_origin, EndOrigin)
  469.  
  470. message_begin( MSG_BROADCAST, SVC_TEMPENTITY) // Explosion
  471. write_byte(TE_EXPLOSION)
  472. write_coord(floatround(EndOrigin[0]))
  473. write_coord(floatround(EndOrigin[1]))
  474. write_coord(floatround(EndOrigin[2])+5)
  475. write_short(g_sModelIndexFireball)
  476. write_byte(random_num(0,20) + 20)
  477. write_byte(12) // framerate
  478. write_byte(TE_EXPLFLAG_NONE)
  479. message_end()
  480.  
  481. message_begin(MSG_BROADCAST, SVC_TEMPENTITY) // Smoke
  482. write_byte(TE_SMOKE)
  483. write_coord(floatround(EndOrigin[0]))
  484. write_coord(floatround(EndOrigin[1]))
  485. write_coord(floatround(EndOrigin[2])+15)
  486. write_short(g_sModelIndexSmoke)
  487. write_byte(60)
  488. write_byte(10)
  489. message_end()
  490. new maxdamage = get_cvar_num("amx_bazooka_maxdamage")
  491. new damageradius = get_cvar_num("amx_bazooka_damageradius")
  492.  
  493. new PlayerPos[3], distance, damage
  494. for (new i = 1; i < 32; i++) {
  495. if (is_user_alive(i) == 1) {
  496. get_user_origin(i, PlayerPos)
  497.  
  498. new NonFloatEndOrigin[3]
  499. NonFloatEndOrigin[0] = floatround(EndOrigin[0])
  500. NonFloatEndOrigin[1] = floatround(EndOrigin[1])
  501. NonFloatEndOrigin[2] = floatround(EndOrigin[2])
  502.  
  503. distance = get_distance(PlayerPos, NonFloatEndOrigin)
  504. if (distance <= damageradius) { // Screenshake Radius
  505. message_begin(MSG_ONE, get_user_msgid("ScreenShake"), {0,0,0}, i) // Shake Screen
  506. write_short(1<<14)
  507. write_short(1<<14)
  508. write_short(1<<14)
  509. message_end()
  510.  
  511. damage = maxdamage - floatround(floatmul(float(maxdamage), floatdiv(float(distance), float(damageradius))))
  512. new attacker = entity_get_edict(ptr, EV_ENT_owner)
  513.  
  514. if (!get_user_godmode(i)) {
  515.  
  516. if (get_user_team(attacker) != get_user_team(i)) {
  517.  
  518. if (damage < get_user_health(i)) {
  519. set_user_health(i, get_user_health(i) - damage)
  520. }
  521. else {
  522. set_msg_block(get_user_msgid("DeathMsg"), BLOCK_SET)
  523. user_kill(i, 1)
  524. set_msg_block(get_user_msgid("DeathMsg"), BLOCK_NOT)
  525.  
  526. message_begin(MSG_BROADCAST, get_user_msgid("DeathMsg")) // Kill-Log oben rechts
  527. write_byte(attacker) // Attacker
  528. write_byte(i) // Victim
  529. write_byte(0) // Headshot
  530. write_string("bazooka")
  531. message_end()
  532. if (damage > 100 && get_cvar_num("amx_bazooka_gib") == 1) { //begin gibs and effects (made by mike_cao)
  533. new iOrigin[3]
  534. get_user_origin(i,iOrigin) // Effects
  535. fx_trans(i,0)
  536. fx_gib_explode(iOrigin,3)
  537. fx_blood_large(iOrigin,5)
  538. fx_blood_small(iOrigin,15)
  539. iOrigin[2] = iOrigin[2]-20 // Hide body
  540. set_user_origin(i,iOrigin)
  541. } //end gibs and effects
  542. set_user_frags(attacker, get_user_frags(attacker) + 1)
  543. if (get_cvar_num("amx_bazooka_gib") == 1) {
  544. client_print(attacker, print_center, "LOLERS! You just splattered that guy's guts everywhere!")
  545. }
  546.  
  547. }
  548. }
  549. if (get_user_team(attacker) == get_user_team(i)) {
  550.  
  551. if (attacker == i) {
  552.  
  553. if (damage < get_user_health(i)) {
  554. set_user_health(i, get_user_health(i) - damage)
  555. }
  556. else {
  557. set_msg_block(get_user_msgid("DeathMsg"), BLOCK_SET)
  558. user_kill(i, 1)
  559. set_msg_block(get_user_msgid("DeathMsg"), BLOCK_NOT)
  560.  
  561. message_begin(MSG_BROADCAST, get_user_msgid("DeathMsg")) // Kill-Log oben rechts
  562. write_byte(attacker) // Attacker
  563. write_byte(i) // Victim
  564. write_byte(0) // Headshot
  565. write_string("bazooka")
  566. message_end()
  567. if ((damage > 100) && get_cvar_num("amx_bazooka_gib") == 1) { //begin gibs and effects (made by mike_cao)
  568. new iOrigin[3]
  569. get_user_origin(i,iOrigin)// Effects
  570. fx_trans(i,0)
  571. fx_gib_explode(iOrigin,3)
  572. fx_blood_large(iOrigin,5)
  573. fx_blood_small(iOrigin,15)
  574. iOrigin[2] = iOrigin[2]-20 // Hide body
  575. set_user_origin(i,iOrigin)
  576. } //end gibs and effects
  577. set_user_frags(attacker, get_user_frags(attacker) - 1)
  578. if (get_cvar_num("amx_bazooka_gib") == 1){
  579. client_print(attacker, print_center, "Great! Now everyone knows what you had for supper!")
  580. }
  581. else {
  582. client_print(attacker, print_center, "You do know this thing explodes right?")
  583. }
  584.  
  585. }
  586. }
  587. else {
  588. if (get_cvar_num("mp_friendlyfire")) {
  589. if (damage < get_user_health(i)) {
  590. set_user_health(i, get_user_health(i) - damage)
  591. client_print(attacker, print_center, "You injured a teammate! Watch your aim!")
  592. }
  593. else {
  594. set_msg_block(get_user_msgid("DeathMsg"), BLOCK_SET)
  595. user_kill(i, 1)
  596. set_msg_block(get_user_msgid("DeathMsg"), BLOCK_NOT)
  597.  
  598. message_begin(MSG_BROADCAST, get_user_msgid("DeathMsg")) // Kill-Log oben rechts
  599. write_byte(attacker) // Attacker write_byte(i) // Victim
  600. write_byte(0) // Headshot
  601. write_string("bazooka")
  602. message_end()
  603. if (damage > 100 && get_cvar_num("amx_bazooka_gib") == 1) { //begin gibs and effects (made by mike_cao)
  604. new iOrigin[3]
  605. get_user_origin(i,iOrigin)// Effects
  606. fx_trans(i,0)
  607. fx_gib_explode(iOrigin,3)
  608. fx_blood_large(iOrigin,5)
  609. fx_blood_small(iOrigin,15)
  610. iOrigin[2] = iOrigin[2]-20 // Hide body
  611. set_user_origin(i,iOrigin)
  612. } //end gibs and effects
  613. set_user_frags(attacker, get_user_frags(attacker) - 1)
  614. if (get_cvar_num("amx_bazooka_gib") == 1){
  615. client_print(attacker, print_center, "OMFG's!! You just splattered a teammate!")
  616. }
  617. else{
  618. client_print(attacker, print_center, "LOL! That teammate is probably not too happy now!")
  619. }
  620. }
  621. }
  622. }
  623. }
  624. }
  625. }
  626. }
  627. }
  628. attach_view(entity_get_edict(ptr, EV_ENT_owner), entity_get_edict(ptr, EV_ENT_owner))
  629. user_controll[entity_get_edict(ptr, EV_ENT_owner)] = 0
  630. remove_entity(ptr)
  631. }
  632.  
  633.  
  634. if (equal(ClassName, "rpg") || equal(ClassName, "rpg_temp")) {
  635. new Picker[32]
  636. if ((ptd > 0) && is_valid_ent(ptd)) {
  637. entity_get_string(ptd, EV_SZ_classname, Picker, 31)
  638. }
  639. if (equal(Picker, "player")) {
  640. give_item(ptd, "weapon_c4")
  641. hasBazooka[ptd] = true
  642. Munni[ptd] = Munni[ptd] + entity_get_int(ptr, EV_INT_iuser1)
  643. client_print(ptd, print_chat, "[Bazooka] You have picked up a bazooka!")
  644. ammo_hud(ptd, 0)
  645. ammo_hud(ptd, 1)
  646. emit_sound(ptd, CHAN_WEAPON, "items/gunpickup2.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  647. remove_entity(ptr)
  648. }
  649. }
  650. }
  651.  
  652. public drop_rpg(id, level, cid) {
  653. if (!cmd_access(id, level, cid, 1)) {
  654. return PLUGIN_HANDLED
  655. }
  656. new Float:PlayerOrigin[3], Float:End[3], Float:Return[3], Float:TraceDirection[3]
  657. entity_get_vector(id, EV_VEC_origin, PlayerOrigin)
  658. VelocityByAim(id, 64, TraceDirection)
  659.  
  660. End[0] = TraceDirection[0] + PlayerOrigin[0]
  661. End[1] = TraceDirection[1] + PlayerOrigin[1]
  662. End[2] = TraceDirection[2] + PlayerOrigin[2]
  663.  
  664. trace_line(id, PlayerOrigin, End, Return)
  665. Return[2] = PlayerOrigin[2]
  666.  
  667. new RPG = create_entity("info_target")
  668. entity_set_string(RPG, EV_SZ_classname, "rpg")
  669. entity_set_model(RPG, "models/w_rpg.mdl")
  670. entity_set_origin(RPG, Return)
  671.  
  672. new Float:MinBox[3] = {-16.0, -16.0, 0.0}
  673. new Float:MaxBox[3] = {16.0, 16.0, 16.0}
  674. entity_set_vector(RPG, EV_VEC_mins, MinBox)
  675. entity_set_vector(RPG, EV_VEC_maxs, MaxBox)
  676.  
  677. entity_set_int(RPG, EV_INT_solid, 1)
  678. entity_set_int(RPG, EV_INT_movetype, 6)
  679.  
  680. entity_set_int(RPG, EV_INT_iuser1, get_cvar_num("amx_bazooka_ammo"))
  681.  
  682. return PLUGIN_HANDLED
  683. }
  684.  
  685. public client_PreThink(id) {
  686. if (is_user_alive(id)) {
  687. new weaponid, clip, ammo
  688. weaponid = get_user_weapon(id, clip, ammo)
  689. if ((weaponid == CSW_C4) && hasBazooka[id]) {
  690. new attack = get_user_button(id) & IN_ATTACK
  691. new oldattack = get_user_oldbutton(id) & IN_ATTACK
  692. new attack2 = get_user_button(id) & IN_ATTACK2
  693. new oldattack2 = get_user_oldbutton(id) & IN_ATTACK2
  694. new CsTeams:iTeam =cs_get_user_team(id)
  695. if (attack && !oldattack && (cs_get_user_plant(id) != 1)) {
  696. get_restrict_flags()
  697. if (mode[id] != 1 && ((iFlags&BA_USER) || (iFlags&BA_HEAT))) {
  698. mode[id] = 1
  699. if (CanShoot[id] && allow_shooting && (user_controll[id] == 0)) {
  700. fire_rocket(id)
  701. }
  702. }
  703. else {
  704. if (CanShoot[id] && allow_shooting && (user_controll[id] == 0)) {
  705. fire_rocket(id)
  706. }
  707. }
  708.  
  709. }
  710. else if (attack2 && !oldattack2) {
  711. switch(mode[id]) {
  712. case 1: {
  713. get_restrict_flags()
  714. if ((iFlags&BA_HEAT) != BA_HEAT) {
  715. mode[id] = 2
  716. modetext = "Heat-Seeking"
  717. ammo_hud(id, 0)
  718. ammo_hud(id, 1)
  719. check_model(id)
  720. emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  721. emit_sound(id, CHAN_WEAPON, "items/nvg_on.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  722. client_print(id, print_center, "Heat-Seeking Mode")
  723. }
  724. else if ((iFlags&BA_USER) != BA_USER) {
  725. mode[id] = 3
  726. modetext = "User-Guided"
  727. ammo_hud(id, 0)
  728. ammo_hud(id, 1)
  729. check_model(id)
  730. emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  731. emit_sound(id, CHAN_WEAPON, "items/gunpickup4.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  732. client_print(id, print_center, "User-Guided Mode")
  733. }
  734. else {
  735. if (!cantplantbomb && !cantswitch && iTeam&CS_TEAM_T) {
  736. cantswitch = true
  737. mode[id] = 4
  738. modetext = "C4"
  739. ammo_hud(id, 0)
  740. ammo_hud(id, 1)
  741. cs_set_user_plant(id,1,1)
  742. check_model(id)
  743. emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  744. client_print(id, print_center, "Switching to C4 Bomb")
  745. }
  746. else if (cantplantbomb || cantswitch || iTeam&CS_TEAM_CT){
  747. mode[id] = 1
  748. modetext = "Bazooka"
  749. ammo_hud(id, 0)
  750. ammo_hud(id, 1)
  751. check_model(id)
  752. emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  753. client_print(id, print_center, "The other modes are restricted")
  754. }
  755. }
  756. }
  757. case 2: {
  758. get_restrict_flags()
  759. if ((iFlags&BA_USER) != BA_USER) {
  760. mode[id] = 3
  761. modetext = "User-Guided"
  762. ammo_hud(id, 0)
  763. ammo_hud(id, 1)
  764. check_model(id)
  765. emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  766. emit_sound(id, CHAN_WEAPON, "items/gunpickup4.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  767. client_print(id, print_center, "User-Guided Mode")
  768. }
  769. else if (iFlags&BA_USER && ((iFlags&BA_NORMAL) != BA_NORMAL)) {
  770. if (!cantplantbomb && !cantswitch && iTeam&CS_TEAM_T) {
  771. cantswitch = true
  772. mode[id] = 4
  773. modetext = "C4"
  774. ammo_hud(id, 0)
  775. ammo_hud(id, 1)
  776. cs_set_user_plant(id,1,1)
  777. check_model(id)
  778. emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  779. client_print(id, print_center, "Switching to C4 Bomb")
  780. }
  781. else if (cantplantbomb || cantswitch || iTeam&CS_TEAM_CT){
  782. mode[id] = 1
  783. modetext = "Bazooka"
  784. ammo_hud(id, 0)
  785. ammo_hud(id, 1)
  786. check_model(id)
  787. emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  788. client_print(id, print_center, "Normal Mode")
  789. }
  790. }
  791. else {
  792. mode[id] = 2
  793. modetext = "Heat-Seeking"
  794. ammo_hud(id, 0)
  795. ammo_hud(id, 1)
  796. check_model(id)
  797. emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  798. client_print(id, print_center, "The other modes are restricted")
  799. }
  800. }
  801. case 3: {
  802. get_restrict_flags()
  803. if ((iFlags&BA_NORMAL) != BA_NORMAL) {
  804. if (!cantplantbomb && !cantswitch && iTeam&CS_TEAM_T) {
  805. cantswitch = true
  806. mode[id] = 4
  807. modetext = "C4"
  808. ammo_hud(id, 0)
  809. ammo_hud(id, 1)
  810. cs_set_user_plant(id,1,1)
  811. check_model(id)
  812. emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  813. client_print(id, print_center, "Switching to C4 Bomb")
  814. }
  815. else if (cantplantbomb || cantswitch || iTeam&CS_TEAM_CT){
  816. mode[id] = 1
  817. modetext = "Bazooka"
  818. ammo_hud(id, 0)
  819. ammo_hud(id, 1)
  820. check_model(id)
  821. emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  822. client_print(id, print_center, "Normal Mode")
  823. }
  824. }
  825. else if ((iFlags&BA_HEAT) != BA_HEAT){
  826. mode[id] = 2
  827. modetext = "Heat-Seeking"
  828. ammo_hud(id, 0)
  829. ammo_hud(id, 1)
  830. check_model(id)
  831. emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  832. emit_sound(id, CHAN_WEAPON, "items/nvg_on.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  833. client_print(id, print_center, "Heat-Seeking Mode")
  834. }
  835. else {
  836. mode[id] = 3
  837. modetext = "User-Guided"
  838. ammo_hud(id, 0)
  839. ammo_hud(id, 1)
  840. check_model(id)
  841. emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  842. client_print(id, print_center, "The other modes are restricted")
  843. }
  844. }
  845. case 4: {
  846. get_restrict_flags()
  847. if ((iFlags&BA_NORMAL) != BA_NORMAL) {
  848. cantswitch = false
  849. mode[id] = 1
  850. modetext = "Bazooka"
  851. ammo_hud(id, 0)
  852. ammo_hud(id, 1)
  853. cs_set_user_plant(id,0,0)
  854. check_model(id)
  855. emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  856. client_print(id, print_center, "Switching to Bazooka")
  857. }
  858. else if ((iFlags&BA_HEAT) != BA_HEAT) {
  859. cantswitch = false
  860. mode[id] = 2
  861. modetext = "Heat-Seeking"
  862. ammo_hud(id, 0)
  863. ammo_hud(id, 1)
  864. cs_set_user_plant(id,0,0)
  865. check_model(id)
  866. emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  867. emit_sound(id, CHAN_WEAPON, "items/nvg_on.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  868. client_print(id, print_center, "Heat-Seeking Mode")
  869. }
  870. else if ((iFlags&BA_USER) != BA_USER) {
  871. cantswitch = false
  872. mode[id] = 3
  873. modetext = "User-Guided"
  874. ammo_hud(id, 0)
  875. ammo_hud(id, 1)
  876. cs_set_user_plant(id,0,0)
  877. check_model(id)
  878. emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  879. emit_sound(id, CHAN_WEAPON, "items/gunpickup4.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  880. client_print(id, print_center, "User-Guided Mode")
  881. }
  882. else {
  883. cantswitch = true
  884. mode[id] = 4
  885. modetext = "C4"
  886. ammo_hud(id, 0)
  887. ammo_hud(id, 1)
  888. cs_set_user_plant(id,1,1)
  889. check_model(id)
  890. emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  891. client_print(id, print_center, "The other modes are restricted")
  892. }
  893. }
  894. }
  895. }
  896. }
  897. }
  898. if (user_controll[id] > 0) {
  899. new RocketEnt = user_controll[id]
  900. if (is_valid_ent(RocketEnt)) {
  901. new Float:Velocity[3]
  902. VelocityByAim(id, 500, Velocity)
  903. entity_set_vector(RocketEnt, EV_VEC_velocity, Velocity)
  904. new Float:NewAngle[3]
  905. entity_get_vector(id, EV_VEC_v_angle, NewAngle)
  906. entity_set_vector(RocketEnt, EV_VEC_angles, NewAngle)
  907. }
  908. else {
  909. attach_view(id, id)
  910. }
  911. }
  912. return FMRES_IGNORED
  913. }
  914.  
  915. public forward_setmodel(entity, model[]) {
  916. if (!is_valid_ent(entity)) {
  917. return FMRES_IGNORED
  918. }
  919. if (equal(model, "models/w_backpack.mdl")) {
  920. client_print(0, print_center, "")
  921. new ClassName[32]
  922. entity_get_string(entity, EV_SZ_classname, ClassName, 31)
  923.  
  924. if (equal(ClassName, "weaponbox")) {
  925.  
  926. remove_entity(entity)
  927.  
  928. return FMRES_SUPERCEDE
  929. }
  930. }
  931. return FMRES_IGNORED
  932. }
  933.  
  934. public check_model(id) {
  935. new weaponid, clip, ammo
  936. weaponid = get_user_weapon(id, clip, ammo)
  937. if ((weaponid == CSW_C4) && (cs_get_user_plant(id) != 1) && (mode[id] != 4)) {
  938. ammo_hud(id, 0)
  939. ammo_hud(id, 1)
  940. entity_set_string(id, EV_SZ_viewmodel, "models/v_rpg.mdl")
  941. entity_set_string(id, EV_SZ_weaponmodel, "models/p_rpg.mdl")
  942. }
  943. else if ((weaponid == CSW_C4) && (cs_get_user_plant(id) == 1) && (mode[id] == 4)) {
  944. ammo_hud(id, 0)
  945. ammo_hud(id, 1)
  946. entity_set_string(id, EV_SZ_viewmodel, "models/v_c4.mdl")
  947. entity_set_string(id, EV_SZ_weaponmodel, "models/p_c4.mdl")
  948. }
  949. return PLUGIN_HANDLED
  950. }
  951.  
  952. public client_connect(id) {
  953. CanShoot[id] = true
  954. Munni[id] = 0
  955. mode[id] = 1
  956. hasBazooka[id] = false
  957. }
  958.  
  959. ammo_hud(id, show) {
  960. new AmmoHud[65]
  961. if (get_cvar_num("amx_bazooka_arena") == 1) {
  962. format(AmmoHud, 64, "Rockets: Infinite | Mode: %s",modetext)
  963. }
  964. else {
  965. format(AmmoHud, 64, "Rockets: %i | Mode: %s", Munni[id],modetext)
  966. }
  967.  
  968. if (show) {
  969. message_begin(MSG_ONE, get_user_msgid("StatusText"), {0,0,0}, id)
  970. write_byte(0)
  971. write_string(AmmoHud)
  972. message_end()
  973. }
  974. else {
  975. message_begin(MSG_ONE, get_user_msgid("StatusText"), {0,0,0}, id)
  976. write_byte(0)
  977. write_string("")
  978. message_end()
  979. }
  980. }
  981.  
  982. public player_die(id) {
  983.  
  984. new victim
  985. victim = read_data(2)
  986. ammo_hud(victim, 0)
  987. Munni[victim] = 0
  988. hasBazooka[victim] = false
  989. if ((cs_get_user_plant(victim) == 1) || cantswitch) {
  990. cs_set_user_plant(victim,0,0)
  991. cantswitch = false
  992. }
  993. }
  994.  
  995. public player_spawn() {
  996. new players[32], count
  997. get_players(players, count)
  998. for (new i = 0; i < count; i++) {
  999. if (is_user_alive(players[i])) {
  1000. new v_oldmodel[64], p_oldmodel[64]
  1001. entity_get_string(players[i], EV_SZ_viewmodel, v_oldmodel, 63)
  1002. entity_get_string(players[i], EV_SZ_weaponmodel, p_oldmodel, 63)
  1003. if (equal(v_oldmodel, "models/v_rpg.mdl") || equal(p_oldmodel, "models/p_rpg.mdl")) {
  1004. if (!hasBazooka[players[i]]) {
  1005. new weaponid, clip, ammo
  1006. weaponid = get_user_weapon(players[i], clip, ammo)
  1007.  
  1008. new weaponname[64]
  1009. get_weaponname(weaponid, weaponname, 63)
  1010.  
  1011. new v_model[64], p_model[64]
  1012. format(v_model, 63, "%s", weaponname)
  1013. format(p_model, 63, "%s", weaponname)
  1014.  
  1015. replace(v_model, 63, "weapon_", "v_")
  1016. format(v_model, 63, "models/%s.mdl", v_model)
  1017. entity_set_string(players[i], EV_SZ_viewmodel, v_model)
  1018.  
  1019. replace(p_model, 63, "weapon_", "p_")
  1020. format(p_model, 63, "models/%s.mdl", p_model)
  1021. entity_set_string(players[i], EV_SZ_weaponmodel, p_model)
  1022. }
  1023. }
  1024. }
  1025. }
  1026.  
  1027. new TempRocket = find_ent_by_class(-1, "rpgrocket")
  1028. while (TempRocket > 0) {
  1029. remove_entity(TempRocket)
  1030. TempRocket = find_ent_by_class(TempRocket, "rpgrocket")
  1031. }
  1032.  
  1033. new TempRPG = find_ent_by_class(-1, "rpg_temp")
  1034. while (TempRPG > 0) {
  1035. remove_entity(TempRPG)
  1036. TempRPG = find_ent_by_class(TempRPG, "rpg_temp")
  1037. }
  1038.  
  1039. return PLUGIN_HANDLED
  1040. }
  1041.  
  1042. public handle_drop(id) {
  1043. if (read_argc() > 1) {
  1044. new weapon[17]
  1045. read_argv(1, weapon, 16)
  1046. if (equal(weapon, "weapon_c4")) {
  1047. new weapons[32], count
  1048. get_user_weapons(id, weapons, count)
  1049. for (new i = 0; i < count; i++) {
  1050. if (weapons[i] == 6) {
  1051. if (get_cvar_num("amx_bazooka_dropping") == 1) {
  1052. drop_rpg_temp(id)
  1053. }
  1054. else {
  1055. client_print(id, print_center, "This weapon cannot be dropped")
  1056. return PLUGIN_HANDLED
  1057. }
  1058. }
  1059. }
  1060. }
  1061. }
  1062. else {
  1063. new weaponid, clip, ammo
  1064. weaponid = get_user_weapon(id, clip, ammo)
  1065. if (weaponid == CSW_C4) {
  1066. if (get_cvar_num("amx_bazooka_dropping") == 1) {
  1067. drop_rpg_temp(id)
  1068. }
  1069. else {
  1070. client_print(id, print_center, "This weapon cannot be dropped")
  1071. return PLUGIN_HANDLED
  1072. }
  1073. }
  1074. }
  1075.  
  1076. return PLUGIN_CONTINUE
  1077. }
  1078.  
  1079. public drop_rpg_temp(id) {
  1080.  
  1081. new Float:PlayerOrigin[3], Float:End[3], Float:Return[3], Float:TraceDirection[3], Float:Angles[3]
  1082. entity_get_vector(id, EV_VEC_origin, PlayerOrigin)
  1083. entity_get_vector(id, EV_VEC_angles, Angles)
  1084. VelocityByAim(id, 200, TraceDirection)
  1085.  
  1086. End[0] = TraceDirection[0] + PlayerOrigin[0]
  1087. End[1] = TraceDirection[1] + PlayerOrigin[1]
  1088. End[2] = TraceDirection[2] + PlayerOrigin[2]
  1089.  
  1090. trace_line(id, PlayerOrigin, End, Return)
  1091. Return[2] = PlayerOrigin[2]
  1092.  
  1093. new RPG = create_entity("info_target")
  1094. entity_set_string(RPG, EV_SZ_classname, "rpg_temp")
  1095. entity_set_model(RPG, "models/w_rpg.mdl")
  1096. entity_set_origin(RPG, Return)
  1097.  
  1098. Angles[0] = 0.0
  1099. Angles[2] = 0.0
  1100.  
  1101. entity_set_vector(RPG, EV_VEC_angles, Angles)
  1102.  
  1103. new Float:MinBox[3] = {-16.0, -16.0, 0.0}
  1104. new Float:MaxBox[3] = {16.0, 16.0, 16.0}
  1105. entity_set_vector(RPG, EV_VEC_mins, MinBox)
  1106. entity_set_vector(RPG, EV_VEC_maxs, MaxBox)
  1107.  
  1108. entity_set_int(RPG, EV_INT_solid, 1)
  1109. entity_set_int(RPG, EV_INT_movetype, 6)
  1110.  
  1111. entity_set_int(RPG, EV_INT_iuser1, Munni[id])
  1112.  
  1113. Munni[id] = 0
  1114. hasBazooka[id] = false
  1115.  
  1116. return PLUGIN_HANDLED
  1117. }
  1118.  
  1119. public handle_say(id) {
  1120. new command[32]
  1121. read_argv(1, command, 31)
  1122.  
  1123. if (equal(command, "buybazooka")) {
  1124. if (is_user_alive(id)) {
  1125. if (get_cvar_num("amx_bazooka_buyable") == 1) {
  1126. show_buymenu(id)
  1127. }
  1128. else {
  1129. client_print(id, print_chat, "[Bazooka] The buymenu is disabled!")
  1130. }
  1131. }
  1132. else {
  1133. client_print(id, print_chat, "[Bazooka] You cannot buy a Bazooka while you are dead!")
  1134. }
  1135. }
  1136. if (equal(command, "bazookahelp"))
  1137. {
  1138. // Display Help File from amxx/configs/bazooka_help.htm
  1139. new szHelpFile[64], szCustomDir[32]
  1140. get_customdir( szCustomDir, 31 )
  1141. format( szHelpFile, 63, "%s/bazooka_help.htm", szCustomDir )
  1142. show_motd( id, szHelpFile, "Bazooka - Help" )
  1143. return PLUGIN_CONTINUE
  1144. }
  1145.  
  1146. return PLUGIN_CONTINUE
  1147. }
  1148.  
  1149. public show_buymenu(id) {
  1150.  
  1151. new MenuBody[256]
  1152. new len = format(MenuBody, 255, "\yBuy Item^n^n")
  1153. len = len + format(MenuBody[len], 255 - len, "\w1. Bazooka\R$%d^n", get_cvar_num("amx_bazooka_cost"))
  1154. len = len + format(MenuBody[len], 255 - len, "^n\w0. Exit^n")
  1155.  
  1156. new keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9)
  1157.  
  1158. show_menu(id, keys, MenuBody, -1, "Bazooka Menu")
  1159.  
  1160. return PLUGIN_HANDLED
  1161. }
  1162.  
  1163. public cmdBazooka_give(id, level, cid) {
  1164. if (!cmd_access(id, level, cid, 3)) {
  1165. return PLUGIN_HANDLED
  1166. }
  1167.  
  1168. new arg[32], arg2[8], name2[32], ammo
  1169. ammo=get_cvar_num("amx_bazooka_ammo")
  1170. read_argv(1,arg,31)
  1171. read_argv(2,arg2,7)
  1172. if ( equali(arg,"@all") )
  1173. {
  1174. new plist[32],pnum
  1175. get_players(plist,pnum,"a")
  1176. if (pnum==0)
  1177. {
  1178. console_print(id,"[Bazooka] This client is invalid")
  1179. return PLUGIN_HANDLED
  1180. }
  1181. for (new i=0; i<pnum; i++)
  1182. {
  1183. give_item(plist[i], "weapon_c4")
  1184. hasBazooka[plist[i]] = true
  1185. Munni[plist[i]] += ((str_to_num(arg2))*ammo)
  1186. ammo_hud(plist[i], 0)
  1187. ammo_hud(plist[i], 1)
  1188. check_model(id)
  1189. client_print(plist[i], print_chat, "[Bazooka] The Admin gave you a bazooka with %s rockets!",arg2)
  1190. client_print(plist[i], print_chat, "[Bazooka] Switch to the bomb weapon or weapon slot 5 to use it")
  1191. console_print(id,"[Bazooka] Gave all players bazookas with %s rockets",arg2)
  1192. }
  1193. }
  1194. else
  1195. {
  1196. get_user_name(id,name2,31)
  1197. new player = cmd_target(id,arg,7)
  1198. if (!player)
  1199. {
  1200. console_print(id,"[Bazooka] Give Bazooka Failed")
  1201. return PLUGIN_HANDLED
  1202. }
  1203. new name[32]
  1204. get_user_name(player,name,31)
  1205. give_item(player, "weapon_c4")
  1206. hasBazooka[player] = true
  1207. Munni[player] += ((str_to_num(arg2))*ammo)
  1208. ammo_hud(player, 0)
  1209. ammo_hud(player, 1)
  1210. check_model(id)
  1211. console_print(id,"[Bazooka] Gave %s %s Bazookas",name,arg2)
  1212. client_print(player, print_chat, "[Bazooka] The Admin gave you a bazooka with %s rockets!",arg2)
  1213. client_print(player, print_chat, "[Bazooka] Switch to the bomb weapon or weapon slot 5 to use it.")
  1214. return PLUGIN_HANDLED
  1215. }
  1216. return PLUGIN_HANDLED
  1217. }
  1218.  
  1219. public do_bazookamenu(id, key) {
  1220. switch(key) {
  1221. case 0: {
  1222. if (cs_get_user_money(id) >= get_cvar_num("amx_bazooka_cost")) {
  1223.  
  1224. give_item(id, "weapon_c4")
  1225. hasBazooka[id] = true
  1226. Munni[id] = Munni[id] + get_cvar_num("amx_bazooka_ammo")
  1227. ammo_hud(id, 0)
  1228. ammo_hud(id, 1)
  1229. cs_set_user_money(id, cs_get_user_money(id) - get_cvar_num("amx_bazooka_cost"))
  1230. client_print(id, print_chat, "[Bazooka] You have successfully bought a bazooka!")
  1231. client_print(id, print_chat, "[Bazooka] What are you going to do now!?")
  1232. }
  1233. else {
  1234. client_print(id, print_center, "Oh no you don't! You're too poor to buy one of these suckers!")
  1235. }
  1236. }
  1237. case 9: {
  1238. }
  1239. default: {
  1240. show_buymenu(id)
  1241. }
  1242. }
  1243.  
  1244. return PLUGIN_HANDLED
  1245. }
  1246. /************************************************************
  1247. * GIB FUNCTIONS (made by mike_cao)
  1248. ************************************************************/
  1249.  
  1250. public event_respawn(id)
  1251. {
  1252. gHealthIndex[id] = get_user_health(id)
  1253. fx_trans(id,255)
  1254. return PLUGIN_CONTINUE
  1255. }
  1256.  
  1257. static fx_trans(player,amount)
  1258. {
  1259. set_user_rendering(player,kRenderFxNone,0,0,0,kRenderTransAlpha,amount)
  1260. return PLUGIN_CONTINUE
  1261. }
  1262.  
  1263. static fx_blood_small(origin[3],num)
  1264. {
  1265. // Blood decals
  1266. #if CZERO
  1267. static const blood_small[8] = {202,203,204,205,206,207,208,209}
  1268. #else
  1269. static const blood_small[7] = {190,191,192,193,194,195,197}
  1270. #endif
  1271. // Small splash
  1272. for (new j = 0; j < num; j++) {
  1273. message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
  1274. write_byte(TE_WORLDDECAL)
  1275. write_coord(origin[0]+random_num(-100,100))
  1276. write_coord(origin[1]+random_num(-100,100))
  1277. write_coord(origin[2]-36)
  1278. write_byte(blood_small[random_num(0,6)]) // index
  1279. message_end()
  1280. }
  1281. }
  1282.  
  1283. static fx_blood_large(origin[3],num)
  1284. {
  1285. // Blood decals
  1286. #if CZERO
  1287. static const blood_large[2] = {216,217}
  1288. #else
  1289. static const blood_large[2] = {204,205}
  1290. #endif
  1291.  
  1292. // Large splash
  1293. for (new i = 0; i < num; i++) {
  1294. message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
  1295. write_byte(TE_WORLDDECAL)
  1296. write_coord(origin[0]+random_num(-50,50))
  1297. write_coord(origin[1]+random_num(-50,50))
  1298. write_coord(origin[2]-36)
  1299. write_byte(blood_large[random_num(0,1)]) // index
  1300. message_end()
  1301. }
  1302. }
  1303.  
  1304. static fx_gib_explode(origin[3],num)
  1305. {
  1306. new flesh[3], x, y, z
  1307. flesh[0] = mdl_gib_flesh
  1308. flesh[1] = mdl_gib_meat
  1309. flesh[2] = mdl_gib_legbone
  1310.  
  1311. // Gib explosion
  1312. // Head
  1313. message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
  1314. write_byte(TE_MODEL)
  1315. write_coord(origin[0])
  1316. write_coord(origin[1])
  1317. write_coord(origin[2])
  1318. write_coord(random_num(-100,100))
  1319. write_coord(random_num(-100,100))
  1320. write_coord(random_num(100,200))
  1321. write_angle(random_num(0,360))
  1322. write_short(mdl_gib_head)
  1323. write_byte(0) // bounce
  1324. write_byte(500) // life
  1325. message_end()
  1326.  
  1327. // Spine
  1328. message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
  1329. write_byte(TE_MODEL)
  1330. write_coord(origin[0])
  1331. write_coord(origin[1])
  1332. write_coord(origin[2])
  1333. write_coord(random_num(-100,100))
  1334. write_coord(random_num(-100,100))
  1335. write_coord(random_num(100,200))
  1336. write_angle(random_num(0,360))
  1337. write_short(mdl_gib_spine)
  1338. write_byte(0) // bounce
  1339. write_byte(500) // life
  1340. message_end()
  1341.  
  1342. // Lung
  1343. for(new i = 0; i < random_num(1,2); i++) {
  1344. message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
  1345. write_byte(TE_MODEL)
  1346. write_coord(origin[0])
  1347. write_coord(origin[1])
  1348. write_coord(origin[2])
  1349. write_coord(random_num(-100,100))
  1350. write_coord(random_num(-100,100))
  1351. write_coord(random_num(100,200))
  1352. write_angle(random_num(0,360))
  1353. write_short(mdl_gib_lung)
  1354. write_byte(0) // bounce
  1355. write_byte(500) // life
  1356. message_end()
  1357. }
  1358.  
  1359. // Parts, 10 times
  1360. for(new i = 0; i < 10; i++) {
  1361. message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
  1362. write_byte(TE_MODEL)
  1363. write_coord(origin[0])
  1364. write_coord(origin[1])
  1365. write_coord(origin[2])
  1366. write_coord(random_num(-100,100))
  1367. write_coord(random_num(-100,100))
  1368. write_coord(random_num(100,200))
  1369. write_angle(random_num(0,360))
  1370. write_short(flesh[random_num(0,2)])
  1371. write_byte(0) // bounce
  1372. write_byte(500) // life
  1373. message_end()
  1374. }
  1375.  
  1376. // Blood
  1377. for(new i = 0; i < num; i++) {
  1378. x = random_num(-100,100)
  1379. y = random_num(-100,100)
  1380. z = random_num(0,100)
  1381. for(new j = 0; j < 3; j++) {
  1382. message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
  1383. write_byte(TE_BLOODSPRITE)
  1384. write_coord(origin[0]+(x*j))
  1385. write_coord(origin[1]+(y*j))
  1386. write_coord(origin[2]+(z*j))
  1387. write_short(spr_blood_spray)
  1388. write_short(spr_blood_drop)
  1389. write_byte(229) // color index
  1390. write_byte(15) // size
  1391. message_end()
  1392. }
  1393. }
  1394. }
  1395.  
[/ablak]

Van ez a rész:
SMA Forráskód: [ Mindet kijelol ]
  1. else if (mode[id] == 3) {
  2. entity_set_int(RocketEnt, EV_INT_rendermode, 1)
  3. attach_view(id, RocketEnt)
  4. user_controll[id] = RocketEnt
  5. }


(379-383 sor) ezt elvileg arra való, hogy belső nézetből tudjuk a rakétát irányítani.
Az lenne a kérésem, hogy valaki ki tudja írni belőle ezt a belső nézetes irányításos rakátét, egy külön pluginba, ami parancsra csinálná ez?

Köszi előre is!


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  [ 1 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 12 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