Raised This Month: $ Target: $400
 0% 

Help with beameup plugin


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
sleeperzzz
Senior Member
Join Date: Aug 2004
Location: In my bed
Old 07-09-2006 , 18:48   Help with beameup plugin
Reply With Quote #1

YO,

Now my friend has an idea that i think is great and i would like to give it a try to learn something so thats why im here.

So okay anyone knowing beammeup plugin from ludwig will know what im talking about so you can drop next paragraph of text.

----------------
Beammeup is a teleport plugin saying something makes you teleport from one place to an earlier stored spot and it has a special effect to teleport it makes litle dots on your screen from beginning to end and then goes away again
----------------

Now back on topic so okay my friend was like okay why not change those dots on the screen to like lines or like the stargate sg1 teleport thingy.


So i need help i think i know where the code is to make the dots appear on the players screen and for other people to see

Below is full plugin code
Code:
/***************************************************************************
 *  amx_ejl_beammeup.sma    version 2.4                Date: 12/16/2002
 *   Author: Eric Lidman     [email protected]
 *   Alias: Ludwig van       Upgrade: http://lidmanmusic.com/cs/plugins.html          
 *
 *
 * Ever watch the orignal Star-Trek TV show? This is a fun plugin which
 *  gives limited teleporting powers (you can decide how limited) to
 *  players using the theme of the Star-Trek matter transporter. There
 *  are sounds from the show too, including our favorite first engineer,
 *  the keeper of the transporter, Scotty. This plugin is currently only
 *  set up to work with the Counter-Strike mod. If there is enough interest
 *  from people running other mods like TFC, DOD, etc. I may go ahead and
 *  make it friendlier to those mods. Already some of the basic coding is
 *  in place, for example it can handle 4 teams worth of coordinates in
 *  many functions. That is sort of a vestige of the adminmod version of 
 *  this plugin I wrote which was both TFC and DOD ready. I did not carry
 *  over mod friendliness this AMX version, not yet anyway. Many player
 *  commands listed below the admin command and cvars.
 *
 * PODBOT: If using my podbots controller, podbots use this plugin too. 
 *
 * Here are the admins scotty control commands:
 *
 *  amx_scotty_on         --- resets to default, only "beam me up" allowed
 *  amx_scotty_off        --- shuts scotty down completely (we dont here)
 *  amx_scotty_unlimited  --- lets "beam me up" be used unlimited times
 *  amx_scotty_crazy      --- fully functional transporter
 *  amx_scotty_insane     --- fully functional transporter
 *                            coordinates can be gathered anytime
 *                            beaming to enemy spawn is permitted
 *                            even at round start
 *  amx_votescotty        --- admin command to start a vote to enable the
 *                            mode amx_scotty_crazy. Players do not have
 *                            access to this. They can however do the same
 *                            with 'vote_scotty' through the chat if you 
 *                            allow that with amx_scotty_vote (below)
 *  amx_scotty_reset      --- if always stuck busy with noone beaming
 *                            AMX ADMIN_RCON is required for this too.
 *                            (obsolete at this point what with AMX having
 *                            reliable timers unlike another mod for admins)
 *  amx_scotty_override   --- forces players to use maps preset coordinates
 *                            even if they had their own coordinates locked
 *  amx_scotty_reload <leave blank or put "custom">
 *                    --- reloads a maps default beam me up coordiantes.
 *                        If used this way, "amx_scotty_reload custom"
 *                        then the coordinates saved by the setbeam 
 *                        command will be reloaded over the default
 *                        ones. To get the default ones back just issue
 *                        "amx_scotty_reload".  
 *  amx_scotty_setbeam <team_number> or <team_number z_modifier> or
 *                     <team_number x y z z_modifier>   
 *                 --- this command sets new coordinates for "Beam me
 *                     up scotty". For that mapload, they override the 
 *                     transporter_xyz.ini unless the reload command
 *                     is used. It can be issued 3 ways. Example:
 *                        amx_scotty_setbeam 1
 *                        amx_scotty_setbeam 1 100
 *                        amx_scotty_setbeam 1 -323 98 123 100
 *                     The first way sets coordinates for team 1 with
 *                     the admins own coordinates. Team 1 in CS is
 *                     the Terrorists. The second way sets team 1 
 *                     coordinates with the admins own coordinates with
 *                     100 added to the height. The third way sets team 1
 *                     coordinates with the x,y, and z numbers with 100 
 *                     added to the z. The z modifier value is unnecessary.
 *                     This was to help prevent a person from transporting
 *                     into another. Anyway, this command is useful for 
 *                     setting team beam up points on maps which are not 
 *                     listed in the transporter_xyz.ini. They are
 *                     automatically saved to the transporter_custom.ini and
 *                     then automatically reloaded everytime thereafter that
 *                     map is played. If multiple coordinates for a team/map 
 *                     are entered, only the last ones are used. If a map for
 *                     which you make custom default coordinates is listed
 *                     in the transporter_xyz.ini, then the next time you 
 *                     load the map, the cordinates in transporter_xyz.ini
 *                     will be prefered. You can still get your custom ones
 *                     by using the command "amx_scotty_reload custom".
 *
 *  amx_scotty <player> <various_parameters>
 *                 --- admin can use scotty to teleport another player
 *                     in different ways -- to either team's spawn point,
 *                     to another player, to numerical xyz coordinates, 
 *                     or even to the admin's or any players saved 
 *                     coordinates from, yes "scotty lock onto my
 *                     coordinates". I mean, why not, they are stored in
 *                     memory, we are just retieving them and using the
 *                     saved lock coordinates for other players.
 *                     Usage:
 *                       amx_scotty <player> to <team> base
 *                       amx_scotty <player> to <player2>
 *                       amx_scotty <player> to <player2> <lock 1,2 or 3>
 *                       amx_scotty <player> <x> <y> <z>
 *                     Actual examples of usage:                          
 *                       amx_scotty Ludwig to CT base
 *                       amx_scotty Ludwig to Vodka
 *                       amx_scotty Ludwig to Vodka 3
 *                       amx_scotty Ludwig 100 100 100
 *
 *  amx_scotty_revoke <player> <optional time in minutes to revoke>
 *                 --- admin can revoke a player's scotty privilages while
 *                     leaving other player's scotty privilages untouched.
 *                     If there is no time given, the default of 15 minutes
 *                     will be the time scotty privilages are revoked for.
 *                     Maximum time is 60 minutes. If the command is used 
 *                     again on the same player, his privilages are granted
 *                     back to him.
 *                     Usage:
 *                       amx_scotty_revoke <player>
 *                       amx_scotty_revoke <player> <minutes>
 *                     Actual examples of usage:                          
 *                       amx_scotty_revoke Ludwig
 *                       amx_scotty_revoke Ludwig 20
 *
 *
 * CVARS: which can be set in the admin.cfg
 *  
 *  amx_startrek_teleportmode on      -default normal. Can be set to:
 *                                     off on unlimited crazy insane
 *                          "off"       -shuts scotty down completely
 *                          "on"        -is default, only "beam me up
 *                                       scotty" allowed      
 *                          "unlimited" -lets "beam me up scotty" be used
 *                                       unlimited times
 *                          "crazy"     -fully functional transporter
 *                          "insane"    -fully functional transporter
 *                                       coordinates can be gathered 
 *                                       anytime beaming to enemy spawn
 *                                       is permitted even at round start
 *
 *  amx_scotty_no_vip 1     -default is 1 to not allow vip to teleport
 *                           via the energize command or to tag along
 *                           with others teleporting set that cvar to 0
 *                           to allow free vip telepoting
 *  amx_scotty_punish 1     -default is 1 to punish players who get stuck
 *                           when they teleport. The punsishment is to be
 *                           sent back to enemy base naked and slapped 
 *                           with a power of 99. Set to 0 if you want 
 *                           stuck players returned safely to home base.
 *  amx_scotty_vote 1       -enables/disables the player's "vote_scotty"
 *                           chat command so that only admins can set 
 *                           the scotty mode.
 *  amx_scotty_beamwidth 60 -sets the radius around which others will be
 *                           teleported when a player teleports. 60 works
 *                           best. Set to 0 if you dont want to allow by- 
 *                           standers to be teleported
 *  amx_scotty_multibeam 1  -set to 0 for one transportporter allowed to
 *                           work at a time for all players to share.
 *                           This was the old method.
 *                          -set to 1 for a transporter allowed to operate
 *                           independently for each team. For example,
 *                           a member of team 1 can teleport at the same
 *                           time as a member of team 2, but two people 
 *                           from the same team cannot independently
 *                           teleport at the same time. IS DEFAULT.
 *                          -set to 2 for allowing anyone at anytime to
 *                           teleport independently but at the same time
 *                           warning, this mode 2 could be laggy perhaps.
 *  amx_scotty_spawnz 1600  -sets the default radius around player spawn
 *                           area where players from the opposite team 
 *                           may not teleport to in the first 20 seconds
 *                           of a round. Default spawn locations must be
 *                           provided in the transporter_xyz.ini or the  
 *                           custom .ini file that does the same thing in
 *                           order for this to work.
 *  amx_scotty_spawntime 25 -sets the amount of time a player has to wait
 *                           in order to beam into the opposite team's 
 *                           spawn area. Setting above 25 seconds may 
 *                           have adverse effects if the rounds are short
 *  amx_scotty_beamwait 900 -sets the amount of time a player must wait
 *                           before using scotty teleport in the minimal
 *                           on mode where only "beam me up scotty" is 
 *                           allowed. Time is seconds: (900 sec.= 15 min)    
 *  amx_scotty_beamwait2 25 -sets the amount of time a player must wait 
 *                           to teleport again using scotty. This is only
 *                           applicable if the mode is unlimited, crazy,
 *                           or insane. Time is seconds.
 *  amx_scotty_usepak 0     -enables/disables the use of Half-Life pak file
 *                           sounds instead of the custom sounds. By default
 *                           the plugin will try to use the custom sounds,
 *                           but if this cvar is set 1 it will switch to pak
 *                           sounds. The advatage of pak sounds is clients
 *                           done need to download anything. The
 *                           disadvantage is that pak sounds are lame. Some
 *                           results of this cvar are only effective after 
 *                           a map change.
 *  amx_scotty_stucktime 15 -sets how many seconds a player has before he
 *                           must move from the exact loaction he beamed to
 *                           if he has not moved by that time, the server
 *                           will attempt to move him slighty, if that 
 *                           fails, the server will send him back to the
 *                           "beam me up scotty" spawn points you set. If
 *                           that fails, the player is killed. All of this
 *                           is aimed at dealing with players who get them-
 *                           selves stuck when teleporting thus holding up
 *                           the game.
 *
 *
 * For Players:
 *
 *      Say: vote_scotty    -- sets up a vote to enable amx_scotty_crazy
 *          (default: disabled unless high admin uses amx_scotty_vote)
 *
 *      say: /scotty_help      -- opens up an MOTD style window explaing
 *                                usage of all scotty commands
 *      say: /scotty           -- opens up the scotty player command menu
 *      console: scotty_menu   -- opens up the scotty player command menu
 *      console: scotty_pmenu  -- shortcut to the beam me to player menu
 *
 *  Here is the command to use the transporter in its minimum mode. It
 *  transports you back to your own spawn point:
 *
 *      say: beam me up scotty
 *
 *  With amx_scotty_crazy mode you can save up to any 3 locations on a map
 *  with while alive with the commands below: 
 * 
 *      say: scotty lock onto my coordinates        --- save set 1
 *      say: scotty lock 2 onto my coordinates      --- save set 2
 *      say: scotty lock 3 onto my coordinates      --- save set 3
 *
 *  To go transport to those saved coordinates (if it is near round start
 *  and the coordinates are close to enemy spawn, transport will be denied):
 *
 *      say: scotty energize                        --- go to set 1
 *      say: scotty energize 2 now                  --- go to set 2
 *      say: scotty energize 3 now                  --- go to set 3
 *
 *  To beam to the last place one of your teamates beammed to (follow him):
 *
 *      say: scotty beam me to my teamates
 *  
 *  To beam to a particular teammate, use his name where it says <player>.
 *  You may also beam to that players saved coordinates from that player's
 *  "scotty lock onto my coordinates" command. Very cool.   
 *
 *      say: scotty beam me to <player>
 *      say: scotty beam me to <player> <1, 2, or 3 coordinates>
 *
 *      Actual usage with coordinates:   say: scotty beam me to Ludwig 3
 * 
 * To gather coordinates while dead amx_scotty_insane has to be enabled
 *  and will only last as long as the admin who enabled it stays connected
 *  for the reason that things could get out of hand with players
 *  transporting off the map and no admin there to take care of them.
 *  There is a built in protection against players who got stuck 
 *  transporting off the map or into a wall, but it only works if the
 *  player cant move at all. This player will be sent back to base and
 *  be buried. Also, under amx_scotty_insane, you are permitted to beam
 *  to enemy spawn at round start.
 *
 * Also, under amx_scotty_insane, you can "say: where am i scotty" and
 *  the numeric x,y,z coordinates will be given to you. To go to any
 *  numeric x,y,z coordinates, "say: scotty -948 99 704" or whatever set of
 *  3 numbers you want. This was the old way, but I left it in and made
 *  accessible in insane mode only. One more insane mode feature is to
 *  transport to enemy base by "say: scotty beam me up". (instead of the
 *  home base command "say: beam me up scotty" -- a subtle difference.)
 * 
 *      say: where am i scotty
 *      say: scotty beam me up   
 *
 * Under all scotty modes only one transporting can occur at any given time.
 *  But if you huddle together with somenone who is transporting, you go
 *  with them to wherever they go.
 *
 *
 * INSTALLATION:    (This is not a simple plugin to install. READ THIS):
 *
 *  PLEASE GO TO MY SITE:   http://lidmanmusic.com/cs/plugins.html
 *
 *  Download the extras package for "Beam Me Up Scotty" because they are
 *  not just extras, they are essentials. If fail to install some of them
 *  the plugin will produce an error log in your AMX folder telling you
 *  what you need to do. Upon you correcting the matter, the plugin will
 *  automatically get rid of that error log.
 *
 *  The transporter_xyz.ini goes in your  ..cstrike\addons\amx  folder.
 *  All the sound (.wav) files go into your ..cstrike\sounds\misc  folder.
 *  Four of the sounds (transporter_enrgize1.wav, transporter1_v1.wav,
 *  transporter2_v1.wav, and transporter_scottybeammeup.wav) are very 
 *  important to gameplay. This way you can hear if someone is beaming
 *  in or out around you. These four sounds get precached and are auto-
 *  matically downloaded to clients as long as you put the .wav files
 *  themselves on the server in the proper folder. Really though, all
 *  the clients should have all the sounds in their ..sounds\misc too.
 *  You can auto download those remaining sounds to people using the 
 *  .res files provided in the extras package for this plugin.  These
 *  files go into the ..\maps directory unless you already have .res 
 *  files there of the same name. In that case you will want to change the
 *  names to maps which dont yet have .res files. Preferably these will be
 *  maps you play often so that the sounds will propagate faster to more of
 *  your clients. The remaining files should be treated as you would for
 *  any other plugin.
 * 
 *  New: You may chose not to use the 4 required custom sounds and instead
 *  use default Half-Life pak file sounds which clients already have and
 *  therefore do not need to download. If you want to do this, then do not
 *  install the custom sounds on the server and set the amx_scotty_usepak
 *  cvar to 1
 *
 ***********************************************************************/

