vexdum crashes server???

New Member
Joined
May 31, 2004
Messages
30
Best answers
0
Okaaay everything got fixed now CEPT THAT:

the amx_ejl_missiles.sma plugin that killedwithstyle recommended crashes my server when I specify a DEADLY value (0|1: non-lethal or lethal)

Any idea on how to fix this? :D
 
Senior Member
★ Black Lounger ★
✔️ HL Verified
💻 Oldtimer
Joined
Feb 17, 2003
Messages
1,483
Best answers
0
You use AMX mod X.

And you are supposed to include the fun module and the engine module for vexd utlities to work with AMX mod X.
 
New Member
Joined
May 31, 2004
Messages
30
Best answers
0
check last post.. why cant I delete mid-conversation posts?
 
Senior Member
★ Black Lounger ★
✔️ HL Verified
💻 Oldtimer
Joined
Feb 17, 2003
Messages
1,483
Best answers
0
NO I said put ON the modules for fun and engine, not include stuff that makes the file bigger.

And that appears that the code is wrong. Index out of bounds simply means this:

There is an array that is X size. The code sees 1 as 0 and 2 as 1 etc etc etc.
So the code should only go to X-1.
What makes that error happen is if the following happenes:
say X is 5.
you call the index for the array at number 5 or above (istead of 4)
It will now send that error.


Maby if you show me the danged code I could fix it. But right now I am going off of incomplete ideas.
 
New Member
Joined
May 31, 2004
Messages
30
Best answers
0
o_O the same code DID work on a previous AMX version.. I believe 0.9.6 beta or w/e., in asskickr's sig on the amx forums lol...

AND THIS is also EXACTLY what I got the same errors with as above.
Here's the full code:

Code:
#include <amxmod> 
#include <amxmisc>
#include <string>
#include <float>
#include <Vexd_Utilities>

new beam, boom

public vexd_pfntouch(pToucher, pTouched) {
	new szClassName[32]
	Entvars_Get_String(pToucher, EV_SZ_classname, szClassName, 32);

	if(equal(szClassName, "vexd_rocket")) {
		emit_sound(pToucher, CHAN_WEAPON, "vox/_period.wav", 1.0, ATTN_NORM, 0, PITCH_NORM) 
		emit_sound(pToucher, CHAN_VOICE, "vox/_period.wav", 1.0, ATTN_NORM, 0, PITCH_NORM) 

		new Float:vExplodeAt[3]
		Entvars_Get_Vector(pToucher, EV_VEC_origin, vExplodeAt)

		RadiusDamage(vExplodeAt, 1)

		message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
		write_byte(3)
		write_coord(floatround(vExplodeAt[0]))
		write_coord(floatround(vExplodeAt[1]))
		write_coord(floatround(vExplodeAt[2]))
		write_short(boom)
		write_byte(50)
		write_byte(15)
		write_byte(0)
		message_end()

		new iOwner
		iOwner = Entvars_Get_Edict(pToucher, EV_ENT_owner)

		AttachView(iOwner, iOwner)	//Resets rocket owner's view (in case of vrocket).

		RemoveEntity(pToucher)
	}

	return 1;
}