#include <amxmod>
#include <amxmisc>

new vault_value[128]
new votenumber = 0
new votecontroller[33][2]
new option[4]
new Float:vote_ratio
new totalvoters = 0
new st_vote
new bool:bVoteToStop = false
new bool:scvote_deny = false
new user_options[33][64]
new user_position[33]
new user_players[33][32]
new user_select[33]
new user_select_max[33]
new ppl_name_dat[24][32]
new ppl_misc_dat[24][2]
new isBeaming[33]
new isBeamingT[4]
new Float:LastBeamUpTime[33]
new WhereAmI[33][9]
new StuckCounter[33]
new byIndex[33][3]
new LastTranspMem[33][3]
new IsVip[33]
new fadeout[33]
new FXRed[33],FXGreen[33],FXBlue[33]
new bool:bOverride = false
new bool:setup_error = false
new bool:sound_error = false
new bool:cstrike_running
new bool:dod_running
new dod_team[33]
new bool:def_coords = false
new TheAdmin[33]
new TransCounter[33]
new ThisMap[33]
new round_start = 0
new extra_spawn_protect = 0
new toXYZ[33][3]
new strXt[10]
new strYt[10]
new strZt[10]
new strXct[10]
new strYct[10]
new strZct[10]
new strX3[10]
new strY3[10]
new strZ3[10]
new strX4[10]
new strY4[10]
new strZ4[10]

public plugin_init(){
	register_plugin("Beam Me Up Scotty", "2.4", "EJL")
	register_concmd("amx_scotty", "admin_scotty", ADMIN_LEVEL_H, "<player coordinate_string> : Admin forces a player to beam someplace.")
	register_concmd("amx_scotty_on", "admin_scotty_mode", ADMIN_LEVEL_H, ": Turns on transporter ability.")	
	register_concmd("amx_scotty_off", "admin_scotty_mode", ADMIN_LEVEL_H, ": Turns off transporter ability.")
	register_concmd("amx_scotty_unlimited","admin_scotty_mode",ADMIN_LEVEL_H,": Lets players transport as much as they want.")
	register_concmd("amx_scotty_crazy", "admin_scotty_mode", ADMIN_LEVEL_H, ": Allows coordinates other than base to be used.")
	register_concmd("amx_scotty_insane", "admin_scotty_mode", ADMIN_LEVEL_H, ": Allows further freedom in transporting.")
	register_concmd("amx_scotty_override", "admin_scotty_ovrd", ADMIN_LEVEL_H, ": Forces players to use maps preset coordinates.")
	register_concmd("amx_scotty_reload", "admin_scotty_reload", ADMIN_LEVEL_H, "<original | custom> Reloads scotty coordinates from files.")
	register_concmd("amx_scotty_reset", "admin_scotty_reset", ADMIN_RCON, ": Obsolete ... needed for old adminmod version, so why is it still here?")
	register_concmd("amx_scotty_revoke", "admin_scotty_revok", ADMIN_LEVEL_H, "amx_scotty_revoke <player optional_time> : Revokes a player's scotty privilages.")
	register_concmd("amx_votescotty","admin_vote_scotty",ADMIN_LEVEL_H,": Admin starts a vote to fully enable the transporter.")
	register_concmd("amx_scotty_setbeam", "admin_scot_setbeam", ADMIN_LEVEL_H, "<TeamNumber x y z z_modifier> Sets beam me up coordinates.")
	register_concmd("stopvote","stopvote",ADMIN_MAP,"stops vote in progress")
	register_clcmd("say /scotty_help","scotty_help")
	register_clcmd("say /amx_scotty_insane","scotty_help2")
	register_clcmd("say", "HandleSay")
	register_clcmd("say /scotty","show_main_menu")
	register_clcmd("scotty_menu", "show_main_menu")	
	register_clcmd("scotty_pmenu","show_ppl_menu2")
	register_menucmd(register_menuid("SCOTTY Teleport Menu"),1023,"action_main_menu")
	register_menucmd(register_menuid("Scotty beam me to:"),1023,"action_ppl_menu")
	register_menucmd(register_menuid("Scotty: Captain, fully enable the transporter? "),(1<<0)|(1<<1)|(1<<2)|(1<<3),"vote_count")
	register_cvar("amx_last_voting","0.0")
	set_cvar_float("amx_last_voting",0.0)
	register_cvar("amx_vote_inprogress","0")
	set_cvar_string("amx_vote_inprogress","0")
	register_cvar("amx_startrek_teleportmode","on",FCVAR_SERVER )
	register_cvar("amx_scotty_spawntime","25.0")
	register_cvar("amx_scotty_beamwait","900")
	register_cvar("amx_scotty_beamwait2","25")
	register_cvar("amx_scotty_multibeam","1")
	register_cvar("amx_scotty_spawnz","1600")
	register_cvar("amx_scotty_beamwidth","60")
	register_cvar("amx_scotty_vote","1")
	register_cvar("amx_scottyvote_ratio","0.51")
	register_cvar("amx_scvote_delay","300.0")
	register_cvar("amx_scotty_no_vip","1")
	register_cvar("amx_scotty_punish","1")
	register_cvar("amx_scotty_usepak","0")
	register_cvar("amx_scotty_stucktime","15.0")
	set_cvar_string("amx_startrek_teleportmode","on")
	set_cvar_string("amx_scottyvote_ratio","0.51")
	set_cvar_string("amx_scotty_spawntime","25.0")
	set_cvar_string("amx_scotty_beamwait","900")
	set_cvar_string("amx_scotty_beamwait2","25")
	set_cvar_string("amx_scotty_multibeam","1")
	set_cvar_string("amx_scotty_beamwidth","60")
	set_cvar_string("amx_scotty_spawnz","1600")
	set_cvar_string("amx_scotty_vote","1")
	set_cvar_string("amx_scvote_delay","300.0")
	set_cvar_string("amx_scotty_no_vip","1")
	set_cvar_string("amx_scotty_punish","1")
	set_cvar_string("amx_scotty_stucktime","15.0")
	register_event("Battery","vip_spawn","b","1=200") 
	register_event("SendAudio","scotty_prespawn","a","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw")
	register_event("TextMsg","scotty_prespawn","a","2&#Game_C","2&#Game_w")

	new line = 0 
	new sMapCoord[192] 
	new txtsize = 0
	new x[10]
	new y[10]
	new z[10]	 
	new sTeam[10]
	new sMap[30]
	new temp[12][10]
	get_mapname(ThisMap, 33)
	if(file_exists("addons/amx/BeamMeUpScotty_error.log") == 1){	
		delete_file("addons/amx/BeamMeUpScotty_error.log")
	}
	if(file_exists("addons/amx/transporter_custom.ini") == 1){
		while((line=read_file("addons/amx/transporter_custom.ini",line,sMapCoord,192,txtsize))!=0){
			parse(sMapCoord, sMap, 30, sTeam, 10, x, 10, y, 10, z, 10) 
			if (equal(sMap, ThisMap)) {
				if(strtonum(sTeam)==1){
					copy(strXt,10,x)
					copy(strYt,10,y)
					copy(strZt,10,z)
				}
				if(strtonum(sTeam)==2){
					copy(strXct,10,x)
					copy(strYct,10,y)
					copy(strZct,10,z)
				}
				if(strtonum(sTeam)==3){
					copy(strX3,10,x)
					copy(strY3,10,y)
					copy(strZ3,10,z)
				}
				if(strtonum(sTeam)==4){
					copy(strX4,10,x)
					copy(strY4,10,y)
					copy(strZ4,10,z)
				}
				def_coords = true
			}
		}
	}
	if(file_exists("addons/amx/transporter_xyz.ini") == 1){
		while((line=read_file("addons/amx/transporter_xyz.ini",line,sMapCoord,192,txtsize))!=0){
			parse(sMapCoord,sMap,30,temp[0],10,temp[1],10,temp[2],10,temp[3],10,temp[4],10,temp[5],10,temp[6],10,temp[7],10,temp[8],10,temp[9],10,temp[10],10,temp[11],10)
			if (equal(sMap, ThisMap)) {
				copy(strXt,10,temp[0])
				copy(strYt,10,temp[1])
				copy(strZt,10,temp[2])
				copy(strXct,10,temp[3])
				copy(strYct,10,temp[4])
				copy(strZct,10,temp[5])
				copy(strX3,10,temp[6])
				copy(strY3,10,temp[7])
				copy(strZ3,10,temp[8])
				copy(strX4,10,temp[9])
				copy(strY4,10,temp[10])
				copy(strZ4,10,temp[11])
				def_coords = true
			}
		}
		if (equal("de_driveby", ThisMap)) {
			extra_spawn_protect = 1
		}
	}else{
		if(file_exists("addons/amx/transporter_custom.ini") == 1){
			write_file("addons/amx/BeamMeUpScotty_error.log", "****  EJL Beam me up scotty:   ERROR REPORT    ****", -1)
			write_file("addons/amx/BeamMeUpScotty_error.log", " ", -1)
			write_file("addons/amx/BeamMeUpScotty_error.log", "File Error:  ..addons/amx/transporter_xyz.ini not found -- this is not a critical error in that", -1)
			write_file("addons/amx/BeamMeUpScotty_error.log", " you do at least have a transporter_custom.ini The only difficuty with this is that ", -1)
			write_file("addons/amx/BeamMeUpScotty_error.log", " your default coordiantes are soft and can be changed by admins. It is much safer ", -1)
			write_file("addons/amx/BeamMeUpScotty_error.log", " to have a transporter_xyz.ini file because it cannot be altered in-game.", -1)
			write_file("addons/amx/BeamMeUpScotty_error.log", " ", -1)		
			write_file("addons/amx/BeamMeUpScotty_error.log", "Please acquire the file transporter_xyz.ini from http://www.lidmanmusic.com/cs/plugins.html", -1)
			write_file("addons/amx/BeamMeUpScotty_error.log", " or from the AMXMOD forums. It sould be attached to the forum thread for this plugin", -1)
			write_file("addons/amx/BeamMeUpScotty_error.log", " In the event that it is unavailable, you may create one, contents must be in this format,", -1)
			write_file("addons/amx/BeamMeUpScotty_error.log", " one line per map:", -1)
			write_file("addons/amx/BeamMeUpScotty_error.log", " ", -1)
			write_file("addons/amx/BeamMeUpScotty_error.log", " mapname team1_x team1_y team1_z team2_x team2_y team_2z", -1)
			write_file("addons/amx/BeamMeUpScotty_error.log", " ", -1)
			write_file("addons/amx/BeamMeUpScotty_error.log", "EXAMPLE ENTRY for ..addons/amx/transporter_xyz.ini :", -1)
			write_file("addons/amx/BeamMeUpScotty_error.log", "de_dust 1257 3251 -92 -379 -1724 100", -1)
			write_file("addons/amx/BeamMeUpScotty_error.log", " ", -1)
			write_file("addons/amx/BeamMeUpScotty_error.log", "There must be an entry for each map you play if you want the 'Beam me up scotty'", -1)
			write_file("addons/amx/BeamMeUpScotty_error.log", " function to work. Also, without this data, the spawn rape prevention measures", -1)
			write_file("addons/amx/BeamMeUpScotty_error.log", " will not work.", -1)
		}else{
			setup_error = true
			write_file("addons/amx/BeamMeUpScotty_error.log", "****  EJL Beam me up scotty:   ERROR REPORT    ****", -1)
			write_file("addons/amx/BeamMeUpScotty_error.log", " ", -1)
			write_file("addons/amx/BeamMeUpScotty_error.log", "File Error:  ..addons/amx/transporter_xyz.ini not found -- which means you probably didnt", -1)
			write_file("addons/amx/BeamMeUpScotty_error.log", " read and follow the setup instructions for this plugin, did you?", -1)
			write_file("addons/amx/BeamMeUpScotty_error.log", " ", -1)		
			write_file("addons/amx/BeamMeUpScotty_error.log", "Please acquire the file transporter_xyz.ini from http://www.lidmanmusic.com/cs/plugins.html", -1)
			write_file("addons/amx/BeamMeUpScotty_error.log", " or from the AMXMOD forums. It sould be attached to the forum thread for this plugin", -1)
			write_file("addons/amx/BeamMeUpScotty_error.log", " In the event that it is unavailable, you may create one, contents must be in this format,", -1)
			write_file("addons/amx/BeamMeUpScotty_error.log", " one line per map:", -1)
			write_file("addons/amx/BeamMeUpScotty_error.log", " ", -1)
			write_file("addons/amx/BeamMeUpScotty_error.log", " mapname team1_x team1_y team1_z team2_x team2_y team_2z", -1)
			write_file("addons/amx/BeamMeUpScotty_error.log", " ", -1)
			write_file("addons/amx/BeamMeUpScotty_error.log", "EXAMPLE ENTRY for ..addons/amx/transporter_xyz.ini :", -1)
			write_file("addons/amx/BeamMeUpScotty_error.log", "de_dust 1257 3251 -92 -379 -1724 100", -1)
			write_file("addons/amx/BeamMeUpScotty_error.log", " ", -1)
			write_file("addons/amx/BeamMeUpScotty_error.log", "There must be an entry for each map you play if you want the 'Beam me up scotty'", -1)
			write_file("addons/amx/BeamMeUpScotty_error.log", " function to work. Also, without this data, the spawn rape prevention measures", -1)
			write_file("addons/amx/BeamMeUpScotty_error.log", " will not work.", -1)
		}
	}
	set_task(4.0,"check_soundtype")
	new mod_name[32]
	get_modname(mod_name,31)
	cstrike_running = equal(mod_name,"cstrike") ? true : false
	dod_running = equal(mod_name,"dod") ? true : false
	ejl_vault("WRITE","CURRENT_VOTE","NULL")

	register_srvcmd("botsay","handle_botsayplugin")
	return PLUGIN_CONTINUE
}

public check_soundtype(){
	if( (file_exists("sound/misc/transporter1_v1.wav")==0) && (!get_cvar_num("amx_scotty_usepak")) ){
		sound_error = true
		write_file("addons/amx/BeamMeUpScotty_error.log", "****  EJL Beam me up scotty:   ERROR REPORT    ****", -1)
		write_file("addons/amx/BeamMeUpScotty_error.log", " ", -1)
		write_file("addons/amx/BeamMeUpScotty_error.log", "File Error:  ..sound/misc/transporter1_v1.wav not found -- which means you probably", -1)
		write_file("addons/amx/BeamMeUpScotty_error.log", " did not read and follow the setup instructions for this plugin, did you? I can ", -1)
		write_file("addons/amx/BeamMeUpScotty_error.log", " also presuppose that since that sound file is not present, that the otheres are", -1)
		write_file("addons/amx/BeamMeUpScotty_error.log", " missing as well.", -1)
		write_file("addons/amx/BeamMeUpScotty_error.log", " ", -1)	
		write_file("addons/amx/BeamMeUpScotty_error.log", " The sounds are essential to proper gameplay. Please read the", -1)
		write_file("addons/amx/BeamMeUpScotty_error.log", " top of the .sma file for this plugin or its forum thread", -1)
		write_file("addons/amx/BeamMeUpScotty_error.log", " on the AMXMOD site for instructions on how to do this.", -1)
		write_file("addons/amx/BeamMeUpScotty_error.log", " ", -1)
		write_file("addons/amx/BeamMeUpScotty_error.log", " The alternative is to issue the command: amx_scotty_paksounds", -1)
		write_file("addons/amx/BeamMeUpScotty_error.log", " this will set the plugin to use default pak file sounds", -1)
		write_file("addons/amx/BeamMeUpScotty_error.log", " instead of the custom sounds that need to be downloaded", -1)
		write_file("addons/amx/BeamMeUpScotty_error.log", " to clients. You have not specified the use of pak sounds", -1)
		write_file("addons/amx/BeamMeUpScotty_error.log", " when you do, you will cease to get this message which is", -1)
		write_file("addons/amx/BeamMeUpScotty_error.log", " refreshed on every map change.", -1)
	}
	return PLUGIN_CONTINUE
}

public plugin_precache(){
	precache_sound( "weapons/egon_off1.wav")
	precache_sound( "weapons/egon_run3.wav")
	precache_sound( "weapons/egon_windup2.wav")
	precache_sound( "vox/_period.wav")
	if(!get_cvar_num("amx_scotty_usepak")){
		precache_sound( "misc/transporter1_v1.wav")
		precache_sound( "misc/transporter2_v1.wav")
	}
	return PLUGIN_CONTINUE 
}

public vip_spawn(id){
	if(get_cvar_num("amx_scotty_no_vip") == 1){
		new maxplayers = get_maxplayers()+1
		for (new i=1; i<=maxplayers; i++) {
			IsVip[i] = 0
		}
		new inum
		new players[32]
		get_players(players, inum ,"c")
		if(inum > 1){
			IsVip[id] = 1
		}
	}
	return PLUGIN_CONTINUE
}

public energize_FX(sid[]){
	new id = sid[0]
	if(TransCounter[id] > 1){
		new maxplayers = get_maxplayers()
		for (new i=1; i<=maxplayers; i++) {
			if(is_user_connected(i)){
				if( (TransCounter[id] < 3) && (byIndex[i][0] == id) ){
					fadeout[i] += 15
					FXRed[i] -=20
					FXGreen[i] -=20
					FXBlue[i] -=20
					if( (fadeout[i] < 99) && (FXRed[i] > 0) ){
						set_user_rendering(i,kRenderFxGlowShell, FXRed[i],FXGreen[i],FXBlue[i], kRenderTransAdd,fadeout[i])
					}
				}	
				else if( (TransCounter[id] < 7) && (byIndex[i][0] == id) ){
					fadeout[i] -= 18
					FXRed[i] -=40
					FXGreen[i] -=40
					FXBlue[i] -=40
					if( (fadeout[i] > -1) && (FXRed[i] > 0) ){
						set_user_rendering(i,kRenderFxGlowShell, FXRed[i],FXGreen[i],FXBlue[i],kRenderTransAdd,fadeout[i])
					}
				}
				if(byIndex[i][0] == id){
					new xyz[3]
					get_user_origin(i,xyz)
					te_teleporteffect(xyz)
				}
			}
		}
	}
	return PLUGIN_CONTINUE
}

te_teleporteffect(vec1[3]){
	message_begin( MSG_BROADCAST,SVC_TEMPENTITY) 
	write_byte( 11 )     //  TE_TELEPORT
	write_coord(vec1[0]) 
	write_coord(vec1[1]) 
	write_coord(vec1[2])
	message_end() 
}

public client_connect(id){
	if (id >= 1 && id <= 33){
		for (new i=0; i<=7; i++) {		
			WhereAmI[id][i] = 0
		}
		LastBeamUpTime[id] = -900.0
		votecontroller[id][1] = 0
		StuckCounter[id] = 0
		byIndex[id][0] = -1
		dod_team[id] = 0
	}
	return PLUGIN_CONTINUE
}

public client_disconnect(id){

	new Red = random(256)
	new Green = random(256)
	new Blue = random(256)
	new mode[16]
	get_cvar_string("amx_startrek_teleportmode",mode,15) 

	dod_team[id] = 0
	LastBeamUpTime[id] = -900.0
	votecontroller[id][1] = 0
	isBeaming[id] = 0
	TransCounter[id] = 0
	StuckCounter[id] = 0
	byIndex[id][0] = -1
	if((TheAdmin[id] == 1) && (equali(mode,"insane")) ){
		set_cvar_string("amx_startrek_teleportmode","crazy")
		TheAdmin[id] = 0
		set_hudmessage(Red,Green,Blue, -1.0, 0.23, 0, 0.02, 5.0, 1.01, 1.1, 3)
		show_hudmessage(0,"Scotty: Captain! The transporter has lost some power!")
		log_message("[AMX][Transporter] Admin who issued insane mode disconnected -- crazy mode engaged")
		playsoundall("misc/transporter_molecules.wav")
	}
	return PLUGIN_CONTINUE
}

public plugin_log(){
	new args = read_logargc()
	if(args == 2){
		new msg[32]
		read_logargv(1,msg,31)
		if(msg[6] == 'S')
			round_start_sc()
	}
	else if(args == 3){
		new msg[32]
		read_logargv(1,msg,31)
		if(equal(msg,"joined t",8)){
			new clinfo[64],won[32],cutoff,bcount
			new classinfo[32]	
			read_logargv(0,clinfo,63)
			read_logargv(2,classinfo,31)
			new tcbackw = strlen(clinfo)
			new cbackw = tcbackw
			for(new i=0;i<tcbackw;i++){
				cbackw -= 1
				if(cbackw > 0){
					if(clinfo[cbackw] == '<'){
						bcount +=1
						if(bcount == 3){
							copy(won,i-cutoff,clinfo[cbackw+1]) 
						}
						else if(bcount == 2)
							cutoff = i + 2						
					}
				}
			}
			new iwon = strtonum(won)
			new playerl = find_player("k",iwon)
			if(!playerl) return PLUGIN_CONTINUE
			if(equali(classinfo,"Axis"))
				dod_team[playerl] = 1
			else
				dod_team[playerl] = 2
		}	
	} 		
	return PLUGIN_CONTINUE
}

round_start_sc(){
	isBeamingT[1] = 0
	isBeamingT[2] = 0
	new maxpl = get_maxplayers()+1
	for(new k = 0; k < maxpl; k++){
		remove_task(1701+k)
		byIndex[k][0] = -1
		isBeaming[k] = 0
	}		 
}


public scotty_prespawn(){
	if(round_start == 0){
		round_start = 1
		new Float:ROUND_START_TIME = get_cvar_float("amx_scotty_spawntime") + 5.0
		set_task(ROUND_START_TIME,"roundstartover")
	}
	return PLUGIN_HANDLED
}

public roundstartover() {
	round_start = 0
}

playsoundall(ww[]){
	client_cmd(0,"play %s",ww)	
}

playsound(id,ww[]){
	client_cmd(id,"play %s",ww)	
}

public StuckTransCheck(args[]){
	new oxyz[3]
	new nxyz[3]
	new id = args[0]
	oxyz[0] = args[1]
	oxyz[1] = args[2]
	oxyz[2] = args[3]
	if(is_user_alive(id) == 1){
		get_user_origin(id,nxyz)
		if(get_distance(nxyz,oxyz) == 0){
			if(StuckCounter[id] == 0){
				StuckCounter[id] += 1
				client_print(id,print_chat,"<Server> WARNING: Server thinks you might be stuck due to teleporting. Please move.") 				
			}else{	
				StuckCounter[id] = 0
				client_cmd(id,"+forward")				
				set_task(0.3,"StuckTransAction",1699,args,5)
			}
		}
	}
	return PLUGIN_CONTINUE
}

public StuckTransAction(args[]){
	new Name[32]
	new oxyz[3]
	new nxyz[3]
	new id = args[0]
	oxyz[0] = args[1]
	oxyz[1] = args[2]
	oxyz[2] = args[3]
	client_cmd(id,"-forward")
	if(is_user_alive(id) == 1){
		get_user_origin(id,nxyz)
		if(get_distance(nxyz,oxyz) == 0){
			if((strlen(strXt)==0) || (strlen(strYt)==0) || (strlen(strZt)==0)|| (strlen(strXct)==0) || (strlen(strYct)==0) || (strlen(strZct)==0)) {
				client_print(id,print_chat,"<Server> The game must go on, you appeared to be stuck, therefore ...")
				client_print(id,print_chat,"<Server> Also, tell your admin to set up default coordinates for this map.")
				user_kill(id,1)
			}else{
				new iTeam
				if(dod_running)
					iTeam = dod_team[id]
				else
					iTeam = get_user_team(id)
				if(get_cvar_num("amx_scotty_punish") == 1){
					client_cmd(id,"slot1;+attack;-attack;drop;slot2;+attack;-attack;drop;slot5;+attack;-attack;drop")
					if(iTeam == 2){
						oxyz[0] = strtonum(strXt)
						oxyz[1] = strtonum(strYt)
						oxyz[2] = strtonum(strZt) - 30
					}
					if(iTeam == 1){
						oxyz[0] = strtonum(strXct)
						oxyz[1] = strtonum(strYct)
						oxyz[2] = strtonum(strZct) - 30
					}
					set_user_origin(id, oxyz)
					get_user_name(id,Name,31)
					user_slap(id,99)
					client_print(0,print_chat, "%s was stuck and has been sent to enemy base naked.", Name)
				}else{
					if(iTeam == 1){
						oxyz[0] = strtonum(strXt)
						oxyz[1] = strtonum(strYt)
						oxyz[2] = strtonum(strZt)
					}
					if(iTeam == 2){
						oxyz[0] = strtonum(strXct)
						oxyz[1] = strtonum(strYct)
						oxyz[2] = strtonum(strZct)
					}
					set_user_origin(id, oxyz)
					client_print(id,print_chat,"You were stuck and sent back to base, that is -- if you have a base.")
				}
			}	
		}
	}
	return PLUGIN_CONTINUE
}

public admin_scotty_mode(id,level,cid){
	if (!cmd_access(id,level,cid,1))
		return PLUGIN_HANDLED
	new Red = random(256)
	new Green = random(256)
	new Blue = random(256)
	new command[32]
	read_argv(0,command,31)
	set_hudmessage(Red,Green,Blue, -1.0, 0.23, 0, 0.02, 5.0, 1.01, 1.1, 3)
	if(equali(command[11],"of",2)){	
		show_hudmessage(0,"Scotty: She cant take it anymore capatin!^nThe transporter is dead!")
		playsoundall("misc/transporter_out1.wav")
		set_cvar_string("amx_startrek_teleportmode","off")
	}
	else if(equali(command[11],"on",2)){	
		show_hudmessage(0,"Scotty: Captain, the tranporter is working again!")
		playsoundall("misc/transporter_barely.wav")
		set_cvar_string("amx_startrek_teleportmode","on")
	}
	else if(equali(command[11],"un",2)){
		show_hudmessage(0,"Scotty: The transporter is recharged!")
		playsoundall("misc/transporter_operational.wav")
		set_cvar_string("amx_startrek_teleportmode","unlimited")
	}
	else if(equali(command[11],"cr",2)){
		show_hudmessage(0,"Scotty: Captain! The transporter is fully functional now!")
		playsoundall("misc/transporter_molecules.wav")
		set_cvar_string("amx_startrek_teleportmode","crazy")
	}
	else if(equali(command[11],"in",2)){
		show_hudmessage(0,"Scotty: Captain! The transporter is overloading!")
		playsoundall("misc/tranpsorter_gamble.wav")
		set_cvar_string("amx_startrek_teleportmode","insane")
	}else{
		console_print(id,"[AMX] You should never see this. Unknown command: %s",command)
		return PLUGIN_HANDLED
	}
	new name[32]
	get_user_name(id,name,31)
	console_print(id,"[AMX] Scotty teleport mode set to: %s",command)
	log_message("[AMX][Transporter] %s  used command  %s",name,command)
	switch(get_cvar_num("amx_show_activity"))	{
		case 2: client_print(0,print_chat,"ADMIN %s: Executed %s",name,command)
		case 1: client_print(0,print_chat,"ADMIN: Executed %s",command)
	}
	if(sound_error == true){
		console_print(id,"[AMX] Warning: Sound file not found!!!")
		console_print(id,"[AMX] Tell your server owner admin to check ..addons/amx BeamMeUpScotty_error.log")
	}
	if(setup_error == true){
		console_print(id,"[AMX] ERROR:  Your server owner did not read the instructions when he")
		console_print(id,"[AMX] set up this plugin. Tell him to check error log in .. addons/amx")
	}
	return PLUGIN_HANDLED
}