public Vexd_CreateRocket(id,level,cid){ 
	if (!cmd_access(id,level,cid,1)) 
		return PLUGIN_HANDLED

	new Float:vOrigin[3]
	new Float:vAngles[3]
	Entvars_Get_Vector(id, EV_VEC_origin, vOrigin)
	Entvars_Get_Vector(id, EV_VEC_v_angle, vAngles)

        new NewEnt
        NewEnt = CreateEntity("info_target")

        if(NewEnt == 0) {
            return PLUGIN_HANDLED_MAIN
        }

	Entvars_Set_String(NewEnt, EV_SZ_classname, "vexd_rocket")

        ENT_SetModel(NewEnt, "models/rpgrocket.mdl")

	new Float:MinBox[3]
	new Float:MaxBox[3]
	MinBox[0] = -1.0
	MinBox[1] = -1.0
	MinBox[2] = -1.0
	MaxBox[0] = 1.0
	MaxBox[1] = 1.0
	MaxBox[2] = 1.0

	Entvars_Set_Vector(NewEnt, EV_VEC_mins, MinBox)
	Entvars_Set_Vector(NewEnt, EV_VEC_maxs, MaxBox)

	ENT_SetOrigin(NewEnt, vOrigin)
	Entvars_Set_Vector(NewEnt, EV_VEC_angles, vAngles)

	Entvars_Set_Int(NewEnt, EV_INT_effects, 64)  //64 = EF_LIGHT, rocket glow. 64??
	Entvars_Set_Int(NewEnt, EV_INT_solid, 2)    //2 = Solid bbox. (const.h)
	Entvars_Set_Int(NewEnt, EV_INT_movetype, 5) //5 = movetype_fly, No grav, but collides.
	Entvars_Set_Edict(NewEnt, EV_ENT_owner, id)


	new Float:fNewVelocity[3] 
	VelocityByAim(id, 400, fNewVelocity)
	Entvars_Set_Vector(NewEnt, EV_VEC_velocity, fNewVelocity)

	message_begin(MSG_BROADCAST, SVC_TEMPENTITY) 
	write_byte(22) 
	write_short(NewEnt) 
	write_short(beam) 
	write_byte(45) 
	write_byte(4) 
	write_byte(255) 
	write_byte(0) 
	write_byte(0) 
	write_byte(128)
	message_end() 

	emit_sound(NewEnt, CHAN_WEAPON, "weapons/rocketfire1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
	emit_sound(NewEnt, CHAN_VOICE, "weapons/rocket1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)

	return PLUGIN_HANDLED_MAIN
}

public Vexd_CreateVRocket(id,level,cid){ 
	if (!cmd_access(id,level,cid,1)) 
		return PLUGIN_HANDLED

	new Float:vOrigin[3]
	new Float:vAngles[3]
	Entvars_Get_Vector(id, EV_VEC_origin, vOrigin)
	Entvars_Get_Vector(id, EV_VEC_v_angle, vAngles)

        new NewEnt
        NewEnt = CreateEntity("info_target")

        if(NewEnt == 0) {
            return PLUGIN_HANDLED_MAIN
        }

	Entvars_Set_String(NewEnt, EV_SZ_classname, "vexd_rocket")

        ENT_SetModel(NewEnt, "models/rpgrocket.mdl")

	new Float:MinBox[3]
	new Float:MaxBox[3]

	MinBox[0] = -1.0
	MinBox[1] = -1.0
	MinBox[2] = -1.0
	MaxBox[0] = 1.0
	MaxBox[1] = 1.0
	MaxBox[2] = 1.0

	Entvars_Set_Vector(NewEnt, EV_VEC_mins, MinBox)
	Entvars_Set_Vector(NewEnt, EV_VEC_maxs, MaxBox)

	ENT_SetOrigin(NewEnt, vOrigin)
	Entvars_Set_Vector(NewEnt, EV_VEC_angles, vAngles)

	Entvars_Set_Int(NewEnt, EV_INT_effects, 1)  //1 = EF_LIGHT, rocket glow. 64??
	Entvars_Set_Int(NewEnt, EV_INT_solid, 2)    //2 = Solid bbox. (const.h)
	Entvars_Set_Int(NewEnt, EV_INT_movetype, 5) //5 = movetype_fly, No grav, but collides.
	Entvars_Set_Edict(NewEnt, EV_ENT_owner, id)


	new Float:fNewVelocity[3] 
	VelocityByAim(id, 400, fNewVelocity)
	Entvars_Set_Vector(NewEnt, EV_VEC_velocity, fNewVelocity)

	message_begin(MSG_BROADCAST, SVC_TEMPENTITY) 
	write_byte(22) 
	write_short(NewEnt) 
	write_short(beam) 
	write_byte(45) 
	write_byte(4) 
	write_byte(255) 
	write_byte(0) 
	write_byte(0) 
	write_byte(128)
	message_end() 

	emit_sound(NewEnt, CHAN_WEAPON, "weapons/rocketfire1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
	emit_sound(NewEnt, CHAN_VOICE, "weapons/rocket1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)

	AttachView(id, NewEnt)

	return PLUGIN_HANDLED_MAIN
}

public plugin_init(){ 
    register_plugin("Vexd Entity demo (Rocket)","1.00","default") 
    register_concmd("amx_rocket","Vexd_CreateRocket",ADMIN_KICK)
    register_concmd("amx_vrocket","Vexd_CreateVRocket",ADMIN_KICK)

    return PLUGIN_CONTINUE 
}

public plugin_precache() {
	precache_sound("vox/_period.wav")
	precache_sound("weapons/rocketfire1.wav") 
	precache_sound("weapons/rocket1.wav") 
	precache_model("models/rpgrocket.mdl")
	beam = precache_model("sprites/laserbeam.spr")
	boom = precache_model("sprites/zerogxplode.spr")

	return PLUGIN_CONTINUE 
}

And that AMXX version, the latest one im talking about:
AMXX version 20 RC-7 is the one im using right nOW
 
Senior Member
★ Black Lounger ★
✔️ HL Verified
💻 Oldtimer
Joined
Feb 17, 2003
Messages
1,483
Best answers
0
First note:
Looking at the code, you will have to enable the array module
Second note:
There is no fExplodeAt
Third note:
Code:
new Float:vExplodeAt[3]
Entvars_Get_Vector(pToucher, EV_VEC_origin, vExplodeAt)

RadiusDamage(vExplodeAt, 1)

message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(3)
write_coord(floatround(vExplodeAt[0]))
write_coord(floatround(vExplodeAt[1]))
write_coord(floatround(vExplodeAt[2]))
These are the only lines of code that deal with a cvar similar to it which is vExplodeAt. As far as I can tell the only problem with code would be:
Code:
Entvars_Get_Vector(pToucher, EV_VEC_origin, vExplodeAt)
I will look this up on the CVS and see what is wrong with it.




*edit* None of the cvs stated those functions...

I perfer the following one better.
http://www.amxmodx.org/forums/viewtopic.php?t=4544
Have fun.
 
New Member
Joined
May 31, 2004
Messages
30
Best answers
0
RAAAAH

I'm using the one u gave the link for now BUT:
it crashes when someone gets HIT by a missile, NO matter if its set on TEST, NON-DEADLY, or DEADLY.

How the hell?! Its pissing me off! ;( ;(

What I THOUGHT IT was is that it contains this:

Code:
[b]set_msg_block(gmsgDeathMsg,BLOCK_ONCE)
set_msg_block(gmsgScoreInfo,BLOCK_ONCE)[/b]
user_kill(victim,1)
replace_dm(attacker,victim,0)
But that doesn't appear to be it. (not like I know THAT much about it)

THe ERROR that comes with this is SOMETHING like this:
Code:
User Msg(ScoreInfo) byte 9, expected 11
 
Senior Member
★ Black Lounger ★
✔️ HL Verified
💻 Oldtimer
Joined
Feb 17, 2003
Messages
1,483
Best answers
0
Calm down. This file did work in 1.0 I havent used it since. Let me look at the file and see what I could do.


*edit* Note 1:
#define CSTRIKE was on.
Note 2:
I reconize this "ScoreInfo" as a command that ESF hates. If this doesnt work, I will edit it one more thime.

Changed Code
Code:
/* AMX Mod X script.
*
*   Missiles Launcher (amx_ejl_missiles.sma)
*   Copyright (C) 2003-2004  Eric Lidman / jtp10181
*
*   This program is free software; you can redistribute it and/or
*   modify it under the terms of the GNU General Public License
*   as published by the Free Software Foundation; either version 2
*   of the License, or (at your option) any later version.
*
*   This program is distributed in the hope that it will be useful,
*   but WITHOUT ANY WARRANTY; without even the implied warranty of
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*   GNU General Public License for more details.
*
*   You should have received a copy of the GNU General Public License
*   along with this program; if not, write to the Free Software
*   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*
*   In addition, as a special exception, the author gives permission to
*   link the code of this program with the Half-Life Game Engine ("HL
*   Engine") and Modified Game Libraries ("MODs") developed by Valve,
*   L.L.C ("Valve"). You must obey the GNU General Public License in all
*   respects for all of the code used other than the HL Engine and MODs
*   from Valve. If you modify this file, you may extend this exception
*   to your version of the file, but you are not obligated to do so. If
*   you do not wish to do so, delete this exception statement from your
*   version.
*
****************************************************************************
*
*   Version 3.8.2 - Date: 10/02/2004
*
*   Original by Eric Lidman aka "Ludwig van" <[email protected]>
*   Homepage: http://lidmanmusic.com/cs/plugins.html
*
*   Upgraded to STEAM and ported to AMXx by: jtp10181 <[email protected]>
*   Homepage: http://www.jtpage.net
*
****************************************************************************
*
*  Add missiles to Counter-Strike. Fire a variety of types of missiles
*  including laser guided missiles, heat seeking missiles, and missiles with
*  guncam on so you see what the missile sees and control it thusly. Missiles
*  can either be bought or given free to clients and there are several options
*  for this. In game menus and help pages are included. Note: Heatseeking
*  missiles only seek running jetpacks, from the plugins "Jetpack Model No.
*  Lud1337" and "Jetpack". This has not been officially ported to AMXx yet so
*  I am unsure if it will work or not. In addition, missiles can be shot down
*  with common guns or with the laser from my "CS Laser Guns and Laser Stats"
*  plugin. If you successfully shoot down a missile with a laser, you get a
*  prize of free missiles for the remainder of the round plus extra missiles
*  for the next round.
*
*  PODBOT: If using my podbots controller, podbots use this plugin too.
*  *NOTE* PODBot code is untested in the current version,
*	the podbot controller plugin needs to be updated to AMXx first.
*
*  Admin Commands:
*
*    amx_missiles             - toggles on and off missiles enabled
*    amx_missilesbuying       - toggles on/off missile buy requirements
*
*    amx_missiles_ammo1       - # of common missiles given per round
*    amx_missiles_ammo2       - # of laserguide missiles given per round
*    amx_missiles_ammo3       - # of guncam missiles given per round
*    amx_missiles_ammo4       - # of anti-missile shots given per round
*    amx_missiles_ammo5       - # of heat-seeking missiles given per round
*    amx_missiles_ammo6       - # of rope-seeking missiles given per round
*    amx_missiles_ammo7       --# of swirling death missiles given per round
*
*
*    amx_missile1 [speed] [chicken:0|1|2] [deadly:0|1] - common missile
*    amx_missile2 [speed] [chicken:0|1|2] [deadly:0|1] - laser guided missile
*    amx_missile3 [speed] [chicken:0|1|2] [deadly:0|1] - gun camera missile
*    amx_missile5 [speed] [chicken:0|1|2] [deadly:0|1] - heat-seeking missile
*    amx_missile6 [speed] [chicken:0|1|2] [deadly:0|1] - rope-seeking missile
*    amx_missile7 [speed] [chicken:0|1|2] [deadly:0|1] - swirling death missile
*
*   Examples:
*
*    amx_missile2 2000 0 0   - fires fast non-lethal laserguided missile
*    amx_missile5 500 1 1    - fires slow lethal jetpack seeking chicken
*
*  Client Commands:
*
*    amx_missile                - fires common missile
*    amx_laserguided_missile    - fires missile seeking red dot in aim
*    amx_guncamera_missile      - fires missile you control in camera veiw
*    amx_anti_missile           - activates antimissile system, aim at missile you want
*                                    to destroy, if it sees the missile in your aim,
*                                    it automatically launches a missile interceptor at it
*    amx_heatseeking_missile    - seeks nearest running jetpack
*    amx_ropeseeking_missile    - seeks nearest ninja-rope (lud/jtp10181's only)
*    amx_swirlingdeath_missile  - a central missile with ring of 6 (default) missiles rotating
*                                    around it. When missiles run out of fuel, they break
*                                    formation and cause massive destruction.
*
*    amx_sdmf <fuel>            - client uses this to set amount of time swirling death missile
*                                    flies until it runs out of fuel. Only works if cvar
*                                    amx_missile_allow_sdmf is 1. Default: 0
*    missile_menu               - opens the client missile menu
*    say /missile               - opens the client missile menu
*    say /missile_help          - show window with info about missles
*
*  CVARs: Paste the following into your amxx.cfg to change defaults.
*		You must uncomment cvar lines for them to take effect
*
****************************************************************************
*  CVAR CONFIG BEGIN
****************************************************************************

// ******************  Missile Settings  ******************

//1 to enable missiles, 0 to disable
//amx_luds_missiles 1

//Set to 1 to require missiles to be purchased
//amx_missile_buy 0

//
//The following "COST" settings only apply if buying mode is ON
//
//Ammount of money taken each time you fire a common missile
//amx_missile_cost1 1000

//Ammount of money taken each time you fire a laser guided missile
//amx_missile_cost2 3000

//Ammount of money taken each time you fire a gun camera missile
//amx_missile_cost3 3000

//Ammount of money taken each time you fire an anti-missile shot
//amx_missile_cost4 2000

//Ammount of money taken each time you fire a heat seeking missile
//amx_missile_cost5 4000

//Ammount of money taken each time you fire a rope seeking missile
//amx_missile_cost6 4000

//Ammount of money taken each time you fire a swirling death missile
//amx_missile_cost7 5000

//
//The following "AMMO" settings only apply if buying mode is OFF
//
//Ammount of common missiles given per round free to clients
//amx_missile_ammo1 1

//Ammount of laser guided missiles given per round free to clients
//amx_missile_ammo2 1

//Ammount of gun camera missiles given per round free to clients
//amx_missile_ammo3 1

//Ammount of anti-missile shots given per round free to clients
//amx_missile_ammo4 2

//Ammount of heat seeking missiles given per round free to clients
//amx_missile_ammo5 1

//Ammount of rope seeing missiles given per round free to clients
//amx_missile_ammo6 1

//Ammount of swirling death missiles given per round free to clients
//amx_missile_ammo7 1

//If set to 1, this cvar causes swirling death missile to use 7 missiles in the
//player's missile inventory. It draws from all types of missiles instead of
//it having its own indepedent inventory count.
//amx_missile_ammo7ta 0

//Sets the default speed of most missiles
//amx_missile_speed 1000

//Sets the speed of ropeseeking missiles
//amx_missile_rsspeed 1400

//Sets the speed of heatseeking missiles
//amx_missile_hsspeed 1100

//Number of seconds a missile is driven before it falls to the ground out of fuel
//amx_missile_fuel 6.0

//Number of seconds a swirling death missile is driven before
//it "mirvs" or breaks then falls to the ground out of fuel
//amx_missile_sdfuel 2.0

//Sets the speed of swirling death missiles
//amx_missile_sdspeed 750

//Sets the number missiles in swirling death
//amx_missile_sdcount 6

//Sets the rotation speed of swirling death
//amx_missile_sdrotate 6

//Sets the radius of swirling death missiles
//amx_missile_sdradius 32

//sets whether clients are allowed to set thier own fuel amounts
//for swirling death missile. Default 0. Enable with 1
//amx_missile_allow_sdmf 0

//makes missile obey server gravity rules, set to 0 for missiles
//that travel straight because they are not affected by gravity
//amx_missile_obeygravity 1

//Makes missile obey server friendly fire rules.
//amx_missile_obeyffcvar 1

//Max distance from the blast that damage will occur at
//amx_missile_damradius 240

//Maximum Blast damage from explsion this damage accours when distance
//is zero and decreases as the distance fomr the blast increases
//amx_missile_maxdamage 140

//For friendlyfire on, the option to punish team killer.
//Quota is from the cvar amx_missile_tkpunsish2. options:
//	0 = no action on team killer
//	1 = kick tker on tk quota
//	2 = 3 hour ban tker on quota
//	3 = always kill tker, kick on quota
//	4 = always kill tker, ban on quota
//amx_missile_tkpunish1 1

//For friendlyfire on, quantity of teammates a player can kill before a kick or ban can
//result depending on the above cvar amx_missile_tkpunish1 is set
//amx_missile_tkpunish2 3

//If in the rare event a player shoots down a missile belonging to an
//opposing player, he gets a prize, free missiles. Cvar sets
//how many of each type of missile are given
//amx_missile_prizes 5

//Sets the amount of time a player can use his anti-missile radar per round.
//amx_missile_radarbattery 100

//Since bots are stupid and waste their missiles, we give them a handicap with this
//cvar set to 1 so that bots get an unlimited quantity of missiles
//amx_missile_botsnolimit 1

//This cvar limits the two types of missiles responsible for spawn rape, guncamera and
//swirling death, from being fired until 15 seconds of a round has passed. Set cvar to 0
//to allow those missiles to be fired without being limited by round start
//amx_missile_spawndelay 0

****************************************************************************
*  CVAR CONFIG END
****************************************************************************
*
*  Additional info:
*
*  This plugin logs missile kills in the standard HL format so that stats
*  parsing programs like psychostats will record missile kills.
*
*  Big huge thanks to SpaceDude for the swirling death missile's math. He
*  basically made swirling death, sent it to me, and I put it in here.
*
*
*                 ******** Engine Module REQUIRED ********
*                   ******** FUN Module REQUIRED ********
*
*  Changelog:
*
*  v3.8.2 - JTP10181 - 10/02/04
*	- Fixed bug, menu key not being registered correctly
*	- Fixed bug, wrong cost cvar being used in heat seeking check
*
*  v3.8.1 - JTP10181 - 09/28/04
*	- Now works on AMXModX 0.20
*
*  v3.8 - JTP10181 - 07/23/04
*	- Converted MOTD boxes to work with steam and possibly with WON still
*	- Fixed all authid variables to be 34 chars so STEAMIDs are handled properly
*	- Changed wc3 specific code to use the engine module for AMXx
*	- Added code so the missile buying can only be enabled for CS
*		since the money functions are only for CS in AMXx
*	- Fixed logging to admin log for AMXx
*	- Working on non-CS support that broke with AMXx, must be a #define compile option now.
*	- Removed all DoD support as it needs ot be a totally separate plugin.
*	- Made it update the scores right away instead of waiting till next round
*	- Changed all printed messages to use the [AMXX] tag instead of [AMX]
*	- Changed death message blocking to BLOCK_ONCE for better compatibility
*	- Removed "redundant plugin" code as it was made useless by BLOCK_ONCE change
*	- Gave all missiles different colored trails (common is still white)
*	- Changed the damage system to be much more versatile.
*	- Rearranged the order of the missiles in the menu and for the command numbers
*	- Commented out bot code for now because I don't want to
*		deal with it and the interface plugin is not ported yet
*	- MANY other tweaks and fixes, too many to list.
*
*  Below v3.8 was maintained by Eric Lidman
*
**************************************************************************/

//Comment this line out for mods other than cstrike
//#define CSTRIKE

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fun>

#if defined CSTRIKE
#include <cstrike>
#endif

//Set this to the admin level at which
//they are allowed to fire multiple missiles at once
#define ADMIN_MULTISHOT ADMIN_LEVEL_D

//Set this to the admin level at which they can fire missiles
#define ADMIN_MISSILES ADMIN_LEVEL_B

//Set this to the admin level at which they can change missile settings
#define ADMIN_MISSILE_SET ADMIN_LEVEL_H

/***********************************************************************************
*                                                                                  *
*  *END* customizable section of code. other changes can be done with the cvars    *
*                                                                                  *
************************************************************************************/

#define DT 0.1
#define PI 3.1415926535897932384626433832795

new beam, boom, ls_dot
new Float:fAngle
new bool:is_cstrike
new bool:roundfreeze
new round_delay
new has_rocket[33]

/* missile_inv:  fake,common,laserguide,guncam,antimissile,heatseeker,ropeseeking,multimissile */
new missile_inv[33][8]
new missile_win[33]
new using_menu[33]
new is_scan_rocket[33]
new is_heat_rocket[33]
new radar_batt[33]
new tkcount[33]
new Float:user_sdmf[33]
new cmd_jetpackrun[33]
new cmd_onrope[33]
new gmsgDeathMsg, gmsgScoreInfo

public plugin_init(){
	register_plugin("Missiles Launcher","3.8.2","EJL/JTP10181")

	register_concmd("amx_missiles","admin_missiles",ADMIN_MISSILE_SET,"- Toggles Missiles Mode ON and OFF")
	register_concmd("amx_missilesbuying","admin_missilebuy",ADMIN_MISSILE_SET,"- Toggles Missile Buy Requirement mode ON and OFF")
	register_concmd("amx_missiles_ammo1","admin_missile_ammo",ADMIN_MISSILE_SET,"<quantity> - Common Missiles free each round if missile buying is off")
	register_concmd("amx_missiles_ammo2","admin_missile_ammo",ADMIN_MISSILE_SET,"<quantity> - Laser Guided Missiles free each round if missile buying is off")
	register_concmd("amx_missiles_ammo3","admin_missile_ammo",ADMIN_MISSILE_SET,"<quantity> - Gun Cam Missiles free each round if missile buying is off")
	register_concmd("amx_missiles_ammo4","admin_missile_ammo",ADMIN_MISSILE_SET,"<quantity> - Anti-Missile Shots free each round if missile buying is off")
	register_concmd("amx_missiles_ammo5","admin_missile_ammo",ADMIN_MISSILE_SET,"<quantity> - Heat-Seeking Missiles given per round free if missile buying is off")
	register_concmd("amx_missiles_ammo6","admin_missile_ammo",ADMIN_MISSILE_SET,"<quantity> - Rope-Seeking Missiles free each round if missile buying is off")
	register_concmd("amx_missiles_ammo7","admin_missile_ammo",ADMIN_MISSILE_SET,"<quantity> - Swirling Death Missiles free each round if missile buying is off")
	register_concmd("amx_missile1","admin_missile",ADMIN_MISSILES,"[speed] [chicken:0|1|2] [deadly:0|1] - Common Missile")
	register_concmd("amx_missile2","admin_missile",ADMIN_MISSILES,"[speed] [chicken:0|1|2] [deadly:0|1] - Laser Guided Missile")
	register_concmd("amx_missile3","admin_missile",ADMIN_MISSILES,"[speed] [chicken:0|1|2] [deadly:0|1] - Gun Cam Missile")
	register_concmd("amx_missile5","admin_missile",ADMIN_MISSILES,"[speed] [chicken:0|1|2] [deadly:0|1] - Heat-Seeking Missile")
	register_concmd("amx_missile6","admin_missile",ADMIN_MISSILES,"[speed] [chicken:0|1|2] [deadly:0|1] - Rope-Seeking Missile")
	register_concmd("amx_missile7","admin_missile",ADMIN_MISSILES,"[speed] [chicken:0|1|2] [deadly:0|1] - Swrirling Death Missile")

	register_clcmd("amx_missile","fire_missile")
	register_clcmd("amx_laserguided_missile","fire_missile")
	register_clcmd("amx_guncamera_missile","fire_missile")
	register_clcmd("amx_anti_missile","fire_missile")
	register_clcmd("amx_heatseeking_missile","fire_missile")
	register_clcmd("amx_ropeseeking_missile","fire_missile")
	register_clcmd("amx_swirlingdeath_missile","fire_missile")

	register_clcmd("amx_sdmf","player_sdmf",0,"<fuel ammount in 10ths/second>")
	register_clcmd("say", "HandleSay")
	register_clcmd("say /missile_help","rocket_motd")
	register_clcmd("say /missile","show_main_menu")
	register_clcmd("missile_menu", "show_main_menu",0,"- Brings up the missile selection menu")
	register_menucmd(register_menuid("Fire Missile Menu"),1023,"action_main_menu")
	register_srvcmd("lasermissile_chk","ls_missile_ck")
	register_srvcmd("jetpackmissile_chk","jp_missile_ck")
	register_srvcmd("ropemissile_chk","rp_missile_ck")
	//register_srvcmd("bot_missile","bot_interface")
	register_cvar("amx_luds_missiles","1",FCVAR_SERVER)
	register_cvar("amx_missile_buy","0")
	register_cvar("amx_missile_fuel","6.0")
	register_cvar("amx_missile_sdfuel","2.0")
	register_cvar("amx_missile_sdcount","6")
	register_cvar("amx_missile_sdrotate","6")
	register_cvar("amx_missile_sdradius","32")
	register_cvar("amx_missile_allow_sdmf","0")
	register_cvar("amx_missile_ammo1","2")
	register_cvar("amx_missile_ammo2","2")
	register_cvar("amx_missile_ammo3","1")
	register_cvar("amx_missile_ammo4","1")
	register_cvar("amx_missile_ammo5","1")
	register_cvar("amx_missile_ammo6","1")
	register_cvar("amx_missile_ammo7","1")
	register_cvar("amx_missile_ammo7ta","0")
	register_cvar("amx_missile_cost1","1000")
	register_cvar("amx_missile_cost2","3000")
	register_cvar("amx_missile_cost3","3000")
	register_cvar("amx_missile_cost4","2000")
	register_cvar("amx_missile_cost5","4000")
	register_cvar("amx_missile_cost6","4000")
	register_cvar("amx_missile_cost7","5000")
	register_cvar("amx_missile_speed","1000")
	register_cvar("amx_missile_sdspeed","750")
	register_cvar("amx_missile_hsspeed","1200")
	register_cvar("amx_missile_rsspeed","1200")
	register_cvar("amx_missile_obeygravity","1")
	register_cvar("amx_missile_damradius","240")
	register_cvar("amx_missile_maxdamage","140")
	register_cvar("amx_missile_obeyffcvar","1")
	register_cvar("amx_missile_tkpunish1","1")
	register_cvar("amx_missile_tkpunish2","3")
	register_cvar("amx_missile_prizes","5")
	register_cvar("amx_missile_radarbattery","100")
	register_cvar("amx_missile_botsnolimit","1")
	register_cvar("amx_missile_spawndelay","0")

	register_event("DeathMsg","death_event","a")

	#if defined CSTRIKE
	register_logevent("round_start", 2, "1=Round_Start")
	register_logevent("round_end", 2, "1=Round_End")
	#endif

	new mod_name[32]
	get_modname(mod_name,31)
	is_cstrike = equal(mod_name,"cstrike") ? true : false

	set_task(0.1,"RocketThink",30500,"",0,"b")

	gmsgDeathMsg = get_user_msgid("DeathMsg")
	//gmsgScoreInfo = get_user_msgid("ScoreInfo")
}

public plugin_precache() {

	new mod_name[32]
	get_modname(mod_name,31)
	is_cstrike = equal(mod_name,"cstrike") ? true : false

	precache_sound("vox/_period.wav")
	precache_sound("debris/beamstart8.wav")
	precache_sound("weapons/explode3.wav")
	precache_sound("weapons/rocketfire1.wav")
	precache_sound("ambience/rocket_steam1.wav")
	precache_sound("weapons/rocket1.wav")
	precache_sound("ambience/particle_suck2.wav")
	precache_sound("misc/arnold_heatseeker.wav")
	precache_model("models/rpgrocket.mdl")
	precache_model("models/hvr.mdl")

	if(is_cstrike)
	precache_model("models/chick.mdl")

	beam = precache_model("sprites/smoke.spr")
	boom = precache_model("sprites/zerogxplode.spr")
	ls_dot = precache_model("sprites/laserdot.spr")
}

public plugin_modules()
{
	require_module("fun")
	require_module("engine")
	require_module("Counter-Strike")
}

public client_connect(id) {
	is_scan_rocket[id] = 0
	is_heat_rocket[id] = 0
	using_menu[id] = 0
	has_rocket[id] = 0
	missile_win[id] = 0

	if(get_cvar_num("amx_missile_buy") == 0){
		missile_inv[id][1] = get_cvar_num("amx_missile_ammo1")
		missile_inv[id][2] = get_cvar_num("amx_missile_ammo2")
		missile_inv[id][3] = get_cvar_num("amx_missile_ammo3")
		missile_inv[id][4] = get_cvar_num("amx_missile_ammo4")
		missile_inv[id][5] = get_cvar_num("amx_missile_ammo5")
		missile_inv[id][6] = get_cvar_num("amx_missile_ammo6")
		missile_inv[id][7] = get_cvar_num("amx_missile_ammo7")
	}
	radar_batt[id] = get_cvar_num("amx_missile_radarbattery")
	tkcount[id] = 0
	user_sdmf[id] = 0.0
	cmd_jetpackrun[id] = 0
	cmd_onrope[id] = 0
}

public client_disconnect(id){
	remove_task(35632+id)
	is_scan_rocket[id] = 0
	is_heat_rocket[id] = 0
	has_rocket[id] = 0
	tkcount[id] = 0
	user_sdmf[id] = 0.0
	cmd_jetpackrun[id] = 0
	cmd_onrope[id] = 0
}

public admin_missiles(id,level,cid){
	if (!cmd_access(id,level,cid,1)) return

	new authid[35],name[32]
	get_user_authid(id,authid,34)
	get_user_name(id,name,32)

	if(get_cvar_num("amx_luds_missiles") == 0){
		set_cvar_num("amx_luds_missiles",1)
		client_print(0,print_chat,"[AMXX] Admin has enabled missiles")
		console_print(id,"[AMXX] You have enabled missiles")
		log_amx("^"%s<%d><%s><>^" enabled missiles",name,get_user_userid(id),authid)
	}else {
		set_cvar_num("amx_luds_missiles",0)
		client_print(0,print_chat,"[AMXX] Admin has disabled missiles")
		console_print(id,"[AMXX] You have disabled missiles")
		log_amx("^"%s<%d><%s><>^" disabled missiles",name,get_user_userid(id),authid)
	}
}

public admin_missilebuy(id,level,cid) {
	if (!cmd_access(id,level,cid,1)) return

	new authid[35],name[32]
	get_user_authid(id,authid,34)
	get_user_name(id,name,32)

	if(get_cvar_num("amx_missile_buy") == 0){
		set_cvar_num("amx_missile_buy",1)
		client_print(0,print_chat,"[AMXX] Missile shots must be paid for now")
		console_print(id,"[AMXX] You have required players pay for missiles")
		log_amx("^"%s<%d><%s><>^" enabled missiles buying",name,get_user_userid(id),authid)
	}else {
		set_cvar_num("amx_missile_buy",0)
		client_print(0,print_chat,"[AMXX] Missile shots are now FREE")
		console_print(id,"[AMXX] You have made missiles free")
		log_amx("^"%s<%d><%s><>^" disabled missiles buying",name,get_user_userid(id),authid)
	}
}

public admin_missile_ammo(id,level,cid){
	if (!cmd_access(id,level,cid,1)) return

	if(get_cvar_num("amx_missile_buy")){
		console_print(id,"[AMXX] For this command to have effect, disable missile buying first: amx_missilesbuying")
		return
	}

	new cmd[32],arg[10]
	read_argv(0,cmd,31)
	read_argv(1,arg,9)
	new quantity = str_to_num(arg)

	if(equal(cmd[17],"1",1)){
		set_cvar_num("amx_missile_ammo1",quantity)
		console_print(id,"[AMXX] Effective next round, free Guncam Missiles is %d",quantity)
	}
	else if(equal(cmd[17],"2",1)){
		set_cvar_num("amx_missile_ammo2",quantity)
		console_print(id,"[AMXX] Effective next round, free Laser Guided Missiles is %d",quantity)
	}
	else if(equal(cmd[17],"3",1)){
		set_cvar_num("amx_missile_ammo3",quantity)
		console_print(id,"[AMXX] Effective next round, free Heat-Seeking Missiles is %d",quantity)
	}
	else if(equal(cmd[17],"4",1)){
		set_cvar_num("amx_missile_ammo4",quantity)
		console_print(id,"[AMXX] Effective next round, free Common Missiles is %d",quantity)
	}
	else if(equal(cmd[17],"5",1)){
		set_cvar_num("amx_missile_ammo5",quantity)
		console_print(id,"[AMXX] Effective next round, free Anti-Missiles is %d",quantity)
	}
	else if(equal(cmd[17],"6",1)){
		set_cvar_num("amx_missile_ammo6",quantity)
		console_print(id,"[AMXX] Effective next round, free Rope-Seeking Missiles is %d",quantity)
	}
	else if(equal(cmd[17],"7",1)){
		set_cvar_num("amx_missile_ammo7",quantity)
		console_print(id,"[AMXX] Effective next round, free Swirling Death Missiles is %d",quantity)
	}
	new authid[35],name[32]
	get_user_authid(id,authid,34)
	get_user_name(id,name,32)
	log_amx("^"%s<%d><%s><>^" set %s to %d",name,get_user_userid(id),authid,cmd,quantity)
}

public vexd_pfntouch(pToucher, pTouched) {

	new szClassName[32]
	if ( pToucher > 0) {
		entity_get_string(pToucher, EV_SZ_classname, szClassName, 31)
	}
	if(equal(szClassName, "lud_missile")) {
		new damradius = get_cvar_num("amx_missile_damradius")
		new maxdamage = get_cvar_num("amx_missile_maxdamage")

		if (damradius <= 0) {
			log_amx("Damage Radius must be set higher than 0, defaulting to 240")
			damradius = 240
			set_cvar_num("amx_missile_damradius",damradius)
		}
		if (maxdamage <= 0) {
			log_amx("Max Damage must be set higher than 0, defaulting to 140")
			maxdamage = 140
			set_cvar_num("amx_missile_maxdamage",maxdamage)
		}

		remove_task(2020+pToucher)
		new tk = 0
		new Float:fl_vExplodeAt[3]
		entity_get_vector(pToucher, EV_VEC_origin, fl_vExplodeAt)
		new vExplodeAt[3]
		vExplodeAt[0] = floatround(fl_vExplodeAt[0])
		vExplodeAt[1] = floatround(fl_vExplodeAt[1])
		vExplodeAt[2] = floatround(fl_vExplodeAt[2])
		new id = entity_get_edict(pToucher, EV_ENT_owner)
		new unarmed = missile_inv[id][0]
		new origin[3],dist,i,Float:dRatio,damage
		attach_view(id, id)
		if(has_rocket[id] == pToucher)
		has_rocket[id] = 0

		for ( i = 1; i < 32; i++) {

			if((is_user_alive(i)) && (i != id)){
				get_user_origin(i,origin)
				dist = get_distance(origin,vExplodeAt)
				if (dist <= damradius) {

					dRatio = floatdiv(float(dist),float(damradius))
					damage = maxdamage - floatround(floatmul(float(maxdamage),dRatio))

					if(cvar_exists("mp_friendlyfire")) {
						if( get_cvar_num("mp_friendlyfire") && get_cvar_num("amx_missile_obeyffcvar") ) {
							if(get_user_team(i) == get_user_team(id)) tk = 1
							do_victim(i,id,damage,unarmed,tk)
						}
						else {
							if(get_user_team(i) != get_user_team(id)) {
								do_victim(i,id,damage,unarmed,0)
							}
						}
					}
					else {
						do_victim(i,id,damage,unarmed,0)
					}
				}
			}

		}

		message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
		write_byte(3)
		write_coord(vExplodeAt[0])
		write_coord(vExplodeAt[1])
		write_coord(vExplodeAt[2])
		write_short(boom)
		write_byte(100)
		write_byte(15)
		write_byte(0)
		message_end()

		emit_sound(pToucher, CHAN_WEAPON, "weapons/explode3.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
		emit_sound(pToucher, CHAN_VOICE, "weapons/explode3.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

		remove_entity(pToucher)
		is_heat_rocket[id] = 0
		is_scan_rocket[id] = 0

		new szClassName2[32]

		if(pTouched > 32)
		entity_get_string(pTouched, EV_SZ_classname, szClassName2, 31)

		if(equal(szClassName2, "lud_missile")) {
			remove_task(2020+pTouched)
			emit_sound(pTouched, CHAN_WEAPON, "weapons/explode3.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
			emit_sound(pTouched, CHAN_VOICE, "weapons/explode3.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
			new id2 = entity_get_edict(pTouched, EV_ENT_owner)
			attach_view(id2, id2)
			if(has_rocket[id2] == pTouched){
				has_rocket[id2] = 0
				is_heat_rocket[id2] = 0
				is_scan_rocket[id2] = 0
			}
			remove_entity(pTouched)
		}
	}
}

do_victim(victim,attacker,damage,unarmed,tk) {
	new namek[32],namev[32],authida[35],authidv[35],teama[32],teamv[32]
	get_user_name(victim,namev,31)
	get_user_name(attacker,namek,31)
	get_user_authid(victim,authidv,34)
	get_user_authid(attacker,authida,34)
	get_user_team(victim,teamv,31)
	get_user_team(attacker,teama,31)

	if(unarmed == 1){
		if(damage >= get_user_health(victim))
			client_print(attacker,print_chat,"[AMXX] NON-LETHAL TEST MODE:  You would have killed %s with that missile",namev)
		else
			client_print(attacker,print_chat,"[AMXX] NON-LETHAL TEST MODE:  You would have hurt %s with that missile",namev)
	}
	else {
		if(damage >= get_user_health(victim)){
			if(is_heat_rocket[attacker] == 1)
				set_task(1.0,"delay_arnold")

			if(get_cvar_num("mp_logdetail") == 3){
				log_message("^"%s<%d><%s><%s>^" attacked ^"%s<%d><%s><%s>^" with ^"missile^" (hit ^"chest^") (damage ^"%d^") (health ^"0^")",
					namek,get_user_userid(attacker),authida,teama,namev,get_user_userid(victim),authidv,teamv,damage)
			}

			if(unarmed == 2){
				log_amx("^"%s<%d><%s><%s>^" admin missile killed ^"%s<%d><%s><%s>^"",
					namek,get_user_userid(attacker),authida,teama,namev,get_user_userid(victim),authidv,teamv)

				client_print(attacker,print_chat,"[AMXX] You killed %s with that admin missile",namev)
				client_print(victim,print_chat,"[AMXX] You were killed by %s's admin missile",namek)
			}
			else {
				client_print(attacker,print_chat,"[AMXX] You killed %s with that missile",namev)
				client_print(victim,print_chat,"[AMXX] You were killed by %s's missile",namek)
			}

			if(tk == 0) {
				set_user_frags(attacker,get_user_frags(attacker) + 1 )
			}
			else {
				tkcount[attacker] += 1
				client_print(attacker,print_center,"You killed a teammate")
				set_user_frags(attacker,get_user_frags(attacker) - 1 )
			}

			set_msg_block(gmsgDeathMsg,BLOCK_ONCE)
			//set_msg_block(gmsgScoreInfo,BLOCK_ONCE)
			user_kill(victim,1)
			replace_dm(attacker,victim,0)

			log_message("^"%s<%d><%s><%s>^" killed ^"%s<%d><%s><%s>^" with ^"missile^"",
				namek,get_user_userid(attacker),authida,teama,namev,get_user_userid(victim),authidv,teamv)

		}
		else {
			set_user_health(victim,get_user_health(victim) - damage )

			if(get_cvar_num("mp_logdetail") == 3) {
				log_message("^"%s<%d><%s><%s>^" attacked ^"%s<%d><%s><%s>^" with ^"missile^" (hit ^"chest^") (damage ^"%d^") (health ^"%d^")",
					namek,get_user_userid(attacker),authida,teama,namev,get_user_userid(victim),authidv,teamv,damage,get_user_health(victim))
			}

			if(unarmed == 2) {
				log_amx("^"%s<%d><%s><%s>^" admin missile hurt ^"%s<%d><%s><%s>^"",
					namek,get_user_userid(attacker),authida,teama,namev,get_user_userid(victim),authidv,teamv)

				client_print(attacker,print_chat,"[AMXX] You hurt %s with that admin missile",namev)
				client_print(victim,print_chat,"[AMXX] You were hurt by %s's admin missile",namek)
			}
			else {
				client_print(attacker,print_chat,"[AMXX] You hurt %s with that missile",namev)
				client_print(victim,print_chat,"[AMXX] You were hurt by %s's missile",namek)
			}
		}

		if(tk){
			new players[32],pNum
			get_players(players,pNum,"e",teama)
			for(new i=0;i<pNum;i++)
				client_print(players[i],print_chat,"%s attacked a teammate",namek)

			new punish1 = get_cvar_num("amx_missile_tkpunish1")
			new punish2 = get_cvar_num("amx_missile_tkpunish2")

			if (!(get_user_flags(attacker)&ADMIN_IMMUNITY)){
				if(punish1 > 2){
					user_kill(attacker,0)
					set_hudmessage(255,50,50, -1.0, 0.45, 0, 0.02, 10.0, 1.01, 1.1, 4)
					show_hudmessage(attacker,"YOU WERE KILLED FOR ATTACKING TEAMMATES.^nSEE THAT IT HAPPENS NO MORE!")
				}
				if((punish1) && (tkcount[attacker] >= punish2 )){
					if(punish1 == 1 || punish1 == 3)
						client_cmd(attacker,"echo You were kicked for team killing;disconnect")
					else if(punish1 == 2 || punish1 == 4){
						client_cmd(attacker,"echo You were banned for team killing")
						if (equal("4294967295",authida)){
							new ipa[32]
							get_user_ip(attacker,ipa,31,1)
							server_cmd("addip 180.0 %s;writeip",ipa)
						}else{
							server_cmd("banid 180.0 %s kick;writeid",authida)
						}
					}
				}
			}
		}
	}
}

public delay_arnold(){
	client_cmd(0,"play misc/arnold_heatseeker.wav")
}

public delay_prizewin(){
	client_cmd(0,"play ambience/lv4.wav")
}

public player_sdmf(id,level,cid){
	if(get_cvar_num("amx_missile_allow_sdmf") == 0){
		console_print(id,"[AMXX] Players are not allowed to set thier own fuel for Swirling Death Missiles.")
		return
	}
	if (!cmd_access(id,level,cid,2)) return

	new arg[8]
	read_argv(1,arg,7)
	new iarg = str_to_num(arg)
	if(iarg < 1 || iarg > 1000){
		console_print(id,"[AMXX] Fuel ammount must be a number between 1 and 1000")
		return
	}
	user_sdmf[id] = float(iarg) / 10
	console_print(id,"[AMXX] Your swirling death missiles now run out of fuel after %.1f seconds",user_sdmf[id])
}

public admin_missile(id,level,cid) {
	if (!cmd_access(id,level,cid,1) || roundfreeze) return

	if(!is_dedicated_server()) {
		if(!id) id = 1
	}

	if( (has_rocket[id]) && (!(get_user_flags(id)&ADMIN_MULTISHOT)) ) {
		client_print(id,print_chat,"[AMXX] You cannot have more than one missile in the air at a time.")
		return
	}

	using_menu[id] = 0
	new arg1[10], arg2[10], arg3[10], cmd[32],icmd
	read_argv(0,cmd,31)
	read_argv(1,arg1,9)
	read_argv(2,arg2,9)
	read_argv(3,arg3,9)

	new iarg1 = str_to_num(arg1)
	new iarg2 = str_to_num(arg2)
	new iarg3 = str_to_num(arg3)

	if(equal(cmd[11],"1",1)) {
		icmd = 1
	}
	else if(equal(cmd[11],"2",1)) {
		icmd = 2
	}
	else if(equal(cmd[11],"3",1)) {
		icmd = 3
	}
	else if(equal(cmd[11],"5",1)) {
		icmd = 5
	}
	else if(equal(cmd[11],"6",1)) {
		icmd = 6
	}
	else {
		icmd = 7
	}

	if(iarg1 < 1 || iarg1 > 10000){
		if(icmd == 5) {
			iarg1 = get_cvar_num("amx_missile_hsspeed")
		}
		else if(icmd == 6) {
			iarg1 = get_cvar_num("amx_missile_rsspeed")
		}
		else if(icmd == 7) {
			iarg1 = get_cvar_num("amx_missile_sdspeed")
		}
		else {
			iarg1 = get_cvar_num("amx_missile_speed")
		}
	}

	if(iarg2 == 1 && !is_cstrike) {
		iarg2 = 0
	}
	else if(iarg2 > 2) {
		iarg2 = 0
	}

	make_rocket(id,icmd,iarg1,iarg2,iarg3,1,0)

}

/*
public bot_interface(){
	if(get_cvar_num("amx_luds_missiles") == 0)
		return PLUGIN_HANDLED
	new sid[8],id
	read_argv(1,sid,7)
	id = str_to_num(sid)
	if(is_user_alive(id) == 0)
		return PLUGIN_HANDLED
	if(has_rocket[id])
		return PLUGIN_HANDLED
	new cmd[32],icmd
	read_argv(2,cmd,31)
	if(equal(cmd,"amx_guncamera_missile"))
		icmd = 1
	else if(equal(cmd,"amx_laserguided_missile"))
		icmd = 2
	else if(equal(cmd,"amx_heatseeking_missile"))
		icmd = 3
	else if(equal(cmd,"amx_missile"))
		icmd = 4
	else if(equal(cmd,"amx_ropeseeking_missile"))
		icmd = 6
	else if(equal(cmd,"amx_swirlingdeath_missile"))
		icmd = 7
	else
		icmd = 5
	if(icmd == 5){
		if(radar_batt[id] < 1)
			return PLUGIN_HANDLED
		if(is_scan_rocket[id] == 1) {
			remove_task(35632+id)
			is_scan_rocket[id] = 0
			missile_inv[id][icmd] += 1
			return PLUGIN_HANDLED
		}
	}

	if( (icmd == 1 || icmd == 7) && (round_delay == 1) && (get_cvar_num("amx_missile_spawndelay")) )
		return PLUGIN_HANDLED

	if(get_cvar_num("amx_missile_botsnolimit") == 0){
		if(get_cvar_num("amx_missile_buy") == 1){
			new cvarname[32]
			format(cvarname,31,"amx_missile_cost%d",icmd)
			new umoney = cs_get_user_money(id)
			new m_cost = get_cvar_num(cvarname)
			if(umoney < m_cost)
				return PLUGIN_HANDLED
			else
				cs_set_user_money(id,umoney-m_cost,1)
		}else{
			new pass
			if( (icmd == 7) && (get_cvar_num("amx_missile_ammo7ta") == 1) ){
				pass = 1
				new sum
				for(new i=1;i<8;i++)
					sum += missile_inv[id][i]
				if(sum < 7)
					return PLUGIN_HANDLED
				else{
					new take
					for(new b=1;b<8;b++){
						if(take < 7){
							for(new i=1;i<8;i++){
								if( (missile_inv[id][i] > 0) && (take < 7) ){
									missile_inv[id][i] -= 1
									take +=1
								}
							}
						}
					}
				}
			}
			if( (!pass) && (missile_inv[id][icmd] < 1) )
				return PLUGIN_HANDLED
			else
				missile_inv[id][icmd] -= 1
		}
	}
	if(icmd != 5){
		switch(icmd){
			case 1: make_rocket(id,icmd,get_cvar_num("amx_missile_speed"),0,1,0,0)
			case 2: make_rocket(id,icmd,get_cvar_num("amx_missile_speed"),0,1,0,0)
			case 3: make_rocket(id,icmd,get_cvar_num("amx_missile_hsspeed"),0,1,0,0)
			case 4: make_rocket(id,icmd,get_cvar_num("amx_missile_speed"),0,1,0,0)
			case 6: make_rocket(id,icmd,get_cvar_num("amx_missile_rsspeed"),0,1,0,0)
			case 7: make_rocket(id,icmd,get_cvar_num("amx_missile_sdspeed"),0,1,0,0)
			default: make_rocket(id,icmd,get_cvar_num("amx_missile_speed"),0,1,0,0)
		}
	}else{
		is_scan_rocket[id] = 1
		new args[2]
		args[0] = id
		set_task(0.2,"anti_missile_radar",35632+id,args,2,"b")
		set_task(0.3,"amr_pay",35632+id,args,2,"b")
	}
	return PLUGIN_CONTINUE
}
*/

public fire_missile(id) {

	if (!is_dedicated_server()) {
		if(!id) id = 1
	}

	if(!get_cvar_num("amx_luds_missiles") || roundfreeze || !is_user_alive(id))
		return PLUGIN_HANDLED

	show_missile_inv(id)
	if(has_rocket[id]){
		client_print(id,print_chat,"[AMXX] You cannot have more than one missile in the air at a time.")
		return PLUGIN_HANDLED
	}

	new cmd[32],icmd
	read_argv(0,cmd,31)

	if(equal(cmd,"amx_missile"))						icmd = 1
	else if(equal(cmd,"amx_laserguided_missile"))		icmd = 2
	else if(equal(cmd,"amx_guncamera_missile"))			icmd = 3
	else if(equal(cmd,"amx_heatseeking_missile"))		icmd = 5
	else if(equal(cmd,"amx_ropeseeking_missile"))		icmd = 6
	else if(equal(cmd,"amx_swirlingdeath_missile"))		icmd = 7
	else											icmd = 4

	if(icmd == 4){
		if(radar_batt[id] <= 0){
			client_print(id,print_chat,"[AMXX] Your anti-missile radar batteries are dead.")
			return PLUGIN_HANDLED
		}
		if(is_scan_rocket[id] == 1) {
			remove_task(35632+id)
			is_scan_rocket[id] = 0
			missile_inv[id][icmd] += 1
			set_hudmessage(0,255,0, -1.0, 0.30, 0, 0.02, 3.0, 1.01, 1.1, 4)
			show_hudmessage(id,"ANTIMISSILE RADAR DEACTIVATED")
			return PLUGIN_HANDLED
		}
	}
	if( (icmd == 4 || icmd == 7) && (round_delay) && (get_cvar_num("amx_missile_spawndelay")) ){
		client_print(id,print_chat,"[AMXX] This missile type cannot be fired until 15 seconds after round start.")
		return PLUGIN_HANDLED
	}
	if(get_cvar_num("amx_missile_buy") == 1) {
#if defined CSTRIKE
		new cvarname[32]
		format(cvarname,31,"amx_missile_cost%d",icmd)
		new umoney = cs_get_user_money(id)
		new m_cost = get_cvar_num(cvarname)
		if(umoney < m_cost){
			client_print(id,print_chat,"[AMXX] Insufficient funds. Each of these missiles costs %d money",m_cost)
			return PLUGIN_HANDLED
		}
		else {
			cs_set_user_money(id,umoney-m_cost,1)
		}
#endif
	}
	else {
		if( icmd == 7 && get_cvar_num("amx_missile_ammo7ta")){
			new sum
			for(new i = 1; i <= 7; i++)
				sum += missile_inv[id][i]

			if(sum < 7) {
				client_print(id,print_chat,"[AMXX] You do not have enough missiles to make a Swirling Death Missile.")
				if (using_menu[id]) show_main_menu(id)
				return PLUGIN_HANDLED
			}
			else{
				new take
				for(new b = 1; b <= 7; b++){
					if(take < 7) {
						for(new i=1; i <= 7; i++){
							if( (missile_inv[id][i] > 0) && (take < 7) ){
								missile_inv[id][i]--
								take++
							}
						}
					}
				}
			}
		}
		else if( missile_inv[id][icmd] <= 0 ){
			switch(icmd){
				case 1: client_print(id,print_chat,"[AMXX] You have no more Common Missiles.")
				case 2: client_print(id,print_chat,"[AMXX] You have no more Laser Guided Missiles.")
				case 3: client_print(id,print_chat,"[AMXX] You have no more Gun Camera Missiles.")
				case 4: client_print(id,print_chat,"[AMXX] You have no more Anti-Missile Missiles.")
				case 5: client_print(id,print_chat,"[AMXX] You have no more Heat Seeking Missiles.")
				case 6: client_print(id,print_chat,"[AMXX] You have no more Rope Seeking Missiles.")
				case 7: client_print(id,print_chat,"[AMXX] You have no more Swirling Death Missiles.")
			}
			return PLUGIN_HANDLED
		}
		else {
			missile_inv[id][icmd] -= 1
		}
	}
	if(icmd != 4){
		show_missile_inv(id)
		switch(icmd){
			case 1: make_rocket(id,icmd,get_cvar_num("amx_missile_speed"),0,1,0,0)
			case 2: make_rocket(id,icmd,get_cvar_num("amx_missile_speed"),0,1,0,0)
			case 3: make_rocket(id,icmd,get_cvar_num("amx_missile_speed"),0,1,0,0)
			case 5: make_rocket(id,icmd,get_cvar_num("amx_missile_hsspeed"),0,1,0,0)
			case 6: make_rocket(id,icmd,get_cvar_num("amx_missile_rsspeed"),0,1,0,0)
			case 7: make_rocket(id,icmd,get_cvar_num("amx_missile_sdspeed"),0,1,0,0)
			default: make_rocket(id,icmd,get_cvar_num("amx_missile_speed"),0,1,0,0)
		}
	}
	else {
		is_scan_rocket[id] = 1
		new args[2]
		args[0] = id
		set_task(0.2,"anti_missile_radar",35632+id,args,2,"b")
		set_task(0.3,"amr_pay",35632+id,args,2,"b")
		set_hudmessage(0,255,0, -1.0, 0.26, 0, 0.02, 3.0, 1.01, 1.1, 54)
		show_hudmessage(id,"ANTIMISSILE RADAR SYSTEM ACTIVATED^nAim at missile you want to shoot down")
	}
	return PLUGIN_HANDLED
}

public anti_missile_radar(args[]) {
	new maxplayers = get_maxplayers()+1
	new id = args[0]
	new tid = 0
	new aimvec[3],origin[3],length
	new radarvec1[3],radarvec2[3],radarvec3[3],radarvec4[3],radarvec5[3]
	get_user_origin(id,origin)
	get_user_origin(id,aimvec,3)
	radarvec1[0]=aimvec[0]-origin[0]
	radarvec1[1]=aimvec[1]-origin[1]
	radarvec1[2]=aimvec[2]-origin[2]
	length = sqroot(radarvec1[0]*radarvec1[0]+radarvec1[1]*radarvec1[1]+radarvec1[2]*radarvec1[2])
	radarvec5[0]=radarvec1[0]*1750/length + origin[0]
	radarvec5[1]=radarvec1[1]*1750/length + origin[1]
	radarvec5[2]=radarvec1[2]*1750/length + origin[2]
	radarvec4[0]=radarvec1[0]*1350/length + origin[0]
	radarvec4[1]=radarvec1[1]*1350/length + origin[1]
	radarvec4[2]=radarvec1[2]*1350/length + origin[2]
	radarvec3[0]=radarvec1[0]*950/length + origin[0]
	radarvec3[1]=radarvec1[1]*950/length + origin[1]
	radarvec3[2]=radarvec1[2]*950/length + origin[2]
	radarvec2[0]=radarvec1[0]*700/length + origin[0]
	radarvec2[1]=radarvec1[1]*700/length + origin[1]
	radarvec2[2]=radarvec1[2]*700/length + origin[2]
	radarvec1[0]=radarvec1[0]*350/length + origin[0]
	radarvec1[1]=radarvec1[1]*350/length + origin[1]
	radarvec1[2]=radarvec1[2]*350/length + origin[2]

	for(new i=1; i <= maxplayers; i++) {
		if( (has_rocket[i] > maxplayers) && (i != id) && (tid < maxplayers) ){
			new szClassName[32]
			entity_get_string(has_rocket[i], EV_SZ_classname, szClassName, 31)
			if(equal(szClassName, "lud_missile")){
				new rocketvec[3]
				new Float:fl_rocketvec[3]
				entity_get_vector(has_rocket[i], EV_VEC_origin, fl_rocketvec)
				rocketvec[0] = floatround(fl_rocketvec[0])
				rocketvec[1] = floatround(fl_rocketvec[1])
				rocketvec[2] = floatround(fl_rocketvec[2])
				if(get_distance(radarvec5,rocketvec) < 100)
					tid = has_rocket[i]
				else if(get_distance(radarvec4,rocketvec) < 100)
					tid = has_rocket[i]
				else if(get_distance(radarvec3,rocketvec) < 85)
					tid = has_rocket[i]
				else if(get_distance(radarvec2,rocketvec) < 70)
					tid = has_rocket[i]
				else if(get_distance(radarvec1,rocketvec) < 50)
					tid = has_rocket[i]
			}
		}
	}
	if(tid > maxplayers){
		client_cmd(id,"spk fvox/beep")
		set_hudmessage(255,10,10, -1.0, 0.26, 0, 0.02, 3.0, 1.01, 1.1, 54)
		show_hudmessage(id,"ANTIMISSILE LOCKED ONTO TARGET")
		is_scan_rocket[id] = 0
		remove_task(35632+id)
		make_rocket(id,4,get_cvar_num("amx_missile_speed")*5,0,1,0,tid)
	}
	return PLUGIN_CONTINUE
}

public amr_pay(args[]) {
	new id = args[0]
	set_hudmessage(255,0,0, -1.0, 0.26, 0, 0.02, 3.0, 1.01, 1.1, 54)
	if(radar_batt[id] < 1){
		show_hudmessage(id,"WARNING: ANTIMISSILE RADAR SYSTEM FAILURE")
		client_print(id,print_center,"^n^nBattery is dead")
		is_scan_rocket[id] = 0
		remove_task(35632+id)
	}
	else{
		client_print(id,print_center,"^n^n^nBattery %d",radar_batt[id])
	}
	radar_batt[id]--
	client_cmd(id,"spk fvox/blip")
	return PLUGIN_CONTINUE
}

//make_rocket(userindex,commandtype,missilespeed,model,nofake,admincommand,antimissleid)
make_rocket(id,icmd,iarg1,iarg2,iarg3,admin,antimissile){

	new args[16]
	new Float:vOrigin[3]
	new Float:vAngles[3]
	entity_get_vector(id, EV_VEC_origin, vOrigin)
	entity_get_vector(id, EV_VEC_v_angle, vAngles)
	new notFloat_vOrigin[3]
	notFloat_vOrigin[0] = floatround(vOrigin[0])
	notFloat_vOrigin[1] = floatround(vOrigin[1])
	notFloat_vOrigin[2] = floatround(vOrigin[2])

	if(icmd == 5){
		new aimvec[3]
		get_user_origin(id,aimvec,3)
		new dist = get_distance(notFloat_vOrigin,aimvec)
		new found
		new dist1 = 20000

		new players[32], inum
		get_players(players,inum,"a")
		for(new i = 0 ;i < inum ;++i){
			if(players[i] != id){
				new soutput[8],output
				get_user_info(players[i],"JETPACK_RUN",soutput,7)
				output = str_to_num(soutput)
				if(cmd_jetpackrun[players[i]] == 1)
					output = 1
				if(output){
					new temp[3]
					get_user_origin(players[i],temp)
					dist1 = get_distance(temp,aimvec)
					if(dist1 < dist){
						dist = dist1
						found = 1
						args[6] = players[i]
					}
				}
			}
		}
		if(!found){
			client_print(id,print_chat,"[AMXX] Cannot fire Heat-Seeking Missile, no running JetPacks in view.")
			if(!admin){
				if(get_cvar_num("amx_missile_buy") == 1){
					new umoney = cs_get_user_money(id)
					new m_cost = get_cvar_num("amx_missile_cost5")
					cs_set_user_money(id,umoney+m_cost,1)
				}else{
					missile_inv[id][3] += 1
					show_missile_inv(id)
				}
				if(using_menu[id])
					show_main_menu(id)
			}
			return PLUGIN_HANDLED
		}
	}
	else if(icmd == 6){
		new aimvec[3]
		get_user_origin(id,aimvec,3)
		new dist = get_distance(notFloat_vOrigin,aimvec)
		new found
		new dist1 = 20000
		new players[32], inum
		get_players(players,inum,"a")
		for(new i = 0 ;i < inum ;++i){
			if(players[i] != id){
				if(cmd_onrope[players[i]] == 1){
					new temp[3]
					get_user_origin(players[i],temp)
					dist1 = get_distance(temp,aimvec)
					if(dist1 < dist){
						dist = dist1
						found = 1
						args[6] = players[i]
					}
				}
			}
		}
		if(!found){
			client_print(id,print_chat,"[AMXX] Cannot fire Rope-Seeking Missile, no Ropes in view.")
			if(!admin){
				if(get_cvar_num("amx_missile_buy") == 1){
					new umoney = cs_get_user_money(id)
					new m_cost = get_cvar_num("amx_missile_cost6")
					cs_set_user_money(id,umoney+m_cost,1)
				}else{
					missile_inv[id][6] += 1
					show_missile_inv(id)
				}
				if(using_menu[id])
					show_main_menu(id)
			}
			return PLUGIN_HANDLED
		}
	}
	using_menu[id] = 0

	new NewEnt
	NewEnt = create_entity("info_target")
	if(NewEnt == 0) {
		client_print(id,print_chat,"Rocket Failure")
		return PLUGIN_HANDLED_MAIN
	}
	has_rocket[id] = NewEnt
	if(admin){
		if(iarg3 == 1)
			missile_inv[id][0] = 2
		else
			missile_inv[id][0] = 1
	}
	else {
		missile_inv[id][0] = 0
	}
	entity_set_string(NewEnt, EV_SZ_classname, "lud_missile")

	switch(iarg2){
		case 0: entity_set_model(NewEnt, "models/rpgrocket.mdl")
		case 1: entity_set_model(NewEnt, "models/chick.mdl")
		case 2: entity_set_model(NewEnt, "models/hvr.mdl")
	}

	new Float:fl_vecminsx[3] = {-1.0, -1.0, -1.0}
	new Float:fl_vecmaxsx[3] = {1.0, 1.0, 1.0}

	entity_set_vector(NewEnt, EV_VEC_mins,fl_vecminsx)
	entity_set_vector(NewEnt, EV_VEC_maxs,fl_vecmaxsx)

	entity_set_origin(NewEnt, vOrigin)
	entity_set_vector(NewEnt, EV_VEC_angles, vAngles)

	if(!iarg2) {
		entity_set_int(NewEnt, EV_INT_effects, 64)
	}
	else {
		entity_set_int(NewEnt, EV_INT_effects, 2)
	}

	entity_set_int(NewEnt, EV_INT_solid, 2)
	if(get_cvar_num("amx_missile_obeygravity")) {
		entity_set_int(NewEnt, EV_INT_movetype, 6)
	}
	else {
		entity_set_int(NewEnt, EV_INT_movetype, 5)
	}
	entity_set_edict(NewEnt, EV_ENT_owner, id)
	entity_set_float(NewEnt, EV_FL_health, 10000.0)
	entity_set_float(NewEnt, EV_FL_takedamage, 100.0)
	entity_set_float(NewEnt, EV_FL_dmg_take, 100.0)

	new Float:fl_iNewVelocity[3]
	new iNewVelocity[3]
	VelocityByAim(id, iarg1, fl_iNewVelocity)
	entity_set_vector(NewEnt, EV_VEC_velocity, fl_iNewVelocity)
	iNewVelocity[0] = floatround(fl_iNewVelocity[0])
	iNewVelocity[1] = floatround(fl_iNewVelocity[1])
	iNewVelocity[2] = floatround(fl_iNewVelocity[2])

	emit_sound(NewEnt, CHAN_WEAPON, "weapons/rocketfire1.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
	emit_sound(NewEnt, CHAN_VOICE, "weapons/rocket1.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

	args[0] = id
	args[1] = NewEnt
	args[2] = iarg1
	args[3] = iNewVelocity[0]
	args[4] = iNewVelocity[1]
	args[5] = iNewVelocity[2]
	args[8] = notFloat_vOrigin[0]
	args[9] = notFloat_vOrigin[1]
	args[10] = notFloat_vOrigin[2]

	switch(icmd){
		case 1: {
			make_trail(NewEnt,icmd)
			entity_set_float(NewEnt, EV_FL_gravity, 0.25)
			set_task(0.1,"guide_rocket_comm",2020+NewEnt,args,16,"b")
			set_task(get_cvar_float("amx_missile_fuel"),"rocket_fuel_timer",2020+NewEnt,args,16)
		}
		case 2: {
			make_trail(NewEnt,icmd)
			entity_set_float(NewEnt, EV_FL_gravity, 0.25)
			set_task(0.1,"guide_rocket_las",2020+NewEnt,args,16)
			set_task(get_cvar_float("amx_missile_fuel"),"rocket_fuel_timer",2020+NewEnt,args,16)
		}
		case 3: {
			make_trail(NewEnt,icmd)
			entity_set_float(NewEnt, EV_FL_gravity, 0.25)
			entity_set_int(NewEnt, EV_INT_rendermode,1)
			attach_view(id, NewEnt)
			args[11] = 1
			set_task(0.1,"guide_rocket_dir",2020+NewEnt,args,16,"b")
			set_task(get_cvar_float("amx_missile_fuel"),"rocket_fuel_timer",2020+NewEnt,args,16)
		}
		case 4: {
			make_trail(NewEnt,icmd)
			args[6] = antimissile
			entity_set_float(NewEnt, EV_FL_gravity, 0.25)
			set_task(0.1,"guide_rocket_anti",2020+NewEnt,args,16)
			set_task(get_cvar_float("amx_missile_fuel"),"rocket_fuel_timer",2020+NewEnt,args,16)
		}
		case 5: {
			is_heat_rocket[id] = 1
			make_trail(NewEnt,icmd)
			entity_set_float(NewEnt, EV_FL_gravity, 0.25)
			set_task(0.1,"guide_rocket_het",2020+NewEnt,args,16)
			set_task(get_cvar_float("amx_missile_fuel"),"rocket_fuel_timer",2020+NewEnt,args,16)
		}
		case 6: {
			make_trail(NewEnt,icmd)
			entity_set_float(NewEnt, EV_FL_gravity, 0.25)
			set_task(0.1,"guide_rocket_rope",2020+NewEnt,args,16)
			set_task(get_cvar_float("amx_missile_fuel"),"rocket_fuel_timer",2020+NewEnt,args,16)
		}
		case 7: {
			entity_set_float(NewEnt, EV_FL_gravity, 0.000001)
			SD_CircleRockets(NewEnt)
			set_task(0.1,"guide_rocket_swirl",2020+NewEnt,args,16)
			if( (user_sdmf[id] > 0.0) && (get_cvar_num("amx_missile_allow_sdmf") == 1) )
				set_task(user_sdmf[id],"rocket_fuel_timer",2020+NewEnt,args,16)
			else
				set_task(get_cvar_float("amx_missile_sdfuel"),"rocket_fuel_timer",2020+NewEnt,args,16)
		}
	}
	return PLUGIN_HANDLED_MAIN
}

make_trail(NewEnt,style){
	message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
	write_byte(22)
	write_short(NewEnt)
	write_short(beam)
	write_byte(45)
	write_byte(4)
	switch(style){
		case 1: {
			write_byte(254)
			write_byte(254)
			write_byte(254)
			write_byte(100)
		}
		case 2: {
			write_byte(254)
			write_byte(254)
			write_byte(100)
			write_byte(100)
		}
		case 3: {
			write_byte(100)
			write_byte(254)
			write_byte(254)
			write_byte(100)
		}
		case 4: {
			write_byte(254)
			write_byte(150)
			write_byte(50)
			write_byte(100)
		}
		case 5: {
			write_byte(250)
			write_byte(100)
			write_byte(100)
			write_byte(100)
		}
		case 6: {
			write_byte(100)
			write_byte(250)
			write_byte(100)
			write_byte(100)
		}
		case 7: {
			write_byte(100)
			write_byte(100)
			write_byte(250)
			write_byte(100)
		}
		default: {
			write_byte(254)
			write_byte(254)
			write_byte(254)
			write_byte(100)
		}
	}
	message_end()
}

public guide_rocket_comm(args[]){
	new ent = args[1]
	new Float:missile_health
	missile_health = Float:entity_get_float(ent, EV_FL_health)
	if(missile_health <10000.0)
		vexd_pfntouch(ent,0)

	return PLUGIN_CONTINUE
}

public guide_rocket_dir(args[]){
	new id = args[0]
	new ent = args[1]
	new speed = args[2]
	new Float:fl_iNewVelocity[3]
	VelocityByAim(id, speed, fl_iNewVelocity)
	entity_set_vector(ent, EV_VEC_velocity, fl_iNewVelocity)

	new Float:vAngles[3]
	entity_get_vector(id, EV_VEC_v_angle, vAngles)
	entity_set_vector(ent, EV_VEC_angles, vAngles)

	new Float:missile_health
	missile_health = Float:entity_get_float(ent, EV_FL_health)
	if(missile_health <10000.0)
		vexd_pfntouch(ent,0)
	return PLUGIN_CONTINUE
}

public guide_rocket_las(args[]) {
	new aimvec[3],avgFactor
	new Float:fl_origin[3]
	new id = args[0]
	new ent = args[1]
	new speed = args[2]
	get_user_origin(id,aimvec,3)

	//Make the Laser Dot
	message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
	write_byte( 17 )
	write_coord(aimvec[0])
	write_coord(aimvec[1])
	write_coord(aimvec[2])
	write_short( ls_dot )
	write_byte( 10 )
	write_byte( 255 )
	message_end()

	entity_get_vector(ent, EV_VEC_origin, fl_origin)
	new iNewVelocity[3]
	new origin[3]
	origin[0] = floatround(fl_origin[0])
	origin[1] = floatround(fl_origin[1])
	origin[2] = floatround(fl_origin[2])
	if(speed < 400)
		avgFactor = 10
	else if(speed < 850)
		avgFactor = 4
	else
		avgFactor = 2
	new velocityvec[3],length
	velocityvec[0]=aimvec[0]-origin[0]
	velocityvec[1]=aimvec[1]-origin[1]
	velocityvec[2]=aimvec[2]-origin[2]
	length = sqroot(velocityvec[0]*velocityvec[0]+velocityvec[1]*velocityvec[1]+velocityvec[2]*velocityvec[2])
	velocityvec[0]=velocityvec[0]*speed/length
	velocityvec[1]=velocityvec[1]*speed/length
	velocityvec[2]=velocityvec[2]*speed/length
	iNewVelocity[0] = (velocityvec[0] + (args[3] * (avgFactor-1) ) ) / avgFactor
	iNewVelocity[1] = (velocityvec[1] + (args[4] * (avgFactor-1) ) ) / avgFactor
	iNewVelocity[2] = (velocityvec[2] + (args[5] * (avgFactor-1) ) ) / avgFactor
	new Float:fl_iNewVelocity[3]
	fl_iNewVelocity[0] = iNewVelocity[0] + 0.0
	fl_iNewVelocity[1] = iNewVelocity[1] + 0.0
	fl_iNewVelocity[2] = iNewVelocity[2] + 0.0
	entity_set_vector(ent, EV_VEC_velocity, fl_iNewVelocity)
	args[3] = iNewVelocity[0]
	args[4] = iNewVelocity[1]
	args[5] = iNewVelocity[2]
	args[8] = origin[0]
	args[9] = origin[1]
	args[10] = origin[2]
	set_task(0.1,"guide_rocket_las",2020+ent,args,16)

	new Float:missile_health
	missile_health = Float:entity_get_float(ent, EV_FL_health)
	if(missile_health < 10000.0)
		vexd_pfntouch(ent,0)

	return PLUGIN_CONTINUE
}

public guide_rocket_het(args[]){
	new aimvec[3],avgFactor
	new Float:fl_origin[3]
	new t_aimvec[33][3]
	new t_index[33]
	new t_jp,dist
	new jp_dist = 20000
	new id = args[0]
	new ent = args[1]
	new speed = args[2]
	new iNewVelocity[3]
	entity_get_vector(ent, EV_VEC_origin, fl_origin)
	new origin[3]
	origin[0] = floatround(fl_origin[0])
	origin[1] = floatround(fl_origin[1])
	origin[2] = floatround(fl_origin[2])

	new soutput[8],output
	get_user_info(args[6],"JETPACK_RUN",soutput,7)
	output = str_to_num(soutput)
	if(cmd_jetpackrun[args[6]] == 1)
		output = 1

	if((output == 1) || (args[7] < 5)){
		if(is_user_alive(args[6]) == 1){
			get_user_origin(args[6],aimvec)
			dist = get_distance(aimvec,origin)
		}
		else {
			args[7] = 100
		}
		if(output == 1)
			args[7] = 0
	}
	else {
		new players[32], inum
		get_players(players,inum,"a")
		for(new i = 0 ;i < inum ;++i){
			if(players[i] != id){
				setc(soutput,8,0)
				get_user_info(players[i],"JETPACK_RUN",soutput,7)
				output = str_to_num(soutput)
				if(cmd_jetpackrun[players[i]] == 1)
					output = 1
				if(output){
					new temp[3]
					get_user_origin(players[i],temp)
					t_aimvec[t_jp][0] = temp[0]
					t_aimvec[t_jp][1] = temp[1]
					t_aimvec[t_jp][2] = temp[2]
					t_index[t_jp] = players[i]
					t_jp++
				}
			}
		}
		for(new i = 0 ;i < t_jp ;++i){
			new temp[3]
			temp[0] = t_aimvec[i][0]
			temp[1] = t_aimvec[i][1]
			temp[2] = t_aimvec[i][2]
			dist = get_distance(temp,origin)
			if(dist < jp_dist){
				aimvec[0] = temp[0]
				aimvec[1] = temp[1]
				aimvec[2] = temp[2]
				jp_dist = dist
				args[6] = t_index[i]
				args[7] = 0
			}
		}
	}
	if(dist){
		if(speed < 400)
			avgFactor = 10
		else if(speed < 850)
			avgFactor = 4
		else
			avgFactor = 2

		new length, velocityvec[3]
		velocityvec[0]=aimvec[0]-origin[0]
		velocityvec[1]=aimvec[1]-origin[1]
		velocityvec[2]=aimvec[2]-origin[2]
		length=sqroot(velocityvec[0]*velocityvec[0]+velocityvec[1]*velocityvec[1]+velocityvec[2]*velocityvec[2])
		velocityvec[0]=velocityvec[0]*speed/length
		velocityvec[1]=velocityvec[1]*speed/length
		velocityvec[2]=velocityvec[2]*speed/length

		iNewVelocity[0] = (velocityvec[0] + (args[3] * (avgFactor-1) ) ) / avgFactor
		iNewVelocity[1] = (velocityvec[1] + (args[4] * (avgFactor-1) ) ) / avgFactor
		iNewVelocity[2] = (velocityvec[2] + (args[5] * (avgFactor-1) ) ) / avgFactor

		args[3] = iNewVelocity[0]
		args[4] = iNewVelocity[1]
		args[5] = iNewVelocity[2]
		if(dist < 20){
			vexd_pfntouch(ent,0)
			return PLUGIN_CONTINUE
		}
	}
	args[7] += 1
	new Float:fl_iNewVelocity[3]
	fl_iNewVelocity[0] = args[3] +0.0
	fl_iNewVelocity[1] = args[4] +0.0
	fl_iNewVelocity[2] = args[5] +0.0

	entity_set_vector(ent, EV_VEC_velocity, fl_iNewVelocity)
	set_task(0.1,"guide_rocket_het",2020+ent,args,16)

	new Float:missile_health
	missile_health = Float:entity_get_float(ent, EV_FL_health)
	if(missile_health < 10000.0)
		vexd_pfntouch(ent,0)

	return PLUGIN_CONTINUE
}

public guide_rocket_anti(args[]){
	new Float:fl_aimvec[3]
	new Float:fl_origin[3]
	new avgFactor
	new id = args[0]
	new ent = args[1]
	new speed = args[2]
	new iNewVelocity[3]

	entity_get_vector(ent, EV_VEC_origin, fl_origin)
	new origin[3]
	origin[0] = floatround(fl_origin[0])
	origin[1] = floatround(fl_origin[1])
	origin[2] = floatround(fl_origin[2])

	if(find_ent_by_class(args[6], "lud_missile") != 0){
		entity_get_vector(args[6], EV_VEC_origin, fl_aimvec)
	  	new aimvec[3]
		aimvec[0] = floatround(fl_aimvec[0])
		aimvec[1] = floatround(fl_aimvec[1])
		aimvec[2] = floatround(fl_aimvec[2])
		if(speed < 400)
			avgFactor = 10
		else if(speed < 850)
			avgFactor = 4
		else
			avgFactor = 2
		new length, velocityvec[3]
		velocityvec[0]=aimvec[0]-origin[0]
		velocityvec[1]=aimvec[1]-origin[1]
		velocityvec[2]=aimvec[2]-origin[2]
		length=sqroot(velocityvec[0]*velocityvec[0]+velocityvec[1]*velocityvec[1]+velocityvec[2]*velocityvec[2])
		velocityvec[0]=velocityvec[0]*speed/length
		velocityvec[1]=velocityvec[1]*speed/length
		velocityvec[2]=velocityvec[2]*speed/length
		iNewVelocity[0] = (velocityvec[0] + (args[3] * (avgFactor-1) ) ) / avgFactor
		iNewVelocity[1] = (velocityvec[1] + (args[4] * (avgFactor-1) ) ) / avgFactor
		iNewVelocity[2] = (velocityvec[2] + (args[5] * (avgFactor-1) ) ) / avgFactor
		args[3] = iNewVelocity[0]
		args[4] = iNewVelocity[1]
		args[5] = iNewVelocity[2]
		if(get_distance(origin,aimvec) < 150){
			vexd_pfntouch(ent,args[6])
			return PLUGIN_CONTINUE
		}
		new Float:fl_iNewVelocity[3]
		fl_iNewVelocity[0] = args[3] +0.0
		fl_iNewVelocity[1] = args[4] +0.0
		fl_iNewVelocity[2] = args[5] +0.0
		entity_set_vector(ent, EV_VEC_velocity, fl_iNewVelocity)
		set_task(0.1,"guide_rocket_anti",2020+ent,args,16)
	}
	new Float:missile_health
	missile_health = Float:entity_get_float(ent, EV_FL_health)
	if(missile_health < 10000.0)
		vexd_pfntouch(ent,0)

	client_cmd(id,"spk buttons/blip2")
	return PLUGIN_CONTINUE
}

public guide_rocket_rope(args[]){
	new aimvec[3],avgFactor
	new Float:fl_origin[3]
	new t_aimvec[33][3]
	new t_index[33]
	new t_jp,dist
	new jp_dist = 20000
	new id = args[0]
	new ent = args[1]
	new speed = args[2]
	new iNewVelocity[3]
	entity_get_vector(ent, EV_VEC_origin, fl_origin)
	new origin[3]
	origin[0] = floatround(fl_origin[0])
	origin[1] = floatround(fl_origin[1])
	origin[2] = floatround(fl_origin[2])

	if((cmd_onrope[args[6]] == 1) || (args[7] < 31)){
		if(is_user_alive(args[6]) == 1){
			get_user_origin(args[6],aimvec)
			dist = get_distance(aimvec,origin)
		}
		else {
			args[7] = 100
		}
		if(cmd_onrope[args[6]] == 1)
			args[7] = 0
	}
	else {
		new players[32], inum
		get_players(players,inum,"a")
		for(new i = 0 ;i < inum ;++i){
			if(players[i] != id){
				if(cmd_onrope[players[i]] == 1){
					new temp[3]
					get_user_origin(players[i],temp)
					t_aimvec[t_jp][0] = temp[0]
					t_aimvec[t_jp][1] = temp[1]
					t_aimvec[t_jp][2] = temp[2]
					t_index[t_jp] = players[i]
					t_jp++
				}
			}
		}
		for(new i = 0 ;i < t_jp ;++i){
			new temp[3]
			temp[0] = t_aimvec[i][0]
			temp[1] = t_aimvec[i][1]
			temp[2] = t_aimvec[i][2]
			dist = get_distance(temp,origin)
			if(dist < jp_dist){
				aimvec[0] = temp[0]
				aimvec[1] = temp[1]
				aimvec[2] = temp[2]
				jp_dist = dist
				args[6] = t_index[i]
				args[7] = 0
			}
		}
	}
	if(dist){
		if(speed < 400)
			avgFactor = 10
		else if(speed < 850)
			avgFactor = 4
		else
			avgFactor = 2

		new length, velocityvec[3]
		velocityvec[0]=aimvec[0]-origin[0]
		velocityvec[1]=aimvec[1]-origin[1]
		velocityvec[2]=aimvec[2]-origin[2]
		length=sqroot(velocityvec[0]*velocityvec[0]+velocityvec[1]*velocityvec[1]+velocityvec[2]*velocityvec[2])
		velocityvec[0]=velocityvec[0]*speed/length
		velocityvec[1]=velocityvec[1]*speed/length
		velocityvec[2]=velocityvec[2]*speed/length

		iNewVelocity[0] = (velocityvec[0] + (args[3] * (avgFactor-1) ) ) / avgFactor
		iNewVelocity[1] = (velocityvec[1] + (args[4] * (avgFactor-1) ) ) / avgFactor
		iNewVelocity[2] = (velocityvec[2] + (args[5] * (avgFactor-1) ) ) / avgFactor

		args[3] = iNewVelocity[0]
		args[4] = iNewVelocity[1]
		args[5] = iNewVelocity[2]
		if(dist < 60){
			vexd_pfntouch(ent,0)
			return PLUGIN_CONTINUE
		}
	}
	args[7] += 1
	new Float:fl_iNewVelocity[3]
	fl_iNewVelocity[0] = args[3] +0.0
	fl_iNewVelocity[1] = args[4] +0.0
	fl_iNewVelocity[2] = args[5] +0.0

	entity_set_vector(ent, EV_VEC_velocity, fl_iNewVelocity)
	set_task(0.1,"guide_rocket_rope",2020+ent,args,16)

	new Float:missile_health
	missile_health = Float:entity_get_float(ent, EV_FL_health)
	if(missile_health <10000.0)
		vexd_pfntouch(ent,0)

	return PLUGIN_CONTINUE
}

public guide_rocket_swirl(args[]){
	new ent = args[1]
	set_task(0.1,"guide_rocket_swirl",2020+ent,args,16)
	new Float:missile_health
	missile_health = Float:entity_get_float(ent, EV_FL_health)
	if(missile_health <10000.0)
		vexd_pfntouch(ent,0)

	return PLUGIN_CONTINUE
}

public rocket_fuel_timer(args[]){
	new ent = args[1]
	new id = args[0]
	remove_task(2020+ent)
	entity_set_int(ent, EV_INT_effects, 2)
	entity_set_int(ent, EV_INT_rendermode,0)
	entity_set_float(ent, EV_FL_gravity, 1.0)
	entity_set_int(ent, EV_INT_iuser1, 0)
	emit_sound(ent, CHAN_WEAPON, "debris/beamstart8.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM )
	emit_sound(ent, CHAN_VOICE, "ambience/rocket_steam1.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
	if(args[11] == 1){
		set_hudmessage(250,10,10,-1.0,0.45, 0, 0.0, 1.5, 0.5, 0.15, 54)
		show_hudmessage(id,"WARNING: FUEL TANK EMPTY^nCONTROLS DISENGAGED")
	}
	set_task(0.1,"guide_rocket_comm",2020+ent,args,16,"b")
	return PLUGIN_CONTINUE
}

public ls_missile_ck(){
	new arg[32]
	read_argv(1,arg,31)
	new iarg = str_to_num(arg)
	if(iarg){
		new szClassName[32]
		entity_get_string(iarg, EV_SZ_classname, szClassName, 31)
		if(equal(szClassName, "lud_missile")) {
			new prize = get_cvar_num("amx_missile_prizes")
			new obey = get_cvar_num("amx_missile_obeyffcvar")
			new ff = get_cvar_num("mp_friendlyfire")
			new arg2[32],name[32],nameowner[32],Message[192]
			read_argv(2,arg2,31)
			new id = str_to_num(arg2)
			new owner = entity_get_edict(iarg, EV_ENT_owner)
			new Tid,Towner
			Tid = get_user_team(id)
			Towner = get_user_team(owner)
			get_user_name(id,name,31)
			get_user_name(owner,nameowner,31)
			set_hudmessage(255,25,25, -1.0, 0.23, 0, 0.02, 8.0, 1.01, 1.1, 54)
			if( (Tid == Towner) && (is_cstrike == true) && ( ((ff == 1 ) && (obey == 0)) || (ff == 0) ) ){
				format(Message,191,"%s successfully shot down^n%s's missile with a laser",name,nameowner)
			}
			else {
				if(prize){
					format(Message,191,"%s successfully shot down %s's missile wi a laser^nA total of %d free missiles of each type were won!",name,nameowner,prize)
					client_print(id,print_chat,"[AMXX] You shot down a missile with the laser gun so you win free missiles")
					missile_win[id] += 1
					missile_inv[id][1] += prize
					missile_inv[id][2] += prize
					missile_inv[id][3] += prize
					missile_inv[id][4] += prize
					missile_inv[id][5] += prize
					missile_inv[id][6] += prize
					missile_inv[id][7] += prize
				}
				else {
					format(Message,191,"%s successfully shot down^n%s's missile with a laser",name,
 
New Member
Joined
May 31, 2004
Messages
30
Best answers
0
:S THIS is WEIRD :S
I tried compiling under 0.20, and it gave me a CRASH, like,
Code:
an error ocurred in amxxsc.exe and caused it to shut down.

[b]BEFORE it shuts down I see this in compile.exe[/b]:
Internal error.
And Yes I DID run the compile.exe, which gave it THAT error. And it only happens with that plugin :S.

in 0.16, it gives like 26 errors, which cause it... to abort compilation.
If you want me to state the errors in amxx 0.16:
Code:
undefined symbol "require_module" (happens 3 times)
undefined symbol "name" (happens 5 times)
local variable "args" shadows a variable at a preceding level (3 times)
expected token: ")", but found "-identifier-"
undefined symbol "ssile"
symbol already defined: "entity_get_vector"
funtion "entity_get_vector" should return a value
symbol is never used: "vOrigin"
symbol is never used: "EV_VEC_origin"
invalid function or decleration
tag mismatch
function "floatround" should return a value
invalid function or declaration
undefined symbol "icmd"
undefined symbol "id" (happens 3 times)
undefined symbol "admin"
undefined symbol "cs_get_user_money"
undefined symbol "cs_set_user_money"
undefined symbol "id" (happens 4 times)
undefined symbol "icmd"
undefined symbol "id"
Want me to put the lines where they occur too? :p
 
Senior Member
★ Black Lounger ★
✔️ HL Verified
💻 Oldtimer
Joined
Feb 17, 2003
Messages
1,483
Best answers
0
SLAP YOUR SELF. That code is for the new version.
That error with the compiler means you has a bad executeable. (wich is diffrent from the error I was expecting)
When I get home I will try to compile for j00.
 
New Member
Joined
May 31, 2004
Messages
30
Best answers
0
but wha, huh? wot? er?

If it's a bad executeable, is it like it can't read something, that is used in the plugin, but not in others. that causes it to crash?

?!?!?!???!??!?!

*slaps himself*
and.... what now?



AAAAAAAAAAAAAAAAAAAAAAAAH
OMGWTFBBQ?!?!?!?!

I just tried compiling the code in the ONLINE compiler on www.amxmodx.org

But the weird thing was, it gave me RANDOM plugins :S instead of the stuff I actually put in!

Oh well, guess I gotta wait for your compile then lol.

EDIT: EVEN MORE AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH
I tried compiling it under:
amxx 0.20 - RC6
amxx 0.20 - RC7
amxx 0.20 - 20041030
amxx 0.20 - 20041101

ALL those compilers, crash....
and any version before 0.16, gives a load of errors....

p.s: sorry if I make you mad because of this response, I mean your doing the work :p, but its just that it doesn't work... and argh, blergh, urgh. because I're getting URGH from that lol.
 
Senior Member
★ Black Lounger ★
✔️ HL Verified
💻 Oldtimer
Joined
Feb 17, 2003
Messages
1,483
Best answers
0
What happenes when a mod updated to a higher version: the new code is not useable for old versions. Stop complaining about the versions before 0.16 and calm down. I am looking at it right now.

*edit*
HERE is a winRAR (http://www.rarlab.com/) copy of the file. Please tell me of run time errors, cause I removed all compiler errors.
 
New Member
Joined
May 31, 2004
Messages
30
Best answers
0
YES, it works perfectly, no runtime errors at all...
The only weird thing is that it says I killed a teammate if he joins evil in the beginning, but I dun care bout that. Oh, and that sometimes I cant even damage someone >.> but oh well.

This should be perfect for some of my ''customized'' gametypes lol

Many tahnks :p

P.s: I forgot what I wanted to add, i'll say it later lol...

Oh yea, that it crashes a lot more ^.^ but I just ignore it lol.
 

Users who are viewing this thread

Top Bottom