public admin_scotty_ovrd(id,level,cid){
	if (!cmd_access(id,level,cid,1))
		return PLUGIN_HANDLED
	new User[32]
	get_user_name(id,User,31)
	log_message("[AMX][Transporter] %s  used command  amx_scotty_override",User)
	if(bOverride == true){
		bOverride = false
		console_print(id,"Override is -- OFF")
	}else{
		bOverride = true
		console_print(id,"Override is -- ON")
	}
	return PLUGIN_HANDLED
}

public admin_scot_setbeam(id,level,cid){
	if (!cmd_access(id,level,cid,2))
		return PLUGIN_HANDLED
	new User[32]
	get_user_name(id,User,31)
	log_message("[AMX][Transporter] %s  used command  amx_scotty_setbeam",User)
	new x[10]
	new y[10]
	new z[10]
	new ixyz[3]
	new modz[10]
	new sTeam[10]
	new cust_coords[100]
	read_argv(1,sTeam,10)
	read_argv(2,x,10)
	read_argv(3,y,10)
	read_argv(4,z,10)
	read_argv(5,modz,10)
	new iz = strtonum(z)
	if(strtonum(y) == 0){
		if(is_dedicated_server() == 0){
			id = 1
		}else{
			if(id == 0){
				console_print(id,"[AMX] You need to specify coordinates x,y,z to set. Ex: 100 100 100")
				return PLUGIN_HANDLED
			}
		}	
		get_user_origin(id,ixyz)
		ixyz[2] += strtonum(x)
		numtostr(ixyz[0],x,10)
		numtostr(ixyz[1],y,10)
		numtostr(ixyz[2],z,10)
	}else{
		iz += strtonum(modz)
		numtostr(iz,z,10)
	}
	if(strtonum(sTeam)==1){
		copy(strXt,10,x)
		copy(strYt,10,y)
		copy(strZt,10,z)
	}
	else if(strtonum(sTeam)==2){
		copy(strXct,10,x)
		copy(strYct,10,y)
		copy(strZct,10,z)
	}
	else if(strtonum(sTeam)==3){
		copy(strX3,10,x)
		copy(strY3,10,y)
		copy(strZ3,10,z)
	}
	else if(strtonum(sTeam)==4){
		copy(strX4,10,x)
		copy(strY4,10,y)
		copy(strZ4,10,z)
	}
	if((strtonum(sTeam) > 4) || (strtonum(sTeam) < 1)){
		console_print(id,"You need to chose a team  1-4")
		return PLUGIN_HANDLED
	}
	console_print(id,"Beamup Coordinates for team %s have been set to  %s %s %s", sTeam, x, y, z)
	format(cust_coords,100, "%s %s %s %s %s", ThisMap, sTeam, x, y, z)
	write_file("addons/amx/transporter_custom.ini",cust_coords, -1)
	return PLUGIN_HANDLED
}

public admin_scotty_reload(id,level,cid){
	if (!cmd_access(id,level,cid,1))
		return PLUGIN_HANDLED
	new User[32]
	get_user_name(id,User,31)
	log_message("[AMX][Transporter] %s  used command  amx_scotty_reload",User)
	new line = 0 
	new sMapCoord[192]
	new temp[12][10] 
	new txtsize = 0
	new x[10]
	new y[10]
	new z[10]	 
	new sTeam[10]
	new sMap[30]
	get_mapname(ThisMap, 32)
	new Data[32]
	read_argv(1,Data,32)
	if(equali(Data, "c", 1)){
		if(file_exists("addons/amx/transporter_custom.ini") == 1){
			while((line=read_file("addons/amx/transporter_custom.ini",line,sMapCoord,192,txtsize))!=0){
				parse(sMapCoord, sMap, 30, sTeam, 10, x, 10, y, 10, z, 10) 
				if (equal(sMap, ThisMap)) {
					if(strtonum(sTeam)==1){
						copy(strXt,10,x)
						copy(strYt,10,y)
						copy(strZt,10,z)
					}
					if(strtonum(sTeam)==2){
						copy(strXct,10,x)
						copy(strYct,10,y)
						copy(strZct,10,z)
					}
					if(strtonum(sTeam)==3){
						copy(strX3,10,x)
						copy(strY3,10,y)
						copy(strZ3,10,z)
					}
					if(strtonum(sTeam)==4){
						copy(strX4,10,x)
						copy(strY4,10,y)
						copy(strZ4,10,z)
					}
					def_coords = true
				}
			}
			setup_error = false
			console_print(id,"[AMX] Custom team beam-up coordinates loaded.")
			if(file_exists("addons/amx/transporter_xyz.ini") == 1){
				return PLUGIN_HANDLED
			}else{
				console_print(id,"[AMX] Warning: transporter_xyz.ini not found. See error log in ..addons/amx")
			}
			return PLUGIN_HANDLED
		}else{
			console_print(id,"[AMX] Failed: File transporter_custom.ini not found.")
			if(file_exists("addons/amx/transporter_xyz.ini") == 1){
				console_print(id,"[AMX] But you do at lease have transporter_xyz.ini")
			}else{
				console_print(id,"[AMX] Failed: transporter_xyz.ini not found either.")
			}
			return PLUGIN_HANDLED
		}
	}
	if(file_exists("addons/amx/transporter_xyz.ini") == 1){
		while((line=read_file("addons/amx/transporter_xyz.ini",line,sMapCoord,192,txtsize))!=0){
			parse(sMapCoord,sMap,30,temp[0],10,temp[1],10,temp[2],10,temp[3],10,temp[4],10,temp[5],10,temp[6],10,temp[7],10,temp[8],10,temp[9],10,temp[10],10,temp[11],10)
			if (equal(sMap, ThisMap)) {
				copy(strXt,10,temp[0])
				copy(strYt,10,temp[1])
				copy(strZt,10,temp[2])
				copy(strXct,10,temp[3])
				copy(strYct,10,temp[4])
				copy(strZct,10,temp[5])
				copy(strX3,10,temp[6])
				copy(strY3,10,temp[7])
				copy(strZ3,10,temp[8])
				copy(strX4,10,temp[9])
				copy(strY4,10,temp[10])
				copy(strZ4,10,temp[11])
				def_coords = true
			}
		}
		setup_error = false
		console_print(id,"[AMX] Default team beam-up coordinates loaded.")
		return PLUGIN_HANDLED
	}else{
		if(file_exists("addons/amx/transporter_custom.ini") == 1){
			setup_error = false
			console_print(id,"[AMX] Failed: transporter_xyz.ini not found. Owner did not setup plugin properly.")
			console_print(id,"[AMX] Tell Owner to check for the error log on the server in ..addons/amx.")
		}else{
			console_print(id,"[AMX] Failed: transporter_xyz.ini not found. Owner did not setup plugin properly.")
			console_print(id,"[AMX] Tell Owner to check for the error log on the server in ..addons/amx.")
		}
		return PLUGIN_HANDLED
	}
	return PLUGIN_HANDLED
}

public admin_scotty_reset(id,level,cid){
	if (!cmd_access(id,level,cid,1))
		return PLUGIN_HANDLED
	new User[32]
	get_user_name(id,User,31)
	log_message("[AMX][Transporter] %s  used command  amx_scotty_reset",User)
	new maxplayers = get_maxplayers()
	for (new i=1; i<=maxplayers; i++) {
 		LastBeamUpTime[i] = 0.0
		TheAdmin[i] = 0
		byIndex[i][0] = -1
		byIndex[i][1] = 0
		byIndex[i][2] = 0
		WhereAmI[i][0] = 0
		WhereAmI[i][1] = 0
		WhereAmI[i][2] = 0
		WhereAmI[i][3] = 0
		WhereAmI[i][4] = 0
		WhereAmI[i][5] = 0
		WhereAmI[i][6] = 0
		WhereAmI[i][7] = 0
		WhereAmI[i][8] = 0
		StuckCounter[i] = 0
		TransCounter[i] = 0
	}
	playsoundall("misc/transporter_trynow.wav")
	return PLUGIN_HANDLED
}

public admin_vote_scotty(id,level,cid) {
	if (!cmd_access(id,level,cid,1))
		return PLUGIN_HANDLED
	new User[32]
	get_user_name(id,User,31)
	log_message("[AMX][Transporter] %s  used command  amx_votescotty",User)
	ScottyVote(id)
	return PLUGIN_HANDLED
}

public ScottyVote(id) {
	if( (scvote_deny == true) && (!(get_user_flags(id)&ADMIN_MAP)) ){
		client_print(id,print_chat,"[AMX] We just had a scotty vote. Wait a little longer.")
		return PLUGIN_HANDLED
	}
	new Float:voting = get_cvar_float("amx_last_voting")
	if (voting > get_gametime()){ 
		client_print(id,print_chat,"There is already one voting...") 	
		return PLUGIN_HANDLED 
	} 
	if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime()) {
 		client_print(id,print_chat,"Voting not allowed at this time")
		return PLUGIN_HANDLED 
	}
	new mode[16]
	get_cvar_string("amx_startrek_teleportmode",mode,15) 
	if (equali(mode,"insane",2)){
		client_print(id,print_chat,"[AMX] Scotty voting is not allowed when we are locked into amx_scotty_insane mode.")
		return PLUGIN_HANDLED
 	}
	new inprogress[32]
	get_cvar_string("amx_vote_inprogress",inprogress,32)
	if(equal(inprogress, "0",1)){
	new menu_msg[256]
	new keys
	if (cstrike_running)
		format(menu_msg,256,"\yScotty: Captain, fully enable the transporter? \w^n^n1.  Beam me up Scotty!^n2.  No thanks")
	else
		format(menu_msg,256,"Scotty: Captain, fully enable the transporter? ^n^n1.  Beam me up Scotty!^n2.  No thanks")
	keys = (1<<0)|(1<<1)
	new authid[16],name[32]
	get_user_authid(id,authid,16)
	get_user_name(id,name,32)
	log_to_file("addons/amx/admin.log","^"%s<%d><%s><>^" vote scotty",name,get_user_userid(id),authid)
	new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0 
	set_cvar_float("amx_last_voting",  get_gametime() + vote_time )
	vote_ratio = get_cvar_float("amx_scottyvote_ratio")
	for(new a = 0; a < 33; a++){
		votecontroller[a][1] = 0
	}
	votenumber++
	set_cvar_string("amx_vote_inprogress","1")
	ejl_vault("WRITE","CURRENT_VOTE","SCOTTY")
	bVoteToStop = true
	totalvoters = 0
	new Team[33]
	new maxpl = get_maxplayers()+1
	for(new k = 1; k < maxpl; k++){
		if(!is_user_bot(k)){
			get_user_team(k,Team,33)
			if(!((equali(Team,"UNAS",4)) || (equali(Team,"SPEC",4)) || (get_user_time(k)== 0) )){
				show_menu(k,keys,menu_msg,floatround(vote_time))
				totalvoters++
			}
		}
	}
	st_vote = 0
	set_task(vote_time,"HandleScottyVote")
	console_print(id,"[AMX] Voting has started...")
	for(new j = 0; j < 4;++j) option[j] = 0
	}else{
	console_print(id,"[AMX] Voting not allowed yet.")	
	}
	return PLUGIN_HANDLED
}

public vote_count(id,key){
	ejl_vault("READ","CURRENT_VOTE","")
	if(equal(vault_value,"SCOTTY")){
	new name[32]
	get_user_name(id,name,32)
	if(votenumber != votecontroller[id][0]){
		votecontroller[id][0] = votenumber
		if (get_cvar_float("amx_vote_answers")) {
			client_print(0,print_chat,"[AMX] %s voted for option # %d",name,key+1)
		}
		option[key] += 1
	}else{
		votecontroller[id][1] +=1
	}
	}else{
		return PLUGIN_CONTINUE
	}
	return PLUGIN_HANDLED
}

public HandleScottyVote() {
	set_hudmessage(63,187,239, -1.0, 0.70, 2, 0.02, 10.0, 0.01, 0.1, 4)
	scvote_deny = true
	set_task(get_cvar_float("amx_scvote_delay"),"sc_vote_deny")
	set_cvar_string("amx_vote_inprogress","0")
	ejl_vault("WRITE","CURRENT_VOTE","NULL")
	bVoteToStop = false
	for(new a = 0; a < 33; a++){
		votecontroller[a][1] = 0
	}
	new mode[16]
	get_cvar_string("amx_startrek_teleportmode",mode,15) 
	if (equali(mode,"insane",2)){
		client_print(0,print_chat,"[AMX] Scotty vote has no effect. We are locked into amx_scotty_insane mode.")
		playsoundall("misc/tranpsorter_gamble.wav")
		return PLUGIN_CONTINUE
 	}
	if(st_vote == 1){
		st_vote = 0
		client_print(0,print_chat,"[AMX]  Voting sucessfully stopped.")
		return PLUGIN_HANDLED
	}
	new best = 0
	new best_count = 0
	for(new a = 0; a < 4; ++a) {
		if (option[a] > best_count){
			best_count = option[a]
			best = a
		}
	}
	new inum = totalvoters
	new Float:result_v = inum ? (float(option[best]) / float(inum)) : 0.0
	if (result_v >= vote_ratio) {
		if(best == 0){
			if (equali(mode,"crazy",2)){
 				show_hudmessage(0,"Voting Results: Scotty will stay !!!^n^n%d votes to keep the fully enabled the transporter^n%d votes to turn the transporter back to minumum power^n^n%d Total eligible voters",
				option[0],option[1],totalvoters)
				playsoundall("misc/transporter_molecules.wav")
			} else {
 				show_hudmessage(0,"Voting Results: Beam me up scotty wins !!!^n^n%d votes to fully enable the transporter^n%d votes to keep the transporter at minumum power^n^n%d Total eligible voters",
				option[0],option[1],totalvoters)
				playsoundall("misc/transporter_scottybeammeup.wav")
				set_cvar_string("amx_startrek_teleportmode","crazy") 				
			}
			log_to_file("addons/amx/admin.log","World triggered ^"voting_success^" (needed ^"%.2f^") (ratio ^"%.2f^") (result ^"scotty^")",vote_ratio,result_v)
		}else {
			if (equali(mode,"crazy",2)){
				show_hudmessage(0,"Voting Results: The transporter is no longer fully functional^n^n%d votes to keep the fully enabled the transporter^n%d votes to turn the transporter back to minumum power^n^n%d Total eligible voters",
				option[0],option[1],totalvoters)
				playsoundall("misc/transporter_out1.wav")
				set_cvar_string("amx_startrek_teleportmode","on") 	
			} else {
 				show_hudmessage(0,"Voting Results: Transporter will only function at minimal power^n^n%d votes to fully enable the transporter^n%d votes to keep the transporter at minumum power^n^n%d Total eligible voters",
				option[0],option[1],totalvoters)
				playsoundall("misc/transporter_outagain.wav")
			}
			log_to_file("addons/amx/admin.log","World triggered ^"voting_failure^" (needed ^"%.2f^") (ratio ^"%.2f^")",	vote_ratio,result_v)
		}
	}else{
		client_print(0,print_chat,"[AMX] Voting for scotty power failed... No clear majority.")
	}
	return PLUGIN_HANDLED
} 

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

	if(bVoteToStop == true){
		new name[32]
		get_user_name(id,name,32)
		st_vote = 1
		client_print(id,print_console,"[AMX]  ADMIN !!! Ignore the unknown command message -- its ok")
		client_print(0,print_chat,"[AMX]  %s has disabled the vote in progress.",name)
	}
	return PLUGIN_CONTINUE
}

public sc_vote_deny(){
	scvote_deny = false
	return PLUGIN_CONTINUE
}

public admin_scotty_revok(id,level,cid){
	if (!cmd_access(id,level,cid,2))
		return PLUGIN_HANDLED
	new Name[32]
	new User[32]
	new RevokeTimeS
	new RevokeTimeM[32]
	new arg[32]
	get_user_name(id,User,31)
	read_argv(1,arg,31)
	read_argv(2,RevokeTimeM,31)
	new mode[16]
	get_cvar_string("amx_startrek_teleportmode",mode,15)
	new TRANSPORTER_DELAY_L = get_cvar_num("amx_scotty_beamwait2") 
	new TRANSPORTER_DELAY = get_cvar_num("amx_scotty_beamwait") 
	if (equali(mode,"off",2)){
		console_print(id,"[AMX] Scotty has to be enabled for this command to be used.")
		return PLUGIN_HANDLED
	}
	new player = cmd_target(id,arg,1)
	if (!player) return PLUGIN_HANDLED
	get_user_name(player,Name,31)
	log_message("[AMX][Transporter] %s  used command  amx_scotty_revoke %s %s",User,Name,RevokeTimeM)
	if( (LastBeamUpTime[player] > get_gametime() + TRANSPORTER_DELAY) && (equali(mode,"on",2)) ){
		LastBeamUpTime[player] = -900.0
		switch(get_cvar_num("amx_show_activity"))	{
			case 2:	client_print(0,print_chat,"ADMIN %s: has restored %s's scotty privilages.", User, Name)
			case 1:	client_print(0,print_chat,"ADMIN: has restored %s's scotty privilages.", User, Name)
		}
		console_print(id,"[AMX] You have restored %s's scotty privilages,", Name)
		return PLUGIN_HANDLED
	}
	if( (LastBeamUpTime[player] > get_gametime() + TRANSPORTER_DELAY_L) && ( (equali(mode,"cr",2)) || (equali(mode,"un",2)) || (equali(mode,"in",2)) ) ){
		LastBeamUpTime[player] = -900.0
		switch(get_cvar_num("amx_show_activity"))	{
			case 2:	client_print(0,print_chat,"ADMIN %s: has restored %s's scotty privilages.", User, Name)
			case 1:	client_print(0,print_chat,"ADMIN: has restored %s's scotty privilages.", User, Name)
		}
		console_print(id,"[AMX] You have restored %s's scotty privilages,", Name)
		return PLUGIN_HANDLED
	}
	if(strlen(RevokeTimeM) == 0){
		LastBeamUpTime[player] = get_gametime() + 900.0
		switch(get_cvar_num("amx_show_activity"))	{
			case 2:	client_print(0,print_chat,"ADMIN %s: has revoked %s's scotty privilages for 15 minutes.", User, Name)
			case 1:	client_print(0,print_chat,"ADMIN: has revoked %s's scotty privilages for 15 minutes.", User, Name)
		}
		console_print(id,"[AMX] You have revoked %s's scotty privilages for 15 minutes.", Name)
		return PLUGIN_HANDLED
	}
	if((strtonum(RevokeTimeM) > 60) || (strtonum(RevokeTimeM) <= 0)){
		console_print(id,"[AMX] <Scotty>  Invalid parameters.  Revoke time is in minutes and must be a number between 1 and 60")
		return PLUGIN_HANDLED
	}
	RevokeTimeS = strtonum(RevokeTimeM) * 60
	LastBeamUpTime[player] = get_gametime() + (RevokeTimeS * 1.0)
	switch(get_cvar_num("amx_show_activity"))	{
		case 2:	client_print(0,print_chat,"ADMIN %s: has revoked %s's scotty privilages for %s minutes.", User, Name,RevokeTimeM)
		case 1:	client_print(0,print_chat,"ADMIN: has revoked %s's scotty privilages for %s minutes.", User, Name,RevokeTimeM)
	}
	console_print(id,"[AMX] You have revoked %s's scotty privilages for %s minutes.", Name, RevokeTimeM)
	return PLUGIN_HANDLED
}

public admin_scotty(id,level,cid){
	if (!cmd_access(id,level,cid,2))
		return PLUGIN_HANDLED
	if(setup_error == true){
		console_print(id,"[AMX] <scotty> Your server owner did not read the instructions when he")
		console_print(id,"[AMX] set up this plugin. Tell him to check error log in .. addons/amx")
		return PLUGIN_HANDLED
	}
	new args[12] // id defb revdefb tonum topl fx fy fx ux uy uz
	new bool:bSkipEnergize = false
	new User[32]
	new toTargetIndex
	get_user_name(id,User,31)
	new x[50],y[50],z[50]
	new fromXYZ[3]
	new arg[32]
	read_argv(1,arg,31)
	new toName[32]
	new Name[32]
	if((extra_spawn_protect == 1) && (round_start == 1)){
		console_print(id,"[AMX] <Scotty>  It will be a little longer captain, the warp drive is malfunctioning.")
		playsound(id, "misc/transporter_barely.wav")		
		return PLUGIN_HANDLED
	}
	new player = cmd_target(id,arg,1)
	if (!player) return PLUGIN_HANDLED
	read_argv(2,x,49)
	read_argv(3,y,49)
	read_argv(4,z,49)
	get_user_name(player,Name,31)
	if(is_user_alive(player) == 0){ 
		console_print(id,"[AMX] <Scotty>  I cant beam up dead people.")
		playsound(id, "misc/transporter_scottypower.wav")
		return PLUGIN_HANDLED
	}else{
		if (isBeaming[player] == 1){
			console_print(id,"[AMX] <Scotty>  You are already in a transporter beam captain!")
			playsound(id, "misc/transporter_scottypower.wav")
			return PLUGIN_HANDLED
		}
		if(equali(x, "to", 2)){
			if(equali(z, "b", 1)){
				if( (equali(y, "t", 1)) || (equali(y, "1", 1)) ) {
					bSkipEnergize = true
					if(dod_running){
						if(dod_team[player] == 2)
							args[2] = 1
					}else{
						if(get_user_team(player) == 2)
							args[2] = 1	
					}	
				}
				else if( (equali(y, "ct", 2)) || (equali(y, "2", 1)) ) {
					bSkipEnergize = true
					if(dod_running){
						if(dod_team[player] == 1)
							args[2] = 1
					}else{
						if(get_user_team(player) == 1)
							args[2] = 1	
					}
				}else{
					console_print(id,"[AMX] Failure:  This feature only works in a 2 team game")
					return PLUGIN_HANDLED
				}	 
				args[1] = 1
			}
			toTargetIndex = find_player("b",y)
			if( (toTargetIndex) && (bSkipEnergize == false)) {			  				
				get_user_name(toTargetIndex, toName, 31)
				if(equal(z, "1", 1)){
					if(WhereAmI[toTargetIndex][2] == 0){
						console_print(id,"[AMX] <Scotty>  No coordinates found in this player's lock coordinant set.")
						return PLUGIN_HANDLED
					}
					args[3] = 1
					bSkipEnergize = true
					args[8] = WhereAmI[toTargetIndex][0]
					args[9] = WhereAmI[toTargetIndex][1]
					args[10] = WhereAmI[toTargetIndex][2]
				}
				else if(equal(z, "2", 1)){
					if(WhereAmI[toTargetIndex][5] == 0){
						console_print(id,"[AMX] <Scotty>  No coordinates found in this player's lock 2 coordinant set.")
						return PLUGIN_HANDLED
					}
					args[3] = 1
					bSkipEnergize = true
					args[8] = WhereAmI[toTargetIndex][3]
					args[9] = WhereAmI[toTargetIndex][4]
					args[10] = WhereAmI[toTargetIndex][5]
				}
				else if(equal(z, "3", 1)){
					if(WhereAmI[toTargetIndex][8] == 0){
						console_print(id,"[AMX] <Scotty>  No coordinates found in this player's lock 3 coordinant set.")
						return PLUGIN_HANDLED
					}
					args[3] = 1
					bSkipEnergize = true
					args[8] = WhereAmI[toTargetIndex][6]
					args[9] = WhereAmI[toTargetIndex][7]
					args[10] = WhereAmI[toTargetIndex][8]
				}else{
					if (is_user_alive(toTargetIndex) == 0){
						console_print(id,"[AMX] <Scotty>  I cant beam to someone who doesnt exist anymore.")
						playsound(id, "misc/transporter_scottypower.wav")
						return PLUGIN_HANDLED
					}
					else if(toTargetIndex == player){
						console_print(id,"[AMX] <Scotty>  How do I beam someone to themselves?")
						playsound(id, "misc/transporter_scottypower.wav")
						return PLUGIN_HANDLED
					}
					args[3] = 0
					args[4] = toTargetIndex
				}
			}else{
				if(bSkipEnergize == false){ 
					console_print(id,"[AMX] <Scotty> Destination player not found.")
					return PLUGIN_HANDLED
				}
			}
		}else{
			if((strlen(x)==0) || (strlen(y)==0) || (strlen(z)==0)) {
				client_print(id,print_console,"[AMX] <Scotty>  I need the coordinates. Command format:  admin_scotty player x y z")
				return PLUGIN_HANDLED
			}
			args[3] = 1
			args[8] = strtonum(x)
			args[9] = strtonum(y)
			args[10] = strtonum(z)								
		}
		get_user_origin(player,fromXYZ)
		set_user_rendering(player,kRenderFxGlowShell, 150,150,150, kRenderNormal,16)
		new authid[16]
		get_user_authid(player,authid,15) 
		log_message("[AMX][Transporter] Transport Initiated for %s",authid)
		isBeaming[player] = 1
		byIndex[player][0] = player
		byIndex[player][1] = fromXYZ[0]
		byIndex[player][2] = fromXYZ[1]
		TransCounter[player] = 8
		fadeout[player] = 90
		FXRed[player] = 250
		FXGreen[player] = 250
		FXBlue[player] = 250
		if(get_cvar_num("amx_scotty_usepak"))
			emit_sound(player,CHAN_STATIC, "weapons/egon_windup2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
		else
			emit_sound(player,CHAN_ITEM, "misc/transporter1_v1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
		args[0] = player
		args[5] = fromXYZ[0]
		args[6] = fromXYZ[1]
		args[7] = fromXYZ[2]
		set_task(0.2,"energize_FX",1701,args,11,"a", 35)
		set_task(0.8,"transwarp_drive",1701+player,args,11,"a",7)
		log_message("[AMX][Transporter] %s  used command  amx_scotty %s %s %s %s",User,Name,x,y,z)
		client_print(0,print_chat,"[AMX] %s  used command  amx_scotty %s %s %s %s",User,Name,x,y,z)		
	}
	return PLUGIN_HANDLED
}

public handle_botsayplugin(){
	new arg0[8]
	read_argv(1,arg0,7)
	new iarg0 = strtonum(arg0)
	new sarg2[192]
	read_args(sarg2,191)
	new arg1[8]
	read_argv(2,arg1,7)
	new iarg1 = strtonum(arg1)
	if(is_user_bot(iarg1)){
		new OnlySay[128]
		new len = strlen(sarg2)
		new start = contain(sarg2,":    ")
		copy(OnlySay,len-start+5,sarg2[start+5])
		if(HandleSay2(iarg1,OnlySay))
			server_cmd("botsayreturn %d 1",iarg0)
	}
	return PLUGIN_CONTINUE
}

public HandleSay(id){
	new Data[128]
	read_args(Data,127)
	remove_quotes(Data)
	if(HandleSay2(id,Data))	
		return PLUGIN_HANDLED
	return PLUGIN_CONTINUE
}

HandleSay2(id,Data[]){
	new Text[128]
	new DataR[128]
	new authid[16]
	new User[32]
	new UserTeam
	if(dod_running)
		UserTeam = dod_team[id]	
	else
		UserTeam = get_user_team(id)
	new bool:bSkipEnergize = false
	new toTargetIndex
	new T_Name[33]
	new fromXYZ[3]
	new toPlayerXYZ[3]
	new wxyz[3]
	new ScottyMsg
	new strX[16]
	new strY[16]
	new strZ[16]
	new cmd[16]
	new SpecLoc[33]
	new lock[16]
	new args[12] // id defb revdefb tonum topl fx fy fx ux uy uz
//	read_argv(1,cmd,16)
//	read_argv(2,strX,16)
//	read_argv(3,strY,16)
//	read_argv(4,strZ,16)
//	read_argv(5,SpecLoc,16)
//	read_argv(6,lock,16)
//	if(strlen(strX) == 0){
	copy(DataR,127,Data)
	parse(DataR,cmd,15,strX,15,strY,15,strZ,15,SpecLoc,32,lock,15)
//	}
	get_user_name(id,User,31)
	if (equali(Data, "vote_scotty")) {
		if(get_cvar_num("amx_scotty_vote")){
			client_print(0,print_chat, "%s :   vote_scotty", User)
			playsound(id, "misc/transporter_molecules.wav")
			ScottyVote(id)
		}else{
			client_print(id,print_chat, "[AMX]  Sorry, 'vote_scotty' is disabled unless admin sets it otherwise")
		}			
		return PLUGIN_HANDLED
	}
	new mode[16]
	get_cvar_string("amx_startrek_teleportmode",mode,15)
	new TRANSP_SPAWN_RANGE = get_cvar_num("amx_scotty_spawnz")
	new TRANSPORTER_DELAY_L = get_cvar_num("amx_scotty_beamwait2") 
	new TRANSPORTER_DELAY = get_cvar_num("amx_scotty_beamwait")
	new mb_mode = get_cvar_num("amx_scotty_multibeam")
	if (equali(Data, "beam me up s",12)){
		if(setup_error == true){
			client_print(id,print_chat,"[AMX] <scotty> Your server owner did not read the instructions when he")
			client_print(id,print_chat,"[AMX] set up this plugin. Tell him to check error log in .. addons/amx")
			return PLUGIN_HANDLED
		}
		if (equal(mode,"off")){
 			client_print(id, print_chat, "<Mr. Spock>  The transporter is disabled captain.  Say: vote_scotty")
			playsound(id, "misc/transporter_out2.wav")
			return PLUGIN_HANDLED
		}
		if (get_gametime() - TRANSPORTER_DELAY_L < (LastBeamUpTime[id]) ){
			client_print(id,print_chat, "<Scotty>  Give someone else a chance, captain.")
			playsound(id, "misc/tranpsorter_gamble.wav")
			return PLUGIN_HANDLED
		}
		if (is_user_alive(id) == 0){
			client_print(id,print_chat, "<Scotty>  You are dead, why should I transport you?")
			playsound(id, "misc/transporter_scottybeammeup.wav")
			return PLUGIN_HANDLED
		}else{
			new deny
			if(mb_mode == 0){
				new maxplayers = get_maxplayers()+1
				for (new i=1; i<=maxplayers; i++) {				
					if(is_user_alive(i)){			
						if(isBeaming[i] == 1){
							deny = 1
						}			
					}
				}
			}
			else if(mb_mode == 1){
				if (isBeamingT[UserTeam] == 1){
					client_print(id,print_chat, "<Scotty>  She cant handle more than one at a time captain!")
					playsound(id, "misc/transporter_scottypower.wav")
					return PLUGIN_HANDLED
				}
			}
			if(deny){
				playsound(id, "misc/transporter_scottypower.wav")
				client_print(id,print_chat, "<Scotty>  She cant handle more than one at a time captain!")
				return PLUGIN_HANDLED	
			}
			if(isBeaming[id] == 1){
				client_print(id,print_chat, "<Scotty>  You are already in a beamup cycle!")					
				return PLUGIN_HANDLED	
			}
			if( (!equal(mode,"unlimited")) && (!equal(mode,"crazy")) && (!equal(mode,"insane")) ){
				if (get_gametime() - TRANSPORTER_DELAY < (LastBeamUpTime[id]) ){
					client_print(id,print_chat,"<Scotty>  The transporter is not fully recharged yet captain.")
					playsound(id, "misc/tranpsorter_gamble.wav")
					return PLUGIN_HANDLED
				}
			}
			client_print(0,print_chat,"%s :   beam me up scotty", User)
			get_user_origin(id,fromXYZ)
			args[0] = id
			args[1] = 1
			args[5] = fromXYZ[0]
			args[6] = fromXYZ[1]
			args[7] = fromXYZ[2]
			LastBeamUpTime[id] = get_gametime()
			set_user_rendering(id,kRenderFxGlowShell, 150,150,150, kRenderNormal,16) 
			isBeaming[id] = 1
			isBeamingT[UserTeam] = 1
			byIndex[id][0] = id
			byIndex[id][1] = fromXYZ[0]
			byIndex[id][2] = fromXYZ[1]
			TransCounter[id] = 8
			fadeout[id] = 90
			FXRed[id] = 250
			FXGreen[id] = 250
			FXBlue[id] = 250
			set_task(0.2,"energize_FX",1701,args,11,"a", 35)
			set_task(0.8,"transwarp_drive",1701+id,args,11,"a",7)
			get_user_authid(id,authid,15)
			log_message("[AMX][Transporter] Transport Initiated for %s",authid)
			if(get_cvar_num("amx_scotty_usepak"))
				emit_sound(id,CHAN_STATIC, "weapons/egon_windup2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
			else{
				playsound(id, "misc/transporter_scottybeammeup.wav")
//				emit_sound(id,CHAN_ITEM, "misc/transporter2_v1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
			}
		}
		return PLUGIN_HANDLED
	}

	if (equali(Data, "where am i s",12)){
		if(setup_error == true){
			client_print(id,print_chat,"[AMX] <scotty> Your server owner did not read the instructions when he")
			client_print(id,print_chat,"[AMX] set up this plugin. Tell him to check error log in .. addons/amx")
			return PLUGIN_HANDLED
		}
		if (!equal(mode,"insane")){
 			client_print(id, print_chat, "<Scotty>  The ship's scanners are not picking you up, captain.")
 			client_print(id, print_chat, "        Try 'scotty lock onto my coordinates'.")
			return PLUGIN_HANDLED
		}
		client_print(0,print_chat,"%s :   where am i scotty", User)
		get_user_origin(id, wxyz)
		client_print(id,print_chat, "<Scotty>  Captain, you are at coordinates %d %d %d", wxyz[0], wxyz[1], wxyz[2])
		playsound(id, "misc/transporter_lock.wav")
		return PLUGIN_HANDLED
	}

	if (equali(cmd,"scotty",6)) {
		if(setup_error == true){
			client_print(id,print_chat,"[AMX] <scotty> Your server owner did not read the instructions when he")
			client_print(id,print_chat,"[AMX] set up this plugin. Tell him to check error log in .. addons/amx")
			return PLUGIN_HANDLED
		}
		if(!((equal(mode,"crazy")) || (equal(mode,"insane"))) ){
 			client_print(id,print_chat, "<Scotty> The ship's scanners are not picking you up, captain,")
 			client_print(id,print_chat, "       the transporter is not fully enabled.    Say: vote_scotty")
			playsound(id, "misc/transporter_outagain.wav")
			return PLUGIN_HANDLED
		}
		if((extra_spawn_protect == 1) && (round_start == 1)){
			client_print(id,print_chat, "<Scotty>  It will be a little longer captain, the warp drive is malfunctioning.")		
			return PLUGIN_HANDLED
		}
		if(IsVip[id] == 1){
			client_print(id,print_chat, "<Scotty>  I cant beam you up captain, you are the VIP.")
			return PLUGIN_HANDLED			
		}
		if (equali(strX, "l",1)){
			if (!equal(mode,"insane")){
				if (is_user_alive(id) == 0){
					client_print(id,print_chat, "<Scotty>  How can I lock on to you captain? You are dead.")
					return PLUGIN_HANDLED
				}
			}
			get_user_origin(id, wxyz)
			if (equal(strY, "2",1)){
				WhereAmI[id][3]=wxyz[0]
				WhereAmI[id][4]=wxyz[1]
				WhereAmI[id][5]=wxyz[2]
				client_print(0,print_chat, "%s :  scotty lock 2 onto my coordinates", User)			
			}
			if (equal(strY, "3",1)){		
				WhereAmI[id][6]=wxyz[0]
				WhereAmI[id][7]=wxyz[1]
				WhereAmI[id][8]=wxyz[2]
				client_print(0,print_chat, "%s :  scotty lock 3 onto my coordinates", User)			
			}
			if ( (!equal(strY, "2",1)) && (!equal(strY, "3",1)) ){
				WhereAmI[id][0]=wxyz[0]
				WhereAmI[id][1]=wxyz[1]
				WhereAmI[id][2]=wxyz[2]
				client_print(0,print_chat, "%s :  scotty lock onto my coordinates", User)			
			}
			client_print(id,print_chat, "<Scotty>  Coordinates acknowledged captain.")
			new rand = random(2)
			switch(rand){
				case 0: playsound(id, "misc\transporter_lock.wav")
				case 1: playsound(id, "misc\transporter_lock2.wav")
			}
			return PLUGIN_HANDLED
		}

		if((extra_spawn_protect == 1) && (round_start == 1)){
			playsound(id, "misc/transporter_barely.wav")
			client_print(id,print_chat, "<Scotty>  It will be a little longer captain, the warp drive is malfunctioning.")		
			return PLUGIN_HANDLED
		}

		if (get_gametime() - TRANSPORTER_DELAY_L < (LastBeamUpTime[id]) ){
			client_print(id,print_chat, "<Scotty>  Give someone else a chance, captain.")
			playsound(id, "misc/tranpsorter_gamble.wav")
			return PLUGIN_HANDLED
		}
		if (is_user_alive(id) == 0){
			client_print(id,print_chat, "<Scotty>  You are dead, why should I transport you?")
			return PLUGIN_HANDLED
		}else{
			new deny
			if(mb_mode == 0){
				new maxplayers = get_maxplayers()+1
				for (new i=1; i<=maxplayers; i++) {				
					if(is_user_alive(i)){			
						if(isBeaming[i] == 1){
							deny = 1
						}			
					}
				}
			}
			else if(mb_mode == 1){
				if (isBeamingT[UserTeam] == 1){
					client_print(id,print_chat, "<Scotty>  She cant handle more than one at a time captain!")
					playsound(id, "misc/transporter_scottypower.wav")
					return PLUGIN_HANDLED
				}
			}
			if(deny){
				client_print(id,print_chat, "<Scotty>  She cant handle more than one at a time captain!")
				playsound(id, "misc/transporter_scottypower.wav")
				return PLUGIN_HANDLED	
			}
			if(isBeaming[id] == 1){
				client_print(id,print_chat, "<Scotty>  You are already in a beamup cycle!")					
				return PLUGIN_HANDLED	
			}
			ScottyMsg = 0
			if(bOverride == true)
				args[1] = 1
			if ( (equali(strX, "b",1)) && (equali(strZ, "t",1)) && (equali(SpecLoc, "my",2)) ) {
				if(LastTranspMem[UserTeam][0] == 0){
					args[1] = 1
				}
				args[8] = LastTranspMem[UserTeam][0]
				args[9] = LastTranspMem[UserTeam][1]
				args[10] = LastTranspMem[UserTeam][2]
				bSkipEnergize = true
				format(Text, 128, "%s :  scotty beam me to my teamate's last beam coordinates", User)			
			}
			else if ( (equali(strX, "b",1)) && (equali(strZ, "t",1)) && (bSkipEnergize == false) ){
				toTargetIndex = find_player("b",SpecLoc)
				if(!toTargetIndex){
					client_print(id,print_chat, "<scotty>  The ship's scanners cant find that player, captain.")
					return PLUGIN_HANDLED
				}else{
					get_user_name(toTargetIndex, T_Name,31)
					new iTeamT
					if(dod_running)
						iTeamT = dod_team[toTargetIndex]
					else
						iTeamT = get_user_team(toTargetIndex)					
					if(iTeamT != UserTeam){
						client_print(id, print_chat, "<Mr. Spock>  Captain, it would be a breach of Star Fleet regulations to beam there.")
						return PLUGIN_HANDLED
					}
					if(equal(lock, "1", 1)){
						if(WhereAmI[toTargetIndex][2] == 0){
							client_print(id, print_chat, "<Scotty>  No coordinates found in this player's lock coordinant set.")
							return PLUGIN_HANDLED
						}
						args[3] = 1
						bSkipEnergize = true
						args[8] = WhereAmI[toTargetIndex][0]
						args[9] = WhereAmI[toTargetIndex][1]
						args[10] = WhereAmI[toTargetIndex][2]
					}
					if(equal(lock, "2", 1)){
						if(WhereAmI[toTargetIndex][5] == 0){
							client_print(id, print_chat, "<Scotty>  No coordinates found in this player's lock 2 coordinant set.")
							return PLUGIN_HANDLED
						}
						args[3] = 1
						bSkipEnergize = true
						args[8] = WhereAmI[toTargetIndex][3]
						args[9] = WhereAmI[toTargetIndex][4]
						args[10] = WhereAmI[toTargetIndex][5]
					}
					if(equal(lock, "3", 1)){
						if(WhereAmI[toTargetIndex][8] == 0){
							client_print(id,print_chat, "<Scotty>  No coordinates found in this player's lock 3 coordinant set.")
							return PLUGIN_HANDLED
						}
						bSkipEnergize = true
						args[3] = 1
						args[8] = WhereAmI[toTargetIndex][6]
						args[9] = WhereAmI[toTargetIndex][7]
						args[10] = WhereAmI[toTargetIndex][8]
					}
					if(bSkipEnergize == false){
						if(is_user_alive(toTargetIndex) == 0){
							client_print(id, print_chat, "<Dr. McCoy>  Hes dead Jim.  You cant beam over to him.")
							return PLUGIN_HANDLED
						}
						args[4] = toTargetIndex
						bSkipEnergize = true
						get_user_origin(toTargetIndex,toPlayerXYZ)	
					}
					if(toPlayerXYZ[0]){
						format(Text, 128, "%s :  scotty beam me to %s", User, T_Name)
					}else{
						format(Text, 128, "%s :  scotty beam me to %s's %s stored coordinates", User, SpecLoc, lock)
					}			
				}
			}
			if ((equali(strX, "e",1)) && (bSkipEnergize == false) ) {
				if(equal(strY, "2", 1)){
					if(WhereAmI[id][3] == 0)
						args[1] = 1
					args[8] = WhereAmI[id][3]
					args[9] = WhereAmI[id][4]
					args[10] = WhereAmI[id][5]
					ScottyMsg = 2
				}
				if(equal(strY, "3", 1)){
					if(WhereAmI[id][6] == 0)
						args[1] = 1
					args[8] = WhereAmI[id][6]
					args[9] = WhereAmI[id][7]
					args[10] = WhereAmI[id][8]
					ScottyMsg = 3
				}
				if( (!equal(strY, "2", 1)) && (!equal(strY, "3", 1)) ){
					if(WhereAmI[id][0] == 0)
						args[1] = 1
					args[8] = WhereAmI[id][0]
					args[9] = WhereAmI[id][1]
					args[10] = WhereAmI[id][2]
					ScottyMsg = 1
				}
			}else{
				if ((!equal(mode,"insane")) && (bSkipEnergize == false)) {
					client_print(id,print_chat, "<Scotty>  You cant unless amx_scotty_insane is enabled by admin.")
					return PLUGIN_HANDLED
				}
				if(bSkipEnergize == false){
					if( (equali(strX, "b", 1)) && (equali(strZ, "u", 1)) ) {
						args[1] = 1
						args[2] = 1
					}
					if(equali(strX, "w", 1)){
						client_print(id,print_chat, "<Scotty>  Correct usage is: where am i scotty  --  not: scotty where am i")                  
						return PLUGIN_HANDLED
					}
					if( (strlen(strX)==0) || (strlen(strY)==0) || (strlen(strZ)==0)) {
						client_print(id,print_chat, "<Scotty>  Sorry captain. I need the coordinates -- 'say: scotty X Y Z'")
						return PLUGIN_HANDLED
					}
					format(Text, 128, "%s :  scotty %s %s %s %s", User, strX, strY, strZ, SpecLoc)			
					args[8] = strtonum(strX)
					args[9] = strtonum(strY)
					args[10] = strtonum(strZ)
				}
			}
			if (!equal(mode,"insane")){
				if(round_start == 1){
					if(def_coords == true){
						if(UserTeam == 1){
							if( ! (args[8] - strtonum(strXct) > TRANSP_SPAWN_RANGE || args[8] - strtonum(strXct) < - TRANSP_SPAWN_RANGE || 
							  args[9] - strtonum(strYct) > TRANSP_SPAWN_RANGE || args[9] - strtonum(strYct) < - TRANSP_SPAWN_RANGE ||
							  args[10] - strtonum(strZct) > TRANSP_SPAWN_RANGE || args[10] - strtonum(strZct) < - TRANSP_SPAWN_RANGE) ){
								client_print(id, print_chat, "<Scotty> Sorry Captain, amx_scotty_insane must be on to spawn teleport.")
								return PLUGIN_HANDLED
							}
						}
						if(UserTeam == 2){
							if( ! (args[8] - strtonum(strXt) > TRANSP_SPAWN_RANGE || args[8] - strtonum(strXt) < - TRANSP_SPAWN_RANGE || 
							  args[9] - strtonum(strYt) > TRANSP_SPAWN_RANGE || args[9] - strtonum(strYt) < - TRANSP_SPAWN_RANGE ||
							  args[10] - strtonum(strZt) > TRANSP_SPAWN_RANGE || args[10] - strtonum(strZt) < - TRANSP_SPAWN_RANGE) ){
								client_print(id,print_chat, "<Scotty> Sorry Captain, amx_scotty_insane must be on to spawn teleport.")
								return PLUGIN_HANDLED
							}
						}
					}
				}
			}
			if(ScottyMsg == 1){
				format(Text, 128, "%s :  scotty energize", User)			
			}
			if(ScottyMsg == 2){
				format(Text, 128, "%s :  scotty energize 2 now", User)
			}
			if(ScottyMsg == 3){
				format(Text, 128, "%s :  scotty energize 3 now", User)			
			}
			client_print(0,print_chat,Text)
			playsound(id, "misc/transporter_energize.wav")
			get_user_origin(id, fromXYZ) 
			args[0] = id
			args[5] = fromXYZ[0]
			args[6] = fromXYZ[1]
			args[7] = fromXYZ[2]
			LastBeamUpTime[id] = get_gametime()
			get_user_origin(id,fromXYZ)
			set_user_rendering(id,kRenderFxGlowShell, 150,150,150, kRenderNormal,16) 
			isBeaming[id] = 1
			isBeamingT[UserTeam] = 1
			byIndex[id][0] = id
			byIndex[id][1] = fromXYZ[0]
			byIndex[id][2] = fromXYZ[1]
			TransCounter[id] = 8
			fadeout[id] = 90
			FXRed[id] = 250
			FXGreen[id] = 250
			FXBlue[id] = 250
			set_task(0.2,"energize_FX",1701,args,11,"a", 35)
			set_task(0.8,"transwarp_drive",1701+id,args,11,"a",7)
			get_user_authid(id,authid,15)
			log_message("[AMX][Transporter] Transport Initiated for %s",authid)
			if(get_cvar_num("amx_scotty_usepak"))
				emit_sound(id,CHAN_STATIC, "weapons/egon_windup2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
			else{
				playsound(id, "misc/transporter_energize1.wav")	
//				emit_sound(id,CHAN_ITEM, "misc/transporter2_v1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
			}
		}
		return PLUGIN_HANDLED
	}
	if ( (containi(Data, "scotty") != -1) ||
	 (containi(Data, "transp") != -1) ||
		 (containi(Data, "beam") != -1) ||
		 (containi(Data, "telep") != -1) ||
		 (containi(Data, "energi") != -1) ) {
		if(equal(mode,"insane")){
			playsound(id, "misc/transporter_molecules.wav") 
			client_print(id,print_chat, "<Scotty> Transporter fully functional.  Mode:insane   For help say:  /scotty_help")
			return PLUGIN_CONTINUE
		}
		else if(equal(mode,"crazy")){
			playsound(id, "misc/transporter_molecules.wav") 
			client_print(id,print_chat, "<Scotty> Transporter fully functional.  Mode:crazy   To change, say:  Vote_Scotty   For help say:  /scotty_help")
			return PLUGIN_CONTINUE
		}
		else if(equal(mode,"unlimited")){
			playsound(id, "misc/transporter_operational.wav")  
			client_print(id,print_chat, "<Scotty> Transporter partially functional. Mode:unlimited  To change, say:  Vote_Scotty   For help say /scotty_help")
			return PLUGIN_CONTINUE
		}
		else if(equal(mode,"on")){
			playsound(id, "misc/transporter_barely.wav")  
			client_print(id,print_chat, "<Scotty> Transporter damaged - only 'Beam me up Scotty'  To change, say:  Vote_Scotty   For help say /scotty_help")
			return PLUGIN_CONTINUE
		}else{
			playsound(id, "misc/transporter_out1.wav") 
			client_print(id,print_chat, "<Scotty> Transporter dead.  To change, say:  Vote_Scotty   For help say /scotty_help")
			return PLUGIN_CONTINUE
		}
	}
	return PLUGIN_CONTINUE
}


/*********   The Transporter    ***********************/

public transwarp_drive(args[]){

	new id = args[0]
	new fromXYZ[3]
	fromXYZ[0] = args[5]
	fromXYZ[1] = args[6]
	fromXYZ[2] = args[7]
	new maxplayers = get_maxplayers()+1
	new Team
	if(dod_running)
		Team = dod_team[id] 
	else
		Team = get_user_team(id) 
	new authid[16],authid2[16]
	get_user_authid(id,authid,15)
	new xyz[3]
	new Xoffset, Yoffset
	new TRANSP_SPAWN_RANGE = get_cvar_num("amx_scotty_spawnz")
	new TRANSP_BEAM_WIDTH = get_cvar_num("amx_scotty_beamwidth")
	new mode[16]
	get_cvar_string("amx_startrek_teleportmode",mode,15)

	TransCounter[id] -= 1

	if (TransCounter[id] == 6){
		for (new i=1; i<=maxplayers; i++) {
			if(is_user_alive(i) == 1){
				get_user_origin(i,xyz)
				if(get_distance(fromXYZ,xyz) < TRANSP_BEAM_WIDTH){
					if( (!IsVip[i]) && (!isBeaming[i]) ){
						isBeaming[i] = 1
						byIndex[i][0] = id
						byIndex[i][1] = xyz[0]
						byIndex[i][2] = xyz[1]
						fadeout[i] = 72
						FXRed[i] = 210
						FXGreen[i] = 210
						FXBlue[i] = 210
						if(get_cvar_num("mp_logdetail") == 3){
							get_user_authid(i,authid2,15)
							log_message("[AMX][Transporter] Transporter Picked %s up for %s",authid2,authid)
						}
					}
					StuckCounter[i] = 0
				}
			}
		}
		if(!get_cvar_num("amx_scotty_usepak"))
			emit_sound(id,CHAN_AUTO, "misc/transporter1_v1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
		else
			emit_sound(id,CHAN_ITEM, "weapons/egon_run3.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
	}

	else if (TransCounter[id] == 5){
		for (new i=1; i<=maxplayers; i++) {
			if(byIndex[i][0] == id){
				new suo[3]
				suo[0] = byIndex[i][1]
				suo[1] = byIndex[i][2]
				suo[2] = 3700
				set_user_origin(i,suo)
			}
		}
		if(!get_cvar_num("amx_scotty_usepak"))
			emit_sound(id,CHAN_BODY, "misc/transporter2_v1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
		else
			emit_sound(id,CHAN_ITEM, "weapons/egon_run3.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
	}

	else if (TransCounter[id] == 4){
		if ( ((equal(mode,"crazy")) || (equal(mode,"insane"))) && (args[1] == 0)){
			toXYZ[id][0] = args[8]
			toXYZ[id][1] = args[9]
			toXYZ[id][2] = args[10]
		}else {
			if(args[2] == 1){
				if(Team == 1){
					toXYZ[id][0] = strtonum(strXct)
					toXYZ[id][1] = strtonum(strYct)
					toXYZ[id][2] = strtonum(strZct)
				}
				if(Team == 2){
					toXYZ[id][0] = strtonum(strXt)
					toXYZ[id][1] = strtonum(strYt)
					toXYZ[id][2] = strtonum(strZt)
				}
			}else{				
				if(Team == 1){
					toXYZ[id][0] = strtonum(strXt)
					toXYZ[id][1] = strtonum(strYt)
					toXYZ[id][2] = strtonum(strZt)
				}
				if(Team == 2){
					toXYZ[id][0] = strtonum(strXct)
					toXYZ[id][1] = strtonum(strYct)
					toXYZ[id][2] = strtonum(strZct)
				}
			}
		}
		if(!get_cvar_num("amx_scotty_usepak"))
			emit_sound(id,CHAN_STATIC, "misc/transporter2_v1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
		else
			emit_sound(id,CHAN_ITEM, "weapons/egon_run3.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
	}
	else if (TransCounter[id] == 3){
		for (new i=1; i<=maxplayers; i++) {
			if(byIndex[i][0] == id){
				fadeout[i] = 0
				FXRed[i] = 250
				FXGreen[i] = 250
				FXBlue[i] = 250
			}
		}
		if(args[1] == 1){
			if(strlen(strZct)==0){
				toXYZ[id][0] = fromXYZ[0]
				toXYZ[id][1] = fromXYZ[1]
				toXYZ[id][2] = fromXYZ[2]
			}
		}
		if(args[4] > 0){
			if(is_user_alive(args[4])){
				get_user_origin(args[4],xyz)
				toXYZ[id][0] = xyz[0]+35
				toXYZ[id][1] = xyz[1]
				toXYZ[id][2] = xyz[2]
			}
		}
		if(!get_cvar_num("amx_scotty_usepak"))
			emit_sound(id,CHAN_ITEM, "misc/transporter2_v1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
		else
			emit_sound(id,CHAN_ITEM, "weapons/egon_run3.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
	}
	else if (TransCounter[id] == 2){
		if(args[3] == 1){
			toXYZ[id][0] = args[8]
			toXYZ[id][1] = args[9]
			toXYZ[id][2] = args[10]
		}
		for (new i=1; i<=maxplayers; i++) {
			if(is_user_alive(i) == 1){
				if(byIndex[i][0] == id){
					Xoffset = byIndex[id][1] - byIndex[i][1]
					Yoffset = byIndex[id][2] - byIndex[i][2]
					new suo[3]
					suo[0] = toXYZ[id][0]-Xoffset
					suo[1] = toXYZ[id][1]-Yoffset
					suo[2] = toXYZ[id][2]
					set_user_origin(i, suo)
					if((extra_spawn_protect == 1) && (round_start == 1)){
						user_kill(i,1)
						client_print(i,print_chat, "[AMX] <Scotty>  Sorry Captain, you beamed right into a force field")		
					}
					if(get_cvar_num("amx_scotty_stucktime")){
						new sta[5]
						sta[0] = i
						sta[1] = toXYZ[id][0] - Xoffset
						sta[2] = toXYZ[id][1] - Yoffset
						sta[3] = toXYZ[id][2]
						set_task(get_cvar_float("amx_scotty_stucktime") / 2.0,"StuckTransCheck",1700,sta,5,"a",1)					
					}
					if ((!equal(mode,"insane")) && (args[1] == 0) ) {
						if(round_start == 1){
							if(Team == 1){
								if( ! (toXYZ[id][0] - strtonum(strXct) > TRANSP_SPAWN_RANGE || toXYZ[id][0] - strtonum(strXct) < - TRANSP_SPAWN_RANGE || 
								  toXYZ[id][1] - strtonum(strYct) > TRANSP_SPAWN_RANGE || toXYZ[id][1] - strtonum(strYct) < - TRANSP_SPAWN_RANGE ||
								  toXYZ[id][2] - strtonum(strZct) > TRANSP_SPAWN_RANGE || toXYZ[id][2] - strtonum(strZct) < - TRANSP_SPAWN_RANGE) ){
									user_kill(i,1)
									client_print(i,print_chat, "[AMX] <Scotty>  Sorry Captain, you beamed right into a force field")
								}
							}
							if(Team == 2){
								if( ! (toXYZ[id][0] - strtonum(strXt) > TRANSP_SPAWN_RANGE || toXYZ[id][0] - strtonum(strXt) < - TRANSP_SPAWN_RANGE || 
								  toXYZ[id][1] - strtonum(strYt) > TRANSP_SPAWN_RANGE || toXYZ[id][1] - strtonum(strYt) < - TRANSP_SPAWN_RANGE ||
								  toXYZ[id][2] - strtonum(strZt) > TRANSP_SPAWN_RANGE || toXYZ[id][2] - strtonum(strZt) < - TRANSP_SPAWN_RANGE) ){
									user_kill(i,1)
									client_print(i,print_chat, "[AMX] <Scotty>  Sorry Captain, you beamed right into a force field")
								}
							}
						}
					}
				}
			}
		}
		if(!get_cvar_num("amx_scotty_usepak"))
			emit_sound(id,CHAN_AUTO, "misc/transporter2_v1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
		else
			emit_sound(id,CHAN_ITEM, "weapons/egon_off1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
	}

	else if (TransCounter[id] == 1){
		if(dod_running)
			Team = dod_team[id]
		else
			Team = get_user_team(id)
		isBeamingT[Team] = 0
		LastTranspMem[Team][0] = toXYZ[id][0]
		LastTranspMem[Team][1] = toXYZ[id][1]
		LastTranspMem[Team][2] = toXYZ[id][2]
		for (new i=1; i<=maxplayers; i++) {
			if(byIndex[i][0] == id){
				set_user_rendering(i,kRenderFxNone,0,0,0, kRenderNormal,16)
				byIndex[i][0] = -1
				isBeaming[i] = 0
				if(get_cvar_num("amx_scotty_usepak"))
					emit_sound(i,CHAN_ITEM, "vox/_period.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
			}
		}
		log_message("[AMX][Transporter] Transport Routine Successful for %s",authid)
	}
	return PLUGIN_CONTINUE
}

public scotty_help(id){
	new scotty_motd[1300]
	new temp[768]
	temp = "Scotty teleport menu system activated in console by:^n\
	          scotty_menu, scotty_pmenu, or say /scotty^n^n\                          
                Complete scotty commands: for more, use scroll bar there ------->^n^n"
	add(scotty_motd,1299,temp)
	temp = "say: beam me up scotty  <--transports you back to your spawn^n^n\                          
                With amx_scotty_crazy mode you can save up to any 3 locations on a map with while alive with the commands below:^n^n\
                say: scotty lock onto my coordinates   <-- saves set 1^n\
                say: scotty lock 2 onto my coordinates <-- saves set 2^n\
                say: scotty lock 3 onto my coordinates <-- saves set 3^n^n"
	add(scotty_motd,1299,temp)
	temp = "To go transport to those saved coordinates -- if it is near round start and the coordinates are close to enemy spawn, transport will be denied:^n^n\
              say: scotty energize        <-- go to set 1^n\
              say: scotty energize 2 now  <-- go to set 2^n\
              say: scotty energize 3 now  <-- go to set 3^n^n\
              To beam to the last place one of your teamates beammed to follow him:^n^n\
              say: scotty beam me to my teamates^n^n"
	add(scotty_motd,1299,temp)
	temp = "To beam to a particular teammate, use his name where it says <player>. You may also beam to that players saved coordinates from that player's 'scotty lock onto my coordinates' command. Very cool.^n^n\
                say: scotty beam me to <player>^n\
                say: scotty beam me to <player> <1, 2, or 3 coordinates>^n^n\
                Actual usage with coordinates:^n^n\
                say: scotty beam me to Ludwig 3^n^n\
                For more teleport info say: /amx_scotty_insane"
	add(scotty_motd,1299,temp)
	show_motd(id,scotty_motd,"Star Trek style teleporting:")
	return PLUGIN_CONTINUE
}

public scotty_help2(id){
	new scotty_motd[1300]
	new temp[768]
	temp = "To gather coordinates while dead amx_scotty_insane has to be enabled and will only last as long as the admin who enabled it stays connected for the reason that things could get out of hand with players transporting off the map and no admin there to take care of them."
	add(scotty_motd,1299,temp)
	temp = "There is a built in protection against players who got stuck transporting off the map or into a wall, but it only works if the player cant move at all. This player will be sent back to base and be buried.^n^n"
	add(scotty_motd,1299,temp)
	temp = "Under amx_scotty_insane, you are permitted to beam to enemy spawn at round start."
	add(scotty_motd,1299,temp)
	temp = "You can say: 'where am i scotty' and the numeric x,y,z coordinates will be given to you. To go to any numeric x,y,z coordinates, say: 'scotty -948 99 704' or whatever set of 3 numbers you want."
	add(scotty_motd,1299,temp)
	temp = "One more insane mode feature is to transport to enemy base by say: 'scotty beam me up', instead of the home base command say: 'beam me up scotty' -- a subtle difference.^n^n"
	add(scotty_motd,1299,temp)
	temp = "say: where am i scotty^n\
              say: scotty -948 99 704^n\
              say: scotty beam me up^n^n\
              Under all scotty modes only one transporting can occur at any given time. But if you huddle together with somenone who is transporting, you go with them to wherever they go.^n^n\
              Say: vote_scotty    -- sets up a vote to enable amx_scotty_crazy^n^n\
              default: disabled unless high admin uses amx_scotty_vote"
	add(scotty_motd,1299,temp)
	show_motd(id,scotty_motd,"More Scotty: amx_scotty_insane")
	return PLUGIN_CONTINUE
}

public show_main_menu(id){
	new menu_body[256]

	if (cstrike_running)
		copy(menu_body,255,"\ySCOTTY Teleport Menu^n\w^n1. Beam me up scotty^n2. Energize to 1^n\
		3. Energize to 2^n4. Energize to 3^n5. Lock coordinates 1^n6. Lock coordinates 2^n\
		7. Lock coordinates 3^n8. Beam me to my teammates^n9. More ...^n^n0. Exit")
	else
		copy(menu_body,255,"SCOTTY Teleport Menu^n^n1. Beam me up scotty^n2. Energize to 1^n3. Energize to 2^n\
		4. Energize to 3^n5. Lock coordinates 1^n6. Lock coordinates 2^n7. Lock coordinates 3^n8. Beam me to my teammates^n9. More ...^n^n0. Exit")
	
	new a1, a2, a3, a4, a5, a6, a7, a8, a9, keys = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)
	a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = a9 = (cstrike_running ? 'd' : '#' )
	user_position[id] = 0
	format(menu_body,255,menu_body,a1,a2,a3,a4,a5,a6,a7,a8,a9)
	show_menu(id,keys,menu_body)
	return PLUGIN_HANDLED
}

public action_main_menu(id,key){
	switch(key){
		case 0: client_cmd(id,"say beam me up scotty")
		case 1: client_cmd(id,"say scotty e")  
		case 2: client_cmd(id,"say scotty e 2")  
		case 3: client_cmd(id,"say scotty e 3")  
		case 4: client_cmd(id,"say scotty l")
		case 5: client_cmd(id,"say scotty l 2")  
		case 6: client_cmd(id,"say scotty l 3")      
		case 7: client_cmd(id,"say scotty b m t my")  
		case 8: {
			show_ppl_menu(id,0)
		}
	}
	return PLUGIN_HANDLED
}

show_ppl_menu(id,position){

	new menu_body[512]
	new inum, start = position * 7
	new team[32]

	if (cstrike_running){	
		copy(menu_body,511,"\yScotty beam me to:\R%d/%d^n\w^n")
		get_user_team(id,team,31)
		if(equal(team,"T",1)) 
			get_players(user_players[id],inum,"ae","TERRORIST")
		else
			get_players(user_players[id],inum,"ae","CT")
	}else{
		format(menu_body,511,"%-20s%%d/%%d^n^n","Scotty beam me to:")
		get_players(user_players[id],inum)
	}
	if (start >= inum) start = position = user_position[id] = 0
	new mbpos = 0
	mbpos=format(menu_body,511,menu_body,position + 1,((inum/7)+((inum%7)?1:0)))
	new temp[64], name[32], end = start + 7
	if (end > inum) end = inum
	new pos = 0, keys = (1<<9)|(1<<7), status[6]
	for(new a = start; a < end; ++a){
		get_user_name(user_players[id][a],name,31)
		num_to_str(pos + 1,status,3)
		keys |= (1<<pos)
		if (cstrike_running)
			format(temp,63,"%s. %s^n\w",status,name)
		else
			format(temp,63,"%s. %s^n",status,name)		
		mbpos+=copy(menu_body[mbpos],511-mbpos,temp)
		pos++
	}
	if(ppl_name_dat[user_options[id][user_select[id]]][0])
		format(temp,63,"^n8. %s^n",ppl_name_dat[user_options[id][user_select[id]]])
	else
		format(temp,63,"^n %s^n",ppl_name_dat[user_options[id][user_select[id]]])
	mbpos+=copy(menu_body[mbpos],511-mbpos,temp)
	if (end != inum){
		mbpos+=copy(menu_body[mbpos],511-mbpos,"^n9. More...^n0. Exit")
		keys |= (1<<8)
	}
	else {
		mbpos+=copy(menu_body[mbpos],511-mbpos,"^n0. Exit")
	}
	show_menu(id,keys,menu_body)
	return PLUGIN_HANDLED
}

public action_ppl_menu(id,key){
	if (key==7) {
		++user_select[id]
		user_select[id] %= user_select_max[id]
		show_ppl_menu(id,user_position[id])
	}
	else if (key==8){
		show_ppl_menu(id,++user_position[id])
	}
	else if (key==9){
		if (--user_position[id] < 0)
			return PLUGIN_HANDLED
		else
			show_ppl_menu(id,user_position[id])
	}
	else {
		new optionm = user_position[id] * 7 + key
		new index = user_players[id][optionm]
		new ctype = ppl_misc_dat[user_options[id][user_select[id]]][1]
		if (is_user_connected(index)) {
			new command[64], name[32]
			get_user_name(index,name,31)
			format(command,63,"say scotty beam me to %s",name)			
			client_cmd(id,command)
			return PLUGIN_HANDLED
		}
		if (ctype & 8)
			show_main_menu(id)
		else if (!(ctype & 16))	
			show_ppl_menu(id,user_position[id])
	}
	return PLUGIN_HANDLED
}

public show_ppl_menu2(id){
	user_position[id] = 0
	show_ppl_menu(id,0)
	return PLUGIN_HANDLED
}	

public ejl_vault(rw[],key[],value[]){
	new data[192]
	new stxtsize = 0
	new line = 0 
	new skip = 0
	new vkey[64]
	new vvalue[128]
	new vaultwrite[192]
	if(equal(rw,"READ")){
		if(file_exists("addons/amx/ejl_vault.ini") == 1){
			copy(vault_value,128,"")
			while((line=read_file("addons/amx/ejl_vault.ini",line,data,192,stxtsize))!=0){
				parse(data,vkey,64,vvalue,128)
				if(equal(vkey,key)){
					copy(vault_value,128,vvalue)
				}
			}
		}else{
			write_file("addons/amx/ejl_vault.ini", "**** Plugins use to store values -- immune to crashes and map changes ****", 0)
		}
	}
	else if(equal(rw,"WRITE")){
		if(file_exists("addons/amx/ejl_vault.ini") == 1){		
			format(vaultwrite,192,"%s %s",key,value)
			while((line=read_file("addons/amx/ejl_vault.ini",line,data,192,stxtsize))!=0){
				parse(data,vkey,64,vvalue,128)
				if(skip == 0){
					if( (equal(data,"")) || (equal(vkey,key)) ){
						skip = 1
						write_file("addons/amx/ejl_vault.ini",vaultwrite,line-1)
					}
				}
				else if(equal(vkey,key)){
					write_file("addons/amx/ejl_vault.ini","",line-1)
				}
			}
			if(skip == 0){
				write_file("addons/amx/ejl_vault.ini",vaultwrite,-1)
			}
		}
	}
	return PLUGIN_CONTINUE
}
Now my guess is that this block below is the dot effect going on
Code:
public energize_FX(sid[]){
	new id = sid[0]
	if(TransCounter[id] > 1){
		new maxplayers = get_maxplayers()
		for (new i=1; i<=maxplayers; i++) {
			if(is_user_connected(i)){
				if( (TransCounter[id] < 3) && (byIndex[i][0] == id) ){
					fadeout[i] += 15
					FXRed[i] -=20
					FXGreen[i] -=20
					FXBlue[i] -=20
					if( (fadeout[i] < 99) && (FXRed[i] > 0) ){
						set_user_rendering(i,kRenderFxGlowShell, FXRed[i],FXGreen[i],FXBlue[i], kRenderTransAdd,fadeout[i])
					}
				}	
				else if( (TransCounter[id] < 7) && (byIndex[i][0] == id) ){
					fadeout[i] -= 18
					FXRed[i] -=40
					FXGreen[i] -=40
					FXBlue[i] -=40
					if( (fadeout[i] > -1) && (FXRed[i] > 0) ){
						set_user_rendering(i,kRenderFxGlowShell, FXRed[i],FXGreen[i],FXBlue[i],kRenderTransAdd,fadeout[i])
					}
				}
				if(byIndex[i][0] == id){
					new xyz[3]
					get_user_origin(i,xyz)
					te_teleporteffect(xyz)
				}
			}
		}
	}
	return PLUGIN_CONTINUE
}

te_teleporteffect(vec1[3]){
	message_begin( MSG_BROADCAST,SVC_TEMPENTITY) 
	write_byte( 11 )     //  TE_TELEPORT
	write_coord(vec1[0]) 
	write_coord(vec1[1]) 
	write_coord(vec1[2])
	message_end() 
}
Now i have absolutly no idea what it all means thats why im here to learn some stuff about coding i have some backgrounds but this is my first go at AMXX.

So anyone able to tell me what all happens in that last piece of code would be helpfull.And karma is surly rewarded :p if this can help you...hahaha.

Also i aint sure if this makes the dots appear since i alreayd said im a fully beginning newbie being steamed up for AMXX scripting so yeah.


Thanks for all the help info and support or tuts you show me that can give me a good boost in amxx scripting.
__________________

Last edited by sleeperzzz; 07-09-2006 at 19:07.
sleeperzzz is offline
Send a message via AIM to sleeperzzz Send a message via MSN to sleeperzzz Send a message via Yahoo to sleeperzzz Send a message via Skype™ to sleeperzzz
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:58.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode