// New in this version: // 10/26/02 FIXED: Compliant with adminmod 2.50.50 // 8/22/02 FIXED: stuck player routine works now // 8/22/02 FIXED: player to player transport more accurate / tweak spawn // 8/11/02 ADDED: prevention of enemy spawn transporting at round start(CS) // 6/22/02 ADDED: admin_scotty_default // 6/22/02 ADDED: admin_scotty_revoke // 6/20/02 ADDED: admin_scotty and more player transport options // 6/20/02 FIXED: Plugin no longer dies after 42 transports (memory leak). // /*************************************************************************** * plugin_ejl_beammeup.sma release version 2.0 Date: 10/26/2002 * Author: Eric Lidman ejlmozart@hotmail.com * 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 should work with * all Half-Life multiplayer team based mods with upto 4 teams (see * admin_scotty_setbeam to set it up for mods other than Counter-Strike). * * Here are the admins scotty control commands: * * admin_scotty_on --- resets to default, only "beam me up" allowed * admin_scotty_off --- shuts scotty down completely (we dont here) * admin_scotty_unlimited --- lets "beam me up" be used unlimited times * admin_scotty_crazy --- fully functional transporter * admin_scotty_insane --- fully functional transporter * coordinates can be gathered anytime * beaming to enemy spawn (CS) is permitted * even at round start * admin_scotty_default --- sets the current scotty mode as default by * writing it to the vault file and loading * it at map start when plugins are initialized. * Admin ACCESS_RCON is required to set default. * admin_scotty_reset --- if always stuck busy with noone beaming * Admin ACCESS_RCON is required for this too. * (sort of obsolete at this point anyway what * with all the automtic resets built in now) * admin_scotty_override --- forces players to use maps preset coordinates * even if they had their own coordinates locked * admin_scotty_reload <leave blank or put "custom"> * --- reloads a maps default beam me up coordiantes. * If used this way, "admin_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 * "admin_scotty_reload". * admin_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.txt unless the reload command * is used. It can be issued 3 ways. Example: * admin_scotty_setbeam 1 * admin_scotty_setbeam 1 100 * admin_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, in TFC thats Blue. 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. You may notice * that the default coordinates provided in the * transporter_xyz.txt are almost all 100 height * higher than the ground. This was to help prevent * a person from transporting into another. It * seemed to be a problem. Anyway, this command is * useful for setting team beam up points on maps * which are not listed in the transporter_xyz.txt. * In fact, it is essential for those using mods * other than Counter-Strike as I have provided no * default "beam me up scotty" coordinates for other * mods like TFC, DoD, etc. You have to set your own. * They are automatically saved to the * transporter_custom.txt 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. * * admin_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: * admin_scotty <player> to <team> base * admin_scotty <player> to <player2> * admin_scotty <player> to <player2> <lock 1,2 or 3> * admin_scotty <player> <x> <y> <z> * Actual examples of usage: * admin_scotty ludwig to ct base * admin_scotty ludwig to vodka * admin_scotty ludwig to vodka 3 * admin_scotty ludwig 100 100 100 * * admin_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: * admin_scotty_revoke <player> * admin_scotty_revoke <player> <minutes> * Actual examples of usage: * admin_scotty_revoke ludwig * admin_scotty_revoke ludwig 20 * * * For Players: * * Say: vote_scotty -- sets up a vote to enable admin_scotty_crazy * (only works if fun_mode is enabled) * * 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 admin_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 admin_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 admin_scotty_insane, you are permitted to beam * to enemy spawn at round start (CS). * * Also, under admin_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. * * For the mod TFC, if you are carrying a KEY or a FLAG, scotty is not * supposed to let you transport. I tested this on a few maps and it * seems to work properly. Let me know if there are problems. In order * for this particular feature to work, you need to be using the * metamod plugin, LogD. Get it here: http://logd.sourceforge.net/ * Once you get LogD, make sure logging is on and I think logdetail may * need to be set to 3 in your server.cfg. Not sure on that one. * * Installation: * * The transporter_xyz.txt goes in your mod (cstrke) directory. All * the sound (.wav) files go into your ..\sounds\misc directory. * To be more fun, all the clients should have the sounds in their * ..sounds\misc too. You can auto download them to people using the * .res files provided in this package. 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 * remainder of the files should be traeted as you would for any other * plugin. General instructions on installing plugins are in the * adminmod manual under scripting. * * Other intallation notes: * * Sound.inc: If you plan to make changes to the plugin source such * as setting the default scotty mode to off, as some may wish to do, * you must make sure that the sound.inc file is in this folder: * ..\scripting\include -- otherwise you will get errors when you try * to compile it. sound.inc is include in this plugin package. * * Switches: Immedialety below the readme section in the .sma * file are some switches which allow mod specific features as well * as some values that can be adjusted to your liking. You can set * the default mode of the trasporter here using "true" and "false". * In order for a switch change to work, you need to recompile the * plugin. * * Adminmod.cfg: There are a few things that you need to change in * your adminmod.cfg file. Find these cvars listed below and change * their values to what you see here: * * allow_client_exec 1 * sv_allowdownload 1 * file_access_read 1 * file_access_write 1 * admin_fx 1 * * Last notes: If you remember the show, you know that the transporter * was not a 100% reliable piece of equipment. That effect has been * inadvertantly reproduced in this plugin. It just worked out that * way. The tranporter in my plugin relies on those rather flakey * timers that we scripters are given to work with. Dont look at it * as a bug, but as an enhancement which makes it more realistic. * * Acknowledgements: I just want to thank all the coders whose code I * more or less stole to put this thing together. There are so many * little snippets I cant even begin to count them all. Names like, * Sank, Dio, Milkman, and Cavey come immediately to mind. Also, I am * greatful to the guys on the adminmod scripting forums for helping * me with the testing, like leo008 and STUMPER for their suggestions * to make it more TFC and other mod friendly. * * You may want to make known to players what the basic scotty commands * are. I do it right in my motd or on my server connect screen. * *********************************************************************/ #include <core> #include <console> #include <string> #include <admin> #include <adminlib> #include <sound> //////////////////////////////////////////////////////////////////////////// // // Change these switches / values below to whatever you want. // //////////////////////////////////////////////////////////////////////////// // Using the TFC mod extra features? (LogD required) mod_TFC 0=no 1=yes #define mod_TFC 0 // Using the Day Of Defeat mod instead of CS or TFC? mod_dod 0=no 1=yes #define mod_dod 0 // CS spawn teleport control (requires logd)? use_logd 0=no 1=yes // How much time after round start spawn transporing is illegal // How far away from opposite teams spawn is legal for transporting #define use_logd 1 #define ROUND_START_TIME 30 new TRANSP_SPAWN_RANGE = 1600; // Sets the distance the tranporter sound can be heard (default 700) // Sets the area around a player where others can transport with him (60) new TRANSP_AUDIBLE_RANGE = 700; new TRANSP_BEAM_WIDTH = 60; // Sets the timelimit between beamups for a player. (default 900 sec.) #define TRANSPORTER_DELAY 900 #define TRANSPORTER_DELAY_L 25 // Access level of admin required to control transporter #define ACCESS_TRANSPORTER 8192 // Access required to start a vote for transporter "crazy" mode. #define ACCESS_VOTE_SCOTTY 1 // Percentage of votes required to pass a transporter vote. #define SCOTTY_VOTE_RATIO 50 // Creates a log file transporter_output.log when "where am i scotty" is used #define developer 0 ///////////////////////////////////////////////////////////////////////////// // // Dont bother editing blow this point unless you know what you are doing. // Its ok, however, change the messages between quotation marks if you want. // ///////////////////////////////////////////////////////////////////////////// #define ACCESS_CONSOLE 131072 new STRING_VERSION[MAX_DATA_LENGTH] = "2.51"; new bool:bIsBeamUp = false; new LastBeamUpTime[MAX_PLAYERS+1]; new WhereAmI[MAX_PLAYERS][9]; new StuckPlayer[MAX_PLAYERS][6]; new byIndex[MAX_PLAYERS][3]; new LastTranspMem[MAX_PLAYERS][3]; new bool:bDefBeamUp = true; new bool:bRevDefBeamUp = false; new bool:bOverride = false; new bool:bSkipEnergize = false; new bool:bAdminScottyNum = false; new bool:bToTarget = false; new bool:bTransporterEnabled = true; new bool:bTransporterUnlimit = false; new bool:bTransporterCrazy = false; new bool:bTransporterInsane = false; new TheAdmin[MAX_PLAYERS]; new HaveFlagTFC[MAX_PLAYERS][2]; new TransportRightGuy; new toTargetIndex; new TranspInit; new iTransporterTimer; new TransCounter; new ThisMap[MAX_NAME_LENGTH]; new non_cs = 0; new Xoffset, Yoffset; new round_start = 0; new toX = 0; new toY = 0; new toZ = 0; new userX = 0; new userY = 0; new userZ = 0; new fromX = 0; new fromY = 0; new fromZ = 0; 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() { plugin_registerinfo("Beam Me Up Scotty Plugin", "say: beam me up scotty", STRING_VERSION); plugin_registercmd("admin_scotty", "admin_scotty", ACCESS_TRANSPORTER, "admin_scotty <player coordinate_string> : Admin forces a player to beam someplace."); plugin_registercmd("admin_scotty_on", "admin_scotty_on", ACCESS_TRANSPORTER, "admin_scotty_on : Turns on transporter ability."); plugin_registercmd("admin_scotty_off", "admin_scotty_off", ACCESS_TRANSPORTER, "admin_scotty_off : Turns off transporter ability."); plugin_registercmd("admin_scotty_unlimited","admin_scotty_unlmt",ACCESS_TRANSPORTER,"admin_scotty_unlimited : Lets players transport as much as they want."); plugin_registercmd("admin_scotty_crazy", "admin_scotty_crazy", ACCESS_TRANSPORTER, "admin_scotty_crazy : Allows coordinates other than base to be used."); plugin_registercmd("admin_scotty_insane", "admin_scotty_insane", ACCESS_TRANSPORTER, "admin_scotty_insane : Allows further freedom in transporting."); plugin_registercmd("admin_scotty_override", "admin_scotty_ovrd", ACCESS_TRANSPORTER, "admin_scotty_override : Forces players to use maps preset coordinates."); plugin_registercmd("admin_scotty_setbeam", "admin_scot_setbeam", ACCESS_TRANSPORTER, "admin_scotty_setbeam <TeamNumber x y z z_modifier> Sets beam me up coordinates."); plugin_registercmd("admin_scotty_reload", "admin_scotty_reload", ACCESS_TRANSPORTER, "admin_scotty_reload <original | custom> Reloads scotty coordinates from files."); plugin_registercmd("admin_scotty_reset", "admin_scotty_reset", ACCESS_RCON, "admin_scotty_reset : Used to un-jam the transporter if stuck."); plugin_registercmd("admin_scotty_revoke", "admin_scotty_revok", ACCESS_TRANSPORTER, "admin_scotty_revoke <player optional_time> : Revokes a player's scotty privilages."); plugin_registercmd("admin_scotty_default", "admin_scotty_deflt", ACCESS_RCON, "admin_scotty_default : Sets the current scotty mode as the default via the vault file."); plugin_registercmd("admin_vote_scotty","admin_vote_scotty",ACCESS_VOTE_SCOTTY,"admin_vote_scotty : Starts a vote to fully enable the transporter."); plugin_registercmd("say", "HandleSay", ACCESS_ALL); plugin_registercmd("say_team", "HandleSay", ACCESS_ALL); #if use_logd==1 plugin_registercmd("scotty_prespawn", "scotty_prespawn", ACCESS_CONSOLE); exec( "logd_reg 61 admin_command scotty_prespawn" ); #endif #if mod_TFC == 1 plugin_registercmd("logd_ejl_beam_flag", "logd_ejl_beam_flag", ACCESS_CONSOLE, ""); exec("logd_reg 60 admin_command logd_ejl_beam_flag"); #endif new VaultData; new scotty_mode; if(get_vaultnumdata("EJL_SCOTTY_MODE", VaultData) != 0){ scotty_mode = VaultData; } else { scotty_mode = 2; set_vaultnumdata("EJL_SCOTTY_MODE", 2); } if(scotty_mode == 1){ bTransporterEnabled = false; bTransporterUnlimit = false; bTransporterCrazy = false; bTransporterInsane = false; } if(scotty_mode == 2){ bTransporterEnabled = true; bTransporterUnlimit = false; bTransporterCrazy = false; bTransporterInsane = false; } if(scotty_mode == 3){ bTransporterEnabled = true; bTransporterUnlimit = true; bTransporterCrazy = false; bTransporterInsane = false; } if(scotty_mode == 4){ bTransporterEnabled = true; bTransporterUnlimit = true; bTransporterCrazy = true; bTransporterInsane = false; } if(scotty_mode == 5){ bTransporterEnabled = true; bTransporterUnlimit = true; bTransporterCrazy = true; bTransporterInsane = true; } set_timer("StuckTransCheck",8,99999); new imap; new sMapCoord[200]; new sMap[30]; new sTeam[10]; new sMapData[200]; currentmap(ThisMap, MAX_NAME_LENGTH); new TotalMaps_t; new x[10]; new y[10]; new z[10]; TotalMaps_t = filesize("transporter_custom.txt", 1); for (imap = 1; imap <= TotalMaps_t; imap++) { readfile("transporter_custom.txt", sMapCoord, imap, 200); strsplit(sMapCoord, " ", sMap, 30, sTeam, 10, x, 10, y, 10, z, 10); if (streq(sMap, ThisMap) == 1) { if(strtonum(sTeam)==1){ strcpy(strXt,x,10); strcpy(strYt,y,10); strcpy(strZt,z,10); } if(strtonum(sTeam)==2){ strcpy(strXct,x,10); strcpy(strYct,y,10); strcpy(strZct,z,10); } if(strtonum(sTeam)==3){ strcpy(strX3,x,10); strcpy(strY3,y,10); strcpy(strZ3,z,10); } if(strtonum(sTeam)==4){ strcpy(strX4,x,10); strcpy(strY4,y,10); strcpy(strZ4,z,10); } } if ((imap < 1) || (imap > 1000)) { break; } } TotalMaps_t = filesize("transporter_xyz.txt", 1); for (imap = 1; imap <= TotalMaps_t; imap++) { readfile("transporter_xyz.txt", sMapCoord, imap, 200); strtok(sMapCoord, " ", sMap, 30); if (streq(sMap, ThisMap) == 1) { strcpy(sMapData, sMapCoord, 200); } if ((imap < 1) || (imap > 1000)) { break; } } if(strlen(sMapData) !=0){ strsplit(sMapData, " ", sMap, 30, strXt, 10, strYt, 10, strZt, 10, strXct, 10, strYct, 10, strZct, 10, strX3, 10, strY3, 10, strZ3, 10, strX4, 10, strY4, 10, strZ4, 10); } return PLUGIN_CONTINUE; } public plugin_connect(HLUserName, HLIP, UserIndex) { if (UserIndex >= 1 && UserIndex <= MAX_PLAYERS){ LastBeamUpTime[UserIndex] = 0; StuckPlayer[UserIndex][5] = 0; StuckPlayer[UserIndex][4] = 0; StuckPlayer[UserIndex][0] = 0; HaveFlagTFC[UserIndex][0] = 0; HaveFlagTFC[UserIndex][1] = 0; } return PLUGIN_CONTINUE; } public plugin_disconnect(HLUserName, UserIndex){ new Text[MAX_TEXT_LENGTH]; new Red = random(256); new Green = random(256); new Blue = random(256); new SessionID; new WONID; new Team; new AUTHID[MAX_AUTHID_LENGTH]; new Dead; if (UserIndex >= 1 && UserIndex <= MAX_PLAYERS){ LastBeamUpTime[UserIndex] = 0; StuckPlayer[UserIndex][5] = 0; StuckPlayer[UserIndex][4] = 0; StuckPlayer[UserIndex][0] = 0; HaveFlagTFC[UserIndex][0] = 0; HaveFlagTFC[UserIndex][1] = 0; if((byIndex[TransportRightGuy][0] == 1) && (TransportRightGuy == UserIndex)){ kill_timer(iTransporterTimer); bIsBeamUp = false; bToTarget = false; new maxplayers = maxplayercount(); new i; new Name[MAX_NAME_LENGTH]; for (i=1; i<=maxplayers; i++) { if( playerinfo(i,Name,MAX_NAME_LENGTH,SessionID,WONID,Team,Dead,AUTHID)!=0){ if(byIndex[i][0] == 1){ glow(Name, 0, 0, 0); slay(Name); } } byIndex[i][0] = 0; if((i > 1000) || (i < -1)){ break; } } log("[Transporter] Transport Routine Aborted by disconnect."); } } if((TheAdmin[UserIndex] == 1) && (bTransporterInsane==true)){ bTransporterInsane = false; TheAdmin[UserIndex] = 0; snprintf(Text, MAX_TEXT_LENGTH, "Scotty: Captain! The transporter has lost some power!"); centersay(Text, 5, Red, Green, Blue); log("[Transporter] Admin who issued insane mode disconnected -- crazy mode engaged"); playsoundall("misc/transporter_molecules.wav"); } return PLUGIN_CONTINUE; } public scotty_prespawn(HLCommand,HLData,HLUserName,UserIndex){ round_start = 1; set_timer("roundstartover", ROUND_START_TIME, 0); return PLUGIN_HANDLED; } public roundstartover() { round_start = 0; } public StuckTransCheck(Timer, Repeat, HLUserName, HLParam){ new Dead; new i; new j; new maxplayers = maxplayercount(); new Name[MAX_NAME_LENGTH]; new SessionID; new WONID; new Team; new AUTHID[MAX_AUTHID_LENGTH]; new x,y,z; new sx,sy,sz; new Text[MAX_TEXT_LENGTH]; for (i=1; i<=maxplayers; i++) { if(systemtime()-35 > StuckPlayer[i][4]){ StuckPlayer[i][0] = 0; StuckPlayer[i][5] = 0; } if( playerinfo(i,Name,MAX_NAME_LENGTH,SessionID,WONID,Team,Dead,AUTHID)!=0){ if(Dead==0) { get_userorigin(Name,x,y,z); if((StuckPlayer[i][0] == 1) && (StuckPlayer[i][1] == x) && (StuckPlayer[i][2] == y) && (StuckPlayer[i][3] == z)){ if(StuckPlayer[i][5] == 1){ if((strlen(strXt)==0) || (strlen(strYt)==0) || (strlen(strZt)==0)|| (strlen(strXct)==0) || (strlen(strYct)==0) || (strlen(strZct)==0)) { messageex(Name,"<Server> The game must go on, you appeared to be stuck, therefore ...", print_chat); slay(Name); }else{ #if mod_dod == 0 execclient(Name, "slot1"); // drop his first weapon execclient(Name, "+attack"); execclient(Name, "-attack"); execclient(Name, "drop"); execclient(Name, "slot2"); // drop his pistol (if any) execclient(Name, "+attack"); execclient(Name, "-attack"); execclient(Name, "drop"); execclient(Name, "slot5"); // drop the bomb (if any) execclient(Name, "+attack"); execclient(Name, "-attack"); execclient(Name, "drop"); for (j=1; j<=20; j++) { slap(Name); } if(Team == 2){ sx = strtonum(strXt); sy = strtonum(strYt); sz = strtonum(strZt); } if(Team == 1){ sx = strtonum(strXct); sy = strtonum(strYct); sz = strtonum(strZct); } teleport(Name, sx, sy, sz -30); snprintf(Text, MAX_TEXT_LENGTH, "%s was stuck and has been sent to enemy base naked.", Name); say(Text); #endif #if mod_dod == 1 if(Team == 2){ sx = strtonum(strXt); sy = strtonum(strYt); sz = strtonum(strZt); } if(Team == 1){ sx = strtonum(strXct); sy = strtonum(strYct); sz = strtonum(strZct); } snprintf(Text, MAX_TEXT_LENGTH, "%s was stuck and has been to enemy base.", Name); say(Text); teleport(Name, sx, sy, sz); #endif } StuckPlayer[i][0] = 0; StuckPlayer[i][5] = 0; }else{ StuckPlayer[i][5] = 1; } } } } } } public admin_scotty_off(HLCommand, HLData, HLUserName, UserIndex){ new Command[MAX_COMMAND_LENGTH]; new User[MAX_NAME_LENGTH]; convert_string(HLCommand,Command,MAX_COMMAND_LENGTH); convert_string(HLUserName,User,MAX_NAME_LENGTH); say_command(User,Command," "); new Text[MAX_TEXT_LENGTH]; new Red = random(256); new Green = random(256); new Blue = random(256); bTransporterEnabled = false; bTransporterUnlimit = false; bTransporterCrazy = false; bTransporterInsane = false; snprintf(Text, MAX_TEXT_LENGTH, "Scotty: She cant take it anymore capatin!^nThe transporter is dead!"); centersay(Text, 5, Red, Green, Blue); playsoundall("misc/transporter_out1.wav"); return PLUGIN_HANDLED; } public admin_scotty_on(HLCommand, HLData, HLUserName, UserIndex){ new Command[MAX_COMMAND_LENGTH]; new User[MAX_NAME_LENGTH]; convert_string(HLCommand,Command,MAX_COMMAND_LENGTH); convert_string(HLUserName,User,MAX_NAME_LENGTH); say_command(User,Command," "); new Text[MAX_TEXT_LENGTH]; new Red = random(256); new Green = random(256); new Blue = random(256); bTransporterEnabled = true; bTransporterUnlimit = false; bTransporterCrazy = false; bTransporterInsane = false; snprintf(Text, MAX_TEXT_LENGTH, "Scotty: Captain, the tranporter is working again!"); centersay(Text, 5, Red, Green, Blue); playsoundall("misc/transporter_barely.wav"); return PLUGIN_HANDLED; } public admin_scotty_unlmt(HLCommand, HLData, HLUserName, UserIndex){ new Command[MAX_COMMAND_LENGTH]; new User[MAX_NAME_LENGTH]; convert_string(HLCommand,Command,MAX_COMMAND_LENGTH); convert_string(HLUserName,User,MAX_NAME_LENGTH); say_command(User,Command," "); new Text[MAX_TEXT_LENGTH]; new Red = random(256); new Green = random(256); new Blue = random(256); bTransporterEnabled = true; bTransporterUnlimit = true; bTransporterCrazy = false; bTransporterInsane = false; snprintf(Text, MAX_TEXT_LENGTH, "Scotty: The transporter is recharged!"); centersay(Text, 5, Red, Green, Blue); playsoundall("misc/transporter_operational.wav"); return PLUGIN_HANDLED; } public admin_scotty_crazy(HLCommand, HLData, HLUserName, UserIndex){ new Command[MAX_COMMAND_LENGTH]; new User[MAX_NAME_LENGTH]; convert_string(HLCommand,Command,MAX_COMMAND_LENGTH); convert_string(HLUserName,User,MAX_NAME_LENGTH); say_command(User,Command," "); new Text[MAX_TEXT_LENGTH]; new Red = random(256); new Green = random(256); new Blue = random(256); bTransporterEnabled = true; bTransporterUnlimit = true; bTransporterCrazy = true; bTransporterInsane = false; snprintf(Text, MAX_TEXT_LENGTH, "Scotty: Captain! The transporter is fully functional now!"); centersay(Text, 5, Red, Green, Blue); playsoundall("misc/transporter_molecules.wav"); return PLUGIN_HANDLED; } public admin_scotty_insane(HLCommand, HLData, HLUserName, UserIndex){ new Command[MAX_COMMAND_LENGTH]; new User[MAX_NAME_LENGTH]; convert_string(HLCommand,Command,MAX_COMMAND_LENGTH); convert_string(HLUserName,User,MAX_NAME_LENGTH); say_command(User,Command," "); new Text[MAX_TEXT_LENGTH]; new Red = random(256); new Green = random(256); new Blue = random(256); bTransporterEnabled = true; bTransporterUnlimit = true; bTransporterCrazy = true; bTransporterInsane = true; new maxplayers = maxplayercount(); new i; for (i=1; i<=maxplayers; i++) { TheAdmin[i] = 0; if((i > 1000) || (i < -1)){ break; } } TheAdmin[UserIndex] = 1; snprintf(Text, MAX_TEXT_LENGTH, "Scotty: Captain! The transporter is overloading!"); centersay(Text, 5, Red, Green, Blue); playsoundall("misc/tranpsorter_gamble.wav"); return PLUGIN_HANDLED; } public admin_scotty_deflt(HLCommand, HLData, HLUserName, UserIndex){ new Command[MAX_COMMAND_LENGTH]; new User[MAX_NAME_LENGTH]; new Data[MAX_DATA_LENGTH]; convert_string(HLData,Data,MAX_DATA_LENGTH); convert_string(HLCommand,Command,MAX_COMMAND_LENGTH); convert_string(HLUserName,User,MAX_NAME_LENGTH); log_command(User,Command,Data); if(bTransporterInsane == true){ set_vaultnumdata("EJL_SCOTTY_MODE", 5); selfmessage("The current scotty mode, 'admin_scotty_insane', has been set as the default."); return PLUGIN_HANDLED; } if(bTransporterCrazy == true){ set_vaultnumdata("EJL_SCOTTY_MODE", 4); selfmessage("The current scotty mode, 'admin_scotty_crazy', has been set as the default."); return PLUGIN_HANDLED; } if(bTransporterUnlimit == true){ set_vaultnumdata("EJL_SCOTTY_MODE", 3); selfmessage("The current scotty mode, 'admin_scotty_unlimited', has been set as the default."); return PLUGIN_HANDLED; } if(bTransporterEnabled == true){ set_vaultnumdata("EJL_SCOTTY_MODE", 2); selfmessage("The current scotty mode, 'admin_scotty_on', has been set as the default."); }else{ set_vaultnumdata("EJL_SCOTTY_MODE", 1); selfmessage("The current scotty mode, 'admin_scotty_off', has been set as the default."); } return PLUGIN_HANDLED; } public admin_scotty_ovrd(HLCommand, HLData, HLUserName, UserIndex){ new Command[MAX_COMMAND_LENGTH]; new User[MAX_NAME_LENGTH]; convert_string(HLCommand,Command,MAX_COMMAND_LENGTH); convert_string(HLUserName,User,MAX_NAME_LENGTH); log_command(User,Command," "); if(bOverride == true){ bOverride = false; selfmessage("Override is -- OFF"); }else{ bOverride = true; selfmessage("Override is -- ON"); } return PLUGIN_HANDLED; } public admin_scot_setbeam(HLCommand, HLData, HLUserName, UserIndex){ new Command[MAX_COMMAND_LENGTH]; new User[MAX_NAME_LENGTH]; new Data[MAX_DATA_LENGTH]; new x[10]; new y[10]; new z[10]; new ix,iy,iz; new modz[10]; new sTeam[10]; new Text[MAX_TEXT_LENGTH]; convert_string(HLCommand,Command,MAX_COMMAND_LENGTH); convert_string(HLUserName,User,MAX_NAME_LENGTH); convert_string(HLData,Data,MAX_DATA_LENGTH); log_command(User,Command,Data); strinit(x); strinit(y); strinit(z); strinit(modz); strsplit(Data, " ", sTeam, 10, x, 10, y, 10, z, 10, modz, 10); iz = strtonum(z); if(strtonum(y) == 0){ get_userorigin(User, ix, iy, iz); iz += strtonum(x); numtostr(ix,x); numtostr(iy,y); }else{ iz += strtonum(modz); } numtostr(iz,z); if(strtonum(sTeam)==1){ strcpy(strXt,x,10); strcpy(strYt,y,10); strcpy(strZt,z,10); } if(strtonum(sTeam)==2){ strcpy(strXct,x,10); strcpy(strYct,y,10); strcpy(strZct,z,10); } if(strtonum(sTeam)==3){ strcpy(strX3,x,10); strcpy(strY3,y,10); strcpy(strZ3,z,10); } if(strtonum(sTeam)==4){ strcpy(strX4,x,10); strcpy(strY4,y,10); strcpy(strZ4,z,10); } if((strtonum(sTeam) > 4) || (strtonum(sTeam) < 1)){ selfmessage("You need to chose a team 1-4"); return PLUGIN_HANDLED; } snprintf(Text, MAX_TEXT_LENGTH, "Beamup Coordinates for team %s have been set to %s %s %s", sTeam, x, y, z); selfmessage(Text); snprintf(Text, MAX_TEXT_LENGTH, "%s %s %s %s %s", ThisMap, sTeam, x, y, z); writefile("transporter_custom.txt", Text); return PLUGIN_HANDLED; } public admin_scotty_reload(HLCommand, HLData, HLUserName, UserIndex){ new imap; new sMapCoord[200]; new sMap[30]; new sTeam[10]; new sMapData[200]; currentmap(ThisMap, MAX_NAME_LENGTH); new TotalMaps_t; new x[10]; new y[10]; new z[10]; new Data[MAX_DATA_LENGTH]; convert_string(HLData,Data,MAX_DATA_LENGTH); if(strmatch(Data, "c", 1) == 1){ TotalMaps_t = filesize("transporter_custom.txt", 1); for (imap = 1; imap <= TotalMaps_t; imap++) { readfile("transporter_custom.txt", sMapCoord, imap, 200); strsplit(sMapCoord, " ", sMap, 30, sTeam, 10, x, 10, y, 10, z, 10); if (streq(sMap, ThisMap) == 1) { if(strtonum(sTeam)==1){ strcpy(strXt,x,10); strcpy(strYt,y,10); strcpy(strZt,z,10); } if(strtonum(sTeam)==2){ strcpy(strXct,x,10); strcpy(strYct,y,10); strcpy(strZct,z,10); } if(strtonum(sTeam)==3){ strcpy(strX3,x,10); strcpy(strY3,y,10); strcpy(strZ3,z,10); } if(strtonum(sTeam)==4){ strcpy(strX4,x,10); strcpy(strY4,y,10); strcpy(strZ4,z,10); } } if ((imap < 1) || (imap > 1000)) { break; } } selfmessage("Custom team beam-up coordinates loaded."); return PLUGIN_HANDLED; } TotalMaps_t = filesize("transporter_xyz.txt", 1); for (imap = 1; imap <= TotalMaps_t; imap++) { readfile("transporter_xyz.txt", sMapCoord, imap, 200); strtok(sMapCoord, " ", sMap, 30); if (streq(sMap, ThisMap) == 1) { strcpy(sMapData, sMapCoord, 200); } if ((imap < 1) || (imap > 1000)) { break; } } strsplit(sMapData, " ", sMap, 30, strXt, 10, strYt, 10, strZt, 10, strXct, 10, strYct, 10, strZct, 10, strX3, 10, strY3, 10, strZ3, 10, strX4, 10, strY4, 10, strZ4, 10); selfmessage("Default team beam-up coordinates loaded."); return PLUGIN_HANDLED; } // This Command can probably be removed now as it is no longer needed public admin_scotty_reset(HLCommand, HLData, HLUserName, UserIndex){ new Command[MAX_COMMAND_LENGTH]; new User[MAX_NAME_LENGTH]; convert_string(HLCommand,Command,MAX_COMMAND_LENGTH); convert_string(HLUserName,User,MAX_NAME_LENGTH); say_command(User,Command," "); new maxplayers = maxplayercount(); new i; for (i=1; i<=maxplayers; i++) { if((i > 1000) || (i < -1)){ break; } LastBeamUpTime[i] = 0; TheAdmin[i] = 0; byIndex[i][0] = 0; 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; StuckPlayer[i][0] = 0; StuckPlayer[i][1] = 0; StuckPlayer[i][2] = 0; StuckPlayer[i][3] = 0; StuckPlayer[i][4] = 0; StuckPlayer[i][5] = 0; } TransportRightGuy = 0; kill_timer(iTransporterTimer); userX = 0; userY = 0; userZ = 0; fromX = 0; fromY = 0; fromZ = 0; bDefBeamUp = true; bToTarget = false; bRevDefBeamUp = false; bIsBeamUp = false; playsoundall("misc/transporter_trynow.wav"); return PLUGIN_HANDLED; } public admin_vote_scotty(HLCommand,HLData,HLUserName,UserIndex) { new Command[MAX_COMMAND_LENGTH]; new Data[MAX_DATA_LENGTH]; new User[MAX_NAME_LENGTH]; if (vote_allowed()!=1) { selfmessage( "Vote not allowed at this time."); return PLUGIN_HANDLED; } convert_string(HLCommand,Command,MAX_COMMAND_LENGTH); convert_string(HLData,Data,MAX_DATA_LENGTH); convert_string(HLUserName,User,MAX_NAME_LENGTH); say_command(User,Command,Data); ScottyVote(); return PLUGIN_HANDLED; } public ScottyVote() { new strDummy[10]; if(vote_allowed()!=1){ selfmessage("Voting not allowed at this time."); return PLUGIN_HANDLED; } if (getvar("admin_fun_mode")==0) { selfmessage("The transporter can only be turned on during fun mode. Tell your admin!"); return PLUGIN_HANDLED; } if (bTransporterInsane == true){ selfmessage("Scotty voting is not allowed when we are locked into admin_scotty_insane mode."); return PLUGIN_HANDLED; } set_vaultnumdata("EJL_VOTES_ONOFF", 1); vote("Scotty: Captain, fully enable the transporter?", "Beam me up Scotty!", "No thanks", "HandleScottyVote",strDummy); return PLUGIN_HANDLED; } public HandleScottyVote(WinningOption,HLData,VoteCount,UserCount) { new Text[MAX_TEXT_LENGTH]; new strNumber[MAX_NUMBER_LENGTH]; new Ratio = SCOTTY_VOTE_RATIO; new strData[MAX_DATA_LENGTH]; convert_string(HLData, strData,MAX_DATA_LENGTH); set_vaultnumdata("EJL_VOTES_ONOFF", 2); if (bTransporterInsane == true){ centersay("Vote has no effect. We are locked into admin_scotty_insane mode.",18,63,187,239); playsoundall("misc/tranpsorter_gamble.wav"); return PLUGIN_CONTINUE; } if (VoteCount >= Ratio*UserCount/100) { if (WinningOption==1) { if(bTransporterCrazy == true) { centersay("Vote over. Scotty will stay.",18,249,244,0); playsoundall("misc/transporter_molecules.wav"); } else { centersay("Vote successful. Beam me up Scotty",18,249,244,0); playsoundall("misc/transporter_scottybeammeup.wav"); bTransporterEnabled = true; bTransporterUnlimit = true; bTransporterCrazy = true; } } else { if(bTransporterCrazy == true) { centersay("Vote over. The transporter is^nnot fully functional anymore.",18,63,187,239); playsoundall("misc/transporter_out1.wav"); bTransporterUnlimit = false; bTransporterCrazy = false; } else { centersay("Vote over. Transporter will stay not fully functional.",18,63,187,239); playsoundall("misc/transporter_outagain.wav"); } } } else { numtostr(Ratio*UserCount/100,strNumber); if(bTransporterCrazy == true) { snprintf(Text, MAX_TEXT_LENGTH, "Not enough votes for change (needed %s)^nThe transporter will stay fully enabled.", strNumber); playsoundall("misc/transporter_scottybeammeup.wav"); } else { snprintf(Text, MAX_TEXT_LENGTH, "Not enough votes for change (needed %s)^nThe transporter will only^ntake you to your base.", strNumber); playsoundall("misc/transporter_barely.wav"); } centersay(Text,18,63,187,239); } return PLUGIN_CONTINUE; } public admin_scotty_revok(HLCommand, HLData, HLUserName, UserIndex){ new Command[MAX_COMMAND_LENGTH]; new User[MAX_NAME_LENGTH]; new Data[MAX_DATA_LENGTH]; new RevokeTimeS; new RevokeTimeM[MAX_NUMBER_LENGTH]; new sPlayer[MAX_NAME_LENGTH]; new TargetIndex; new Name[MAX_NAME_LENGTH]; new Text[MAX_TEXT_LENGTH]; convert_string(HLCommand,Command,MAX_COMMAND_LENGTH); convert_string(HLUserName,User,MAX_NAME_LENGTH); convert_string(HLData,Data,MAX_DATA_LENGTH); strsplit(Data, " ", sPlayer, MAX_NAME_LENGTH, RevokeTimeM, MAX_NUMBER_LENGTH); if(bTransporterEnabled == false){ selfmessage("Scotty has to be enabled for this command to be used."); return PLUGIN_HANDLED; } if (check_user(sPlayer) == 1) { get_username(sPlayer, Name, MAX_NAME_LENGTH); get_userindex(Name,TargetIndex); if( (LastBeamUpTime[TargetIndex] > systemtime() + TRANSPORTER_DELAY) && (bTransporterUnlimit == false)){ LastBeamUpTime[TargetIndex] = 0; snprintf(Text, MAX_TEXT_LENGTH, "%s has restored %s's scotty privilages.", User, Name); say(Text); return PLUGIN_HANDLED; } if( (LastBeamUpTime[TargetIndex] > systemtime() + TRANSPORTER_DELAY_L) && (bTransporterUnlimit == true)){ LastBeamUpTime[TargetIndex] = 0; snprintf(Text, MAX_TEXT_LENGTH, "%s has restored %s's scotty privilages.", User, Name); say(Text); return PLUGIN_HANDLED; } if(strlen(RevokeTimeM) == 0){ LastBeamUpTime[TargetIndex] = systemtime() + 900; snprintf(Text, MAX_TEXT_LENGTH, "%s has revoked %s's scotty privilages for 15 minutes.", User, Name); say(Text); return PLUGIN_HANDLED; } if((strtonum(RevokeTimeM) > 60) || (strtonum(RevokeTimeM) <= 0)){ selfmessage("<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[TargetIndex] = systemtime() + RevokeTimeS; snprintf(Text, MAX_TEXT_LENGTH, "%s has revoked %s's scotty privilages for %s minutes.", User, Name, RevokeTimeM); say(Text); }else{ selfmessage("<Scotty> Player not found."); } return PLUGIN_HANDLED; } public admin_scotty(HLCommand, HLData, HLUserName, UserIndex){ new Command[MAX_COMMAND_LENGTH]; new User[MAX_NAME_LENGTH]; new Data[MAX_DATA_LENGTH]; new x[50]; new y[50]; new z[50]; new i; new maxplayers = maxplayercount(); new tx,ty,tz; new sPlayer[50]; new TransporterGuy[MAX_DATA_LENGTH]; new AUTHID[MAX_AUTHID_LENGTH]; new SessionID; new WONID; new UserTeam, UserDead; new toUserDead; new toName[MAX_NAME_LENGTH]; new TargetIndex; new Name[MAX_NAME_LENGTH]; convert_string(HLCommand,Command,MAX_COMMAND_LENGTH); convert_string(HLUserName,User,MAX_NAME_LENGTH); convert_string(HLData,Data,MAX_DATA_LENGTH); CheckScottysTimer(); if(systemtime() > TranspInit + 8){ if(bIsBeamUp == true){ bDefBeamUp = false; bRevDefBeamUp = false; bIsBeamUp = false; bAdminScottyNum = false; bToTarget = false; LastBeamUpTime[TransportRightGuy] = 0; KillGlow(); } } strsplit(Data, " ", sPlayer, 50, x, 50, y, 50, z, 50); if (check_user(sPlayer) == 1) { get_username(sPlayer, Name, MAX_NAME_LENGTH); get_userindex(Name,TargetIndex); playerinfo(TargetIndex, Name, MAX_NAME_LENGTH, SessionID, WONID, UserTeam, UserDead, AUTHID); if (UserDead != 0){ selfmessage("<Scotty> I cant beam up dead people."); playsound(User, "misc/transporter_scottypower.wav"); return PLUGIN_HANDLED; } else if (UserDead !=1){ if (bIsBeamUp == true){ selfmessage("<Scotty> She cant handle more than one at a time captain!"); playsound(User, "misc/transporter_scottypower.wav"); return PLUGIN_HANDLED; } bDefBeamUp = false; bRevDefBeamUp = false; bAdminScottyNum = false; TransportRightGuy = TargetIndex; if(strmatch(x, "to", 2) == 1){ if(strmatch(z, "b", 1) == 1){ if((strmatch(y, "t", 1) == 1) || (strmatch(y, "1", 1) == 1)) { bSkipEnergize = true; if(UserTeam == 2){ bRevDefBeamUp = true; } } if((strmatch(y, "ct", 2) == 1) || (strmatch(y, "2", 1) == 1)) { bSkipEnergize = true; if(UserTeam == 1){ bRevDefBeamUp = true; } } if(bSkipEnergize == false){ selfmessage("Failure: This feature only works in a 2 team game"); return PLUGIN_HANDLED; } bDefBeamUp = true; } if ((check_user(y) == 1) && (bSkipEnergize == false)) { get_username(y, toName, MAX_NAME_LENGTH); get_userindex(toName,toTargetIndex); if(strmatch(z, "1", 1) == 1){ if(WhereAmI[toTargetIndex][2] == 0){ selfmessage("<Scotty> No coordinates found in this player's lock coordinant set."); return PLUGIN_HANDLED; } bAdminScottyNum = true; bSkipEnergize = true; userX = WhereAmI[toTargetIndex][0]; userY = WhereAmI[toTargetIndex][1]; userZ = WhereAmI[toTargetIndex][2]; } if(strmatch(z, "2", 1) == 1){ if(WhereAmI[toTargetIndex][5] == 0){ selfmessage("<Scotty> No coordinates found in this player's lock 2 coordinant set."); return PLUGIN_HANDLED; } bAdminScottyNum = true; bSkipEnergize = true; userX = WhereAmI[toTargetIndex][3]; userY = WhereAmI[toTargetIndex][4]; userZ = WhereAmI[toTargetIndex][5]; } if(strmatch(z, "3", 1) == 1){ if(WhereAmI[toTargetIndex][8] == 0){ selfmessage("<Scotty> No coordinates found in this player's lock 3 coordinant set."); return PLUGIN_HANDLED; } bSkipEnergize = true; bAdminScottyNum = true; userX = WhereAmI[toTargetIndex][6]; userY = WhereAmI[toTargetIndex][7]; userZ = WhereAmI[toTargetIndex][8]; } if(bSkipEnergize == false){ playerinfo(toTargetIndex, toName, MAX_NAME_LENGTH, SessionID, WONID, UserTeam, toUserDead, AUTHID); if (toUserDead != 0){ selfmessage("<Scotty> I cant beam to someone who doesnt exist anymore."); playsound(User, "misc/transporter_scottypower.wav"); return PLUGIN_HANDLED; } bToTarget = true; /* The following lines are not necessary unless the to-target disconnects */ get_userorigin(toName, tx, ty, tz); bAdminScottyNum = true; userX = tx+40; userY = ty; userZ = tz; /* The preceeding lines are not necessary unless the to-target disconnects */ } }else{ if(bSkipEnergize == false){ selfmessage("<Scotty> Destination player not found."); return PLUGIN_HANDLED; } } }else{ if((strlen(x)==0) || (strlen(y)==0) || (strlen(z)==0)) { selfmessage("<Scotty> I need the coordinates. Command format: admin_scotty player x y z"); return PLUGIN_HANDLED; } bAdminScottyNum = true; userX = strtonum(x); userY = strtonum(y); userZ = strtonum(z); } bSkipEnergize = false; get_userorigin(Name, fromX, fromY, fromZ); strcpy(TransporterGuy, sPlayer, MAX_DATA_LENGTH); glow(Name,250,250,250); bIsBeamUp = true; byIndex[TransportRightGuy][0] = 1; byIndex[TransportRightGuy][1] = fromX; byIndex[TransportRightGuy][2] = fromY; log("[Transporter] Transport Initiated"); LastBeamUpTime[TransportRightGuy] = systemtime(); TranspInit = systemtime(); iTransporterTimer = set_timer("Transporter_Timer", 1, 6, TransporterGuy); for (i=1; i<=maxplayers; i++) { if((i > 1000) || (i < -1)){ break; } if( playerinfo(i,Name,MAX_NAME_LENGTH, SessionID, WONID, UserTeam, UserDead, AUTHID)!=0){ get_userorigin(Name,tx,ty,tz); if( ! (fromX-tx > TRANSP_AUDIBLE_RANGE || fromX-tx < - TRANSP_AUDIBLE_RANGE || fromY-ty > TRANSP_AUDIBLE_RANGE || fromY-ty < - TRANSP_AUDIBLE_RANGE || fromZ-tz > TRANSP_AUDIBLE_RANGE || fromZ-tz < - TRANSP_AUDIBLE_RANGE) ){ playsound(Name, "misc/transporter_energize1.wav"); } } } say_command(User,Command,Data); } }else{ selfmessage("<Scotty> Player not found."); } return PLUGIN_HANDLED; } public HandleSay(HLCommand, HLData, HLUserName, UserIndex){ new Data[MAX_DATA_LENGTH]; new User[MAX_NAME_LENGTH]; new Text[MAX_TEXT_LENGTH]; new SpecLoc[MAX_NAME_LENGTH]; new T_Name[MAX_NAME_LENGTH]; new T_AUTHID[MAX_AUTHID_LENGTH]; new T_SID; new T_Team, T_Dead; new WONID; new toPlayerX, toPlayerY, toPlayerZ; new TransporterGuy[MAX_DATA_LENGTH]; new maxplayers = maxplayercount(); new Name[MAX_NAME_LENGTH]; new ScottyMsg = 0; new i; new x; new y; new z; convert_string(HLData, Data, MAX_DATA_LENGTH); convert_string(HLUserName, User, MAX_NAME_LENGTH); // Remove quotes, if there are any strstripquotes(Data); // if (!strcasecmp(Data, "beam me up scotty")){ // get_userorigin(User, x,y,z); // snprintf(Text, MAX_TEXT_LENGTH, "SP0 %i SP1 %i SP2 %i SP3 %i x %i y %i x %i", StuckPlayer[UserIndex][0], StuckPlayer[UserIndex][1], StuckPlayer[UserIndex][2], StuckPlayer[UserIndex][3], x,y,z); // snprintf(Text, MAX_TEXT_LENGTH, "SP0"); // say(Text); // return PLUGIN_HANDLED; // } if (strcasestr(Data, "vote_scotty")!=-1) { if(vote_allowed()!=1){ messageex(User, "There is a vote in progress, try later.", print_chat); return PLUGIN_HANDLED; } snprintf(Text, MAX_TEXT_LENGTH, "%s : vote_scotty", User); say(Text); playsound(User, "misc/transporter_molecules.wav"); CheckScottysTimer(); ScottyVote(); return PLUGIN_HANDLED; } if (!strcasecmp(Data, "beam me up scotty")){ if (bTransporterEnabled == false){ messageex(User, "<Mr. Spock> The transporter is disabled captain. Say: vote_scotty", print_chat); playsound(User, "misc/transporter_out2.wav"); return PLUGIN_HANDLED; } CheckScottysTimer(); if(systemtime() > TranspInit + 8){ if(bIsBeamUp == true){ bDefBeamUp = false; bRevDefBeamUp = false; bAdminScottyNum = false; bToTarget = false; bIsBeamUp = false; LastBeamUpTime[TransportRightGuy] = 0; KillGlow(); } } if (systemtime() - TRANSPORTER_DELAY_L < (LastBeamUpTime[UserIndex]) ){ messageex(User, "<Scotty> Give someone else a chance, captain.", print_chat); playsound(User, "misc/tranpsorter_gamble.wav"); return PLUGIN_HANDLED; } if (HaveFlagTFC[UserIndex][0]==1){ messageex(User, "<Scotty> You may have the FLAG or KEY, captain, the transporter cant handle that.", print_chat); playsound(User, "misc/tranpsorter_barely.wav"); return PLUGIN_HANDLED; } new SessionID; new AUTHID[MAX_AUTHID_LENGTH]; new UserTeam, UserDead; if (playerinfo(UserIndex, Name, MAX_NAME_LENGTH, SessionID, WONID, UserTeam, UserDead, AUTHID)){ if (UserDead != 0){ messageex(User, "<Scotty> You are dead, why should I transport you?", print_chat); playsound(User, "misc/transporter_scottybeammeup.wav"); return PLUGIN_HANDLED; } else if (UserDead !=1){ if (bIsBeamUp == true){ messageex(User, "<Scotty> She cant handle more than one at a time captain!", print_chat); playsound(User, "misc/transporter_scottypower.wav"); return PLUGIN_HANDLED; } if((bTransporterUnlimit == false) && (bTransporterCrazy == false)){ if (systemtime() - TRANSPORTER_DELAY < (LastBeamUpTime[UserIndex]) ){ messageex(User, "<Scotty> The transporter is not fully recharged yet captain.", print_chat); playsound(User, "misc/tranpsorter_gamble.wav"); return PLUGIN_HANDLED; } } snprintf(Text, MAX_TEXT_LENGTH, "%s : beam me up scotty", User); say(Text); TransportRightGuy = UserIndex; byIndex[TransportRightGuy][0] = 1; glow(User,250,250,250); bIsBeamUp = true; bDefBeamUp = true; bRevDefBeamUp = false; bToTarget = false; get_userorigin(User, fromX, fromY, fromZ); byIndex[TransportRightGuy][1] = fromX; byIndex[TransportRightGuy][2] = fromY; strcpy(TransporterGuy, User, MAX_DATA_LENGTH); log("[Transporter] Transport Initiated"); iTransporterTimer = set_timer("Transporter_Timer", 1, 6, TransporterGuy); LastBeamUpTime[UserIndex] = systemtime(); TranspInit = systemtime(); for (i=1; i<=maxplayers; i++) { if((i > 1000) || (i < -1)){ break; } if( playerinfo(i,Name,MAX_NAME_LENGTH, SessionID, WONID, UserTeam, UserDead, AUTHID)!=0){ get_userorigin(Name,x,y,z); if( ! (fromX-x > TRANSP_AUDIBLE_RANGE || fromX-x < - TRANSP_AUDIBLE_RANGE || fromY-y > TRANSP_AUDIBLE_RANGE || fromY-y < - TRANSP_AUDIBLE_RANGE || fromZ-z > TRANSP_AUDIBLE_RANGE || fromZ-z < - TRANSP_AUDIBLE_RANGE) ){ playsound(Name, "misc/transporter_scottybeammeup.wav"); } } } } } return PLUGIN_HANDLED; } if (!strcasecmp(Data, "where am i scotty")){ if (bTransporterInsane == false){ messageex(User, "<Scotty> The ship's scanners are not picking you up, captain.", print_chat); messageex(User, " Try 'scotty lock onto my coordinates'.", print_chat); return PLUGIN_HANDLED; } snprintf(Text, MAX_TEXT_LENGTH, "%s : where am i scotty", User); say(Text); new wx,wy,wz; get_userorigin(User, wx,wy,wz); snprintf(Text, MAX_TEXT_LENGTH, "<Scotty> Captain, you are at coordinates %i %i %i.", wx, wy, wz); messageex(User, Text, print_chat); playsound(User, "misc/transporter_lock.wav"); #if developer == 1 new text[MAX_DATA_LENGTH]; new FileName[MAX_DATA_LENGTH]; new SessionID; new AUTHID[MAX_AUTHID_LENGTH]; new UserTeam, UserDead; if (playerinfo(UserIndex, Name, MAX_NAME_LENGTH, SessionID, WONID, UserTeam, UserDead, AUTHID)){ snprintf(FileName, MAX_DATA_LENGTH, "transporter_output.log"); snprintf(text, MAX_DATA_LENGTH, "Team: %i Map: %s %i %i %i", UserTeam, ThisMap, wx, wy, wz); writefile(FileName,text); } #endif return PLUGIN_HANDLED; } if (strmatch(Data,"scotty ",7) == 1) { if (bTransporterCrazy == false){ messageex(User, "<Scotty> The ship's scanners are not picking you up, captain,", print_chat); messageex(User, " the transporter is not fully enabled. Say: vote_scotty", print_chat); playsound(User, "misc/transporter_outagain.wav"); return PLUGIN_HANDLED; } CheckScottysTimer(); if(systemtime() > TranspInit + 8){ if(bIsBeamUp == true){ bDefBeamUp = false; bRevDefBeamUp = false; bAdminScottyNum = false; bToTarget = false; bIsBeamUp = false; LastBeamUpTime[TransportRightGuy] = 0; KillGlow(); } } if (HaveFlagTFC[UserIndex][0]==1){ messageex(User, "<Scotty> You may have the FLAG or KEY, captain, the transporter cant handle that.", print_chat); playsound(User, "misc/tranpsorter_barely.wav"); return PLUGIN_HANDLED; } new strX[10], strY[10], strZ[10]; new command[7]; new lock[10]; strsplit(Data, " ", command, 7, strX, 10, strY, 10, strZ, 10, SpecLoc, MAX_NAME_LENGTH, lock, 10); if (strmatch(strX, "l",1) ==1){ if(bTransporterInsane == false){ new SessionID; new AUTHID[MAX_AUTHID_LENGTH]; new UserTeam, UserDead; if (playerinfo(UserIndex, Name, MAX_NAME_LENGTH, SessionID, WONID, UserTeam, UserDead, AUTHID)){ if (UserDead != 0){ messageex(User, "<Scotty> How can I lock on to you captain? You are dead.", print_chat); return PLUGIN_HANDLED; } } } new wx,wy,wz; new iUser; get_userorigin(User, wx,wy,wz); get_userindex(User, iUser); if (strmatch(strY, "2",1) ==1){ WhereAmI[iUser][3]=wx; WhereAmI[iUser][4]=wy; WhereAmI[iUser][5]=wz; snprintf(Text, MAX_TEXT_LENGTH, "%s : scotty lock 2 onto my coordinates", User); say(Text); } if (strmatch(strY, "3",1) ==1){ WhereAmI[iUser][6]=wx; WhereAmI[iUser][7]=wy; WhereAmI[iUser][8]=wz; snprintf(Text, MAX_TEXT_LENGTH, "%s : scotty lock 3 onto my coordinates", User); say(Text); } if ((strmatch(strY, "2",1) !=1) && (strmatch(strY, "3",1) !=1)){ WhereAmI[iUser][0]=wx; WhereAmI[iUser][1]=wy; WhereAmI[iUser][2]=wz; snprintf(Text, MAX_TEXT_LENGTH, "%s : scotty lock onto my coordinates", User); say(Text); } snprintf(Text, MAX_TEXT_LENGTH, "<Scotty> Coordinates acknowledged captain."); messageex(User, Text, print_chat); new rand = random(2); switch(rand){ case 0: playsound(User, "misc\transporter_lock.wav"); case 1: playsound(User, "misc\transporter_lock2.wav"); } return PLUGIN_HANDLED; } if (systemtime() - TRANSPORTER_DELAY_L < (LastBeamUpTime[UserIndex]) ){ messageex(User, "<Scotty> Give someone else a chance, captain.", print_chat); playsound(User, "misc/tranpsorter_gamble.wav"); return PLUGIN_HANDLED; } new SessionID; new AUTHID[MAX_AUTHID_LENGTH]; new UserTeam, UserDead; if (playerinfo(UserIndex, Name, MAX_NAME_LENGTH, SessionID, WONID, UserTeam, UserDead, AUTHID)){ if (UserDead != 0){ messageex(User, "<Scotty> You are dead, why should I transport you?", print_chat); return PLUGIN_HANDLED; } else if (UserDead !=1){ if (bIsBeamUp == true){ messageex(User, "<Scotty> She cant handle more than one at a time captain!", print_chat); playsound(User, "misc/transporter_scottypower.wav"); return PLUGIN_HANDLED; } ScottyMsg = 0; bRevDefBeamUp = false; bAdminScottyNum = false; bToTarget = false; if(bOverride == true){ bDefBeamUp = true; }else{ bDefBeamUp = false; } if ((strmatch(strX, "b",1) == 1) && (strmatch(strZ, "t",1) == 1) && (strmatch(SpecLoc, "my",2) == 1)) { if(LastTranspMem[UserTeam][0] == 0){ bDefBeamUp = true; } userX = LastTranspMem[UserTeam][0]; userY = LastTranspMem[UserTeam][1]; userZ = LastTranspMem[UserTeam][2]; bSkipEnergize = true; snprintf(Text, MAX_TEXT_LENGTH, "%s : scotty beam me to my teamate's last beam coordinates", User); } if ((strmatch(strX, "b",1) == 1) && (strmatch(strZ, "t",1) == 1) && (bSkipEnergize == false)) { if (check_user(SpecLoc)==0) { messageex(User, "<scotty> The ship's scanners cant find that player, captain.", print_chat); return PLUGIN_HANDLED; } get_username(SpecLoc, T_Name, MAX_NAME_LENGTH); get_userindex(T_Name, toTargetIndex); if( playerinfo(toTargetIndex, T_Name, MAX_NAME_LENGTH, T_SID, WONID, T_Team, T_Dead, T_AUTHID) !=0){ if(T_Team != UserTeam){ messageex(User, "<Mr. Spock> Captain, it would be a breach of Star Fleet regulations to beam there.", print_chat); return PLUGIN_HANDLED; } if(strmatch(lock, "1", 1) == 1){ if(WhereAmI[toTargetIndex][2] == 0){ messageex(User, "<Scotty> No coordinates found in this player's lock coordinant set.", print_chat); return PLUGIN_HANDLED; } bAdminScottyNum = true; bSkipEnergize = true; userX = WhereAmI[toTargetIndex][0]; userY = WhereAmI[toTargetIndex][1]; userZ = WhereAmI[toTargetIndex][2]; } if(strmatch(lock, "2", 1) == 1){ if(WhereAmI[toTargetIndex][5] == 0){ messageex(User, "<Scotty> No coordinates found in this player's lock 2 coordinant set.", print_chat); return PLUGIN_HANDLED; } bAdminScottyNum = true; bSkipEnergize = true; userX = WhereAmI[toTargetIndex][3]; userY = WhereAmI[toTargetIndex][4]; userZ = WhereAmI[toTargetIndex][5]; } if(strmatch(lock, "3", 1) == 1){ if(WhereAmI[toTargetIndex][8] == 0){ messageex(User, "<Scotty> No coordinates found in this player's lock 3 coordinant set.", print_chat); return PLUGIN_HANDLED; } bSkipEnergize = true; bAdminScottyNum = true; userX = WhereAmI[toTargetIndex][6]; userY = WhereAmI[toTargetIndex][7]; userZ = WhereAmI[toTargetIndex][8]; } if(bSkipEnergize == false){ if(T_Dead == 1){ messageex(User, "<Dr. McCoy> Hes dead Jim. You cant beam over to him.", print_chat); return PLUGIN_HANDLED; } bToTarget = true; /* The following lines are not necessary unless the to target disconnects */ get_userorigin(T_Name, toPlayerX, toPlayerY, toPlayerZ); userX = toPlayerX; userY = toPlayerY; userZ = toPlayerZ; /* The preceeding lines are not necessary unless the to target disconnects */ bSkipEnergize = true; } if(userY == toPlayerY){ snprintf(Text, MAX_TEXT_LENGTH, "%s : scotty beam me to %s", User, T_Name); }else{ snprintf(Text, MAX_TEXT_LENGTH, "%s : scotty beam me to %s's %s stored coordinates", User, SpecLoc, lock); } } } TransportRightGuy = UserIndex; if ((strmatch(strX, "e",1) == 1) && (bSkipEnergize == false) ) { if(strmatch(strY, "2", 1) == 1){ if(WhereAmI[TransportRightGuy][3] == 0){ bDefBeamUp = true; } userX = WhereAmI[TransportRightGuy][3]; userY = WhereAmI[TransportRightGuy][4]; userZ = WhereAmI[TransportRightGuy][5]; ScottyMsg = 2; } if(strmatch(strY, "3", 1) == 1){ if(WhereAmI[TransportRightGuy][6] == 0){ bDefBeamUp = true; } userX = WhereAmI[TransportRightGuy][6]; userY = WhereAmI[TransportRightGuy][7]; userZ = WhereAmI[TransportRightGuy][8]; ScottyMsg = 3; } if((strmatch(strY, "2", 1) != 1) && (strmatch(strY, "3", 1) != 1)){ if(WhereAmI[TransportRightGuy][0] == 0){ bDefBeamUp = true; } userX = WhereAmI[TransportRightGuy][0]; userY = WhereAmI[TransportRightGuy][1]; userZ = WhereAmI[TransportRightGuy][2]; ScottyMsg = 1; } }else{ if ((bTransporterInsane == false) && (bSkipEnergize == false)) { messageex(User, "<Scotty> You cant unless admin_scotty_insane is enabled by admin.", print_chat); return PLUGIN_HANDLED; } if(bSkipEnergize == false){ if((strmatch(strX, "b", 1) == 1) && (strmatch(strZ, "u", 1) == 1)) { bDefBeamUp = true; bRevDefBeamUp = true; } if(strmatch(strX, "w", 1) == 1){ messageex(User, "<Scotty> Correct usage is: where am i scotty -- not: scotty where am i", print_chat); return PLUGIN_HANDLED; } if((strlen(strX)==0) || (strlen(strY)==0) || (strlen(strZ)==0)) { messageex(User, "<Scotty> Sorry captain. I need the coordinates -- 'say: scotty X Y Z'", print_chat); return PLUGIN_HANDLED; } snprintf(Text, MAX_TEXT_LENGTH, "%s : scotty %s %s %s %s", User, strX, strY, strZ, SpecLoc); userX = strtonum(strX); userY = strtonum(strY); userZ = strtonum(strZ); } } bSkipEnergize = false; if (bTransporterInsane == false) { if(round_start == 1){ if(UserTeam == 1){ if( ! (userX - strtonum(strXct) > TRANSP_SPAWN_RANGE || userX - strtonum(strXct) < - TRANSP_SPAWN_RANGE || userY - strtonum(strYct) > TRANSP_SPAWN_RANGE || userY - strtonum(strYct) < - TRANSP_SPAWN_RANGE || userZ - strtonum(strZct) > TRANSP_SPAWN_RANGE || userZ - strtonum(strZct) < - TRANSP_SPAWN_RANGE) ){ messageex(Name, "<Scotty> Sorry Captain, admin_scotty_insane must be on to spawn teleport.",print_chat); return PLUGIN_HANDLED; } } if(UserTeam == 2){ if( ! (userX - strtonum(strXt) > TRANSP_SPAWN_RANGE || userX - strtonum(strXt) < - TRANSP_SPAWN_RANGE || userY - strtonum(strYt) > TRANSP_SPAWN_RANGE || userY - strtonum(strYt) < - TRANSP_SPAWN_RANGE || userZ - strtonum(strZt) > TRANSP_SPAWN_RANGE || userZ - strtonum(strZt) < - TRANSP_SPAWN_RANGE) ){ messageex(Name, "<Scotty> Sorry Captain, admin_scotty_insane must be on to spawn teleport.",print_chat); return PLUGIN_HANDLED; } } } } if(ScottyMsg == 1){ snprintf(Text, MAX_TEXT_LENGTH, "%s : scotty energize", User); } if(ScottyMsg == 2){ snprintf(Text, MAX_TEXT_LENGTH, "%s : scotty energize 2 now", User); } if(ScottyMsg == 3){ snprintf(Text, MAX_TEXT_LENGTH, "%s : scotty energize 3 now", User); } say(Text); ScottyMsg = 0; get_userorigin(User, fromX, fromY, fromZ); strcpy(TransporterGuy, User, MAX_DATA_LENGTH); glow(User,250,250,250); bIsBeamUp = true; byIndex[TransportRightGuy][0] = 1; byIndex[TransportRightGuy][1] = fromX; byIndex[TransportRightGuy][2] = fromY; log("[Transporter] Transport Initiated"); LastBeamUpTime[UserIndex] = systemtime(); TranspInit = systemtime(); iTransporterTimer = set_timer("Transporter_Timer", 1, 6, TransporterGuy); for (i=1; i<=maxplayers; i++) { if((i > 1000) || (i < -1)){ break; } if( playerinfo(i,Name,MAX_NAME_LENGTH, SessionID, WONID, UserTeam, UserDead, AUTHID)!=0){ get_userorigin(Name,x,y,z); if( ! (fromX-x > TRANSP_AUDIBLE_RANGE || fromX-x < - TRANSP_AUDIBLE_RANGE || fromY-y > TRANSP_AUDIBLE_RANGE || fromY-y < - TRANSP_AUDIBLE_RANGE || fromZ-z > TRANSP_AUDIBLE_RANGE || fromZ-z < - TRANSP_AUDIBLE_RANGE) ){ playsound(Name, "misc/transporter_energize1.wav"); } } } } } return PLUGIN_HANDLED; } CheckScottysTimer(); if ( (strcasestr(Data, "scotty") != -1) || (strcasestr(Data, "transp") != -1) || (strcasestr(Data, "beam") != -1) || (strcasestr(Data, "telep") != -1) || (strcasestr(Data, "energi") != -1) ) { if(bTransporterCrazy == true){ playsound(User, "misc/transporter_molecules.wav"); messageex(User, "<Scotty> Transporter fully functional. Energize! To change, say: Vote_Scotty", print_chat); return PLUGIN_CONTINUE; } if(bTransporterUnlimit == true){ playsound(User, "misc/transporter_operational.wav"); messageex(User, "<Scotty> Transporter partially functional. To change, say: Vote_Scotty", print_chat); return PLUGIN_CONTINUE; } if(bTransporterEnabled == true){ playsound(User, "misc/transporter_barely.wav"); messageex(User, "<Scotty> Transporter damaged - only 'Beam me up Scotty' To change, say: Vote_Scotty", print_chat); return PLUGIN_CONTINUE; }else{ playsound(User, "misc/transporter_out1.wav"); messageex(User, "<Scotty> Transporter dead. To change, say: Vote_Scotty", print_chat); return PLUGIN_CONTINUE; } } return PLUGIN_CONTINUE; } public CheckScottysTimer(){ new TransporterGuy[MAX_DATA_LENGTH]; if(bIsBeamUp == true){ if(systemtime() > (TranspInit + 7) - TransCounter){ kill_timer(iTransporterTimer); iTransporterTimer = set_timer("Transporter_Timer", 1, TransCounter, TransporterGuy); } } } ///***************************************************************************/ /// Here is the Timer Function public Transporter_Timer(Timer, Repeat, HLUserName, TransporterGuy){ new Name[MAX_NAME_LENGTH]; new maxplayers = maxplayercount(); new SessionID; new WONID; new AUTHID[MAX_AUTHID_LENGTH]; new Team; new Dead; new i; new x; new y; new z; TransCounter = Repeat -1; if (Repeat == 6){ for (i=1; i<=maxplayers; i++) { if( playerinfo(i,Name,MAX_NAME_LENGTH, SessionID, WONID, Team, Dead, AUTHID)!=0){ get_userorigin(Name,x,y,z); if( ! (fromX-x > TRANSP_AUDIBLE_RANGE || fromX-x < - TRANSP_AUDIBLE_RANGE || fromY-y > TRANSP_AUDIBLE_RANGE || fromY-y < - TRANSP_AUDIBLE_RANGE || fromZ-z > TRANSP_AUDIBLE_RANGE || fromZ-z < - TRANSP_AUDIBLE_RANGE) ){ playsound(Name, "misc/transporter1_v1.wav"); } if(Dead == 0){ if( ! (fromX-x > TRANSP_BEAM_WIDTH || fromX-x < - TRANSP_BEAM_WIDTH || fromY-y > TRANSP_BEAM_WIDTH || fromY-y < - TRANSP_BEAM_WIDTH || fromZ-z > TRANSP_BEAM_WIDTH || fromZ-z < - TRANSP_BEAM_WIDTH) ){ glow(Name,250,250,250); byIndex[i][0] = 1; byIndex[i][1] = x; byIndex[i][2] = y; } } } } } if (Repeat == 5){ for (i=1; i<=maxplayers; i++) { if( playerinfo(i,Name,MAX_NAME_LENGTH, SessionID, WONID, Team, Dead, AUTHID)!=0){ if(byIndex[i][0] == 1){ teleport(Name, byIndex[i][1], byIndex[i][2] , 3700); playsound(Name, "misc/transporter2_v1.wav"); } get_userorigin(Name,x,y,z); if( ! (fromX-x > TRANSP_AUDIBLE_RANGE || fromX-x < - TRANSP_AUDIBLE_RANGE || fromY-y > TRANSP_AUDIBLE_RANGE || fromY-y < - TRANSP_AUDIBLE_RANGE || fromZ-z > TRANSP_AUDIBLE_RANGE || fromZ-z < - TRANSP_AUDIBLE_RANGE) ){ playsound(Name, "misc/transporter2_v1.wav"); } } } } if (Repeat == 4){ if ((bTransporterCrazy == true) && (bDefBeamUp == false)){ toX = userX; toY = userY; toZ = userZ; }else { if( playerinfo(TransportRightGuy,Name,MAX_NAME_LENGTH,SessionID,WONID,Team,Dead,AUTHID)!=0){ if(bRevDefBeamUp == true){ if(Team == 1){ toX = strtonum(strXct); toY = strtonum(strYct); toZ = strtonum(strZct); non_cs=0; } if(Team == 2){ toX = strtonum(strXt); toY = strtonum(strYt); toZ = strtonum(strZt); non_cs=0; } }else{ if(Team == 1){ toX = strtonum(strXt); toY = strtonum(strYt); toZ = strtonum(strZt); non_cs=0; } if(Team == 2){ toX = strtonum(strXct); toY = strtonum(strYct); toZ = strtonum(strZct); non_cs=0; } if(Team == 3){ toX = strtonum(strX3); toY = strtonum(strY3); toZ = strtonum(strZ3); non_cs=1; } if(Team == 4){ toX = strtonum(strX4); toY = strtonum(strY4); toZ = strtonum(strZ4); non_cs=1; } } } } for (i=1; i<=maxplayers; i++) { if( playerinfo(i,Name,MAX_NAME_LENGTH,SessionID,WONID,Team,Dead,AUTHID)!=0){ if(byIndex[i][0] == 1){ playsound(Name, "misc/transporter2_v1.wav"); } } } } if (Repeat == 3){ if(bDefBeamUp == true){ if(non_cs == 0){ if(strlen(strZct)==0){ toX = fromX; toY = fromY; toZ = fromZ; } }else{ if(strlen(strZ4)==0) { toX = fromX; toY = fromY; toZ = fromZ; } } } for (i=1; i<=maxplayers; i++) { if( playerinfo(i,Name,MAX_NAME_LENGTH, SessionID, WONID, Team, Dead, AUTHID)!=0){ if(byIndex[i][0] == 1){ playsound(Name, "misc/transporter2_v1.wav"); } get_userorigin(Name,x,y,z); if((i == toTargetIndex) && (bToTarget == true)){ bAdminScottyNum = false; toX = x+35; toY = y; toZ = z; } if( ! (userX-x > TRANSP_AUDIBLE_RANGE || userX-x < - TRANSP_AUDIBLE_RANGE || userY-y > TRANSP_AUDIBLE_RANGE || userY-y < - TRANSP_AUDIBLE_RANGE || userZ-z > TRANSP_AUDIBLE_RANGE || userZ-z < - TRANSP_AUDIBLE_RANGE) ){ playsound(Name, "misc/transporter2_v1.wav"); } } } } if (Repeat == 2){ if(bAdminScottyNum == true){ toX = userX; toY = userY; toZ = userZ; } for (i=1; i<=maxplayers; i++) { if( playerinfo(i,Name,MAX_NAME_LENGTH, SessionID, WONID, Team, Dead, AUTHID)!=0){ if(Dead == 0){ if(byIndex[i][0] == 1){ Xoffset = byIndex[TransportRightGuy][1] - byIndex[i][1]; Yoffset = byIndex[TransportRightGuy][2] - byIndex[i][2]; teleport(Name, toX - Xoffset, toY - Yoffset, toZ); StuckPlayer[i][0] = 1; StuckPlayer[i][1] = toX - Xoffset; StuckPlayer[i][2] = toY - Yoffset; StuckPlayer[i][3] = toZ; StuckPlayer[i][4] = systemtime(); playsound(Name, "misc/tranporter2_v1.wav"); if ((bTransporterInsane == false) && (bDefBeamUp == false) ) { if(round_start == 1){ if(Team == 1){ if( ! (toX - strtonum(strXct) > TRANSP_SPAWN_RANGE || toX - strtonum(strXct) < - TRANSP_SPAWN_RANGE || toY - strtonum(strYct) > TRANSP_SPAWN_RANGE || toY - strtonum(strYct) < - TRANSP_SPAWN_RANGE || toZ - strtonum(strZct) > TRANSP_SPAWN_RANGE || toZ - strtonum(strZct) < - TRANSP_SPAWN_RANGE) ){ slay(Name); messageex(Name, "<Scotty> Sorry Captain, you beamed right into a force field",print_chat); } } if(Team == 2){ if( ! (toX - strtonum(strXt) > TRANSP_SPAWN_RANGE || toX - strtonum(strXt) < - TRANSP_SPAWN_RANGE || toY - strtonum(strYt) > TRANSP_SPAWN_RANGE || toY - strtonum(strYt) < - TRANSP_SPAWN_RANGE || toZ - strtonum(strZt) > TRANSP_SPAWN_RANGE || toZ - strtonum(strZt) < - TRANSP_SPAWN_RANGE) ){ slay(Name); messageex(Name, "<Scotty> Sorry Captain, you beamed right into a force field",print_chat); } } } } } } get_userorigin(Name,x,y,z); if( ! (toX-x > TRANSP_AUDIBLE_RANGE || toX-x < - TRANSP_AUDIBLE_RANGE || toY-y > TRANSP_AUDIBLE_RANGE || toY-y < - TRANSP_AUDIBLE_RANGE || toZ-z > TRANSP_AUDIBLE_RANGE || toZ-z < - TRANSP_AUDIBLE_RANGE) ){ playsound(Name, "misc/tranporter2_v1.wav"); } } } } if (Repeat == 1){ if( playerinfo(TransportRightGuy,Name,MAX_NAME_LENGTH,SessionID,WONID,Team,Dead,AUTHID) !=0){ LastTranspMem[Team][0] = toX; LastTranspMem[Team][1] = toY; LastTranspMem[Team][2] = toZ; bAdminScottyNum = false; bToTarget = false; bIsBeamUp = false; TransportRightGuy = 0; for (i=1; i<=maxplayers; i++) { if( playerinfo(i,Name,MAX_NAME_LENGTH, SessionID, WONID, Team, Dead, AUTHID)!=0){ if(byIndex[i][0] == 1){ glow(Name, 0, 0, 0); } } byIndex[i][0] = 0; } log("[Transporter] Transport Routine Successful"); kill_timer(iTransporterTimer); } } } public logd_ejl_beam_flag(HLCommand,HLData,HLUserName,UserIndex){ new sID[MAX_NUMBER_LENGTH]; new ObjectiveTFC[MAX_NAME_LENGTH]; new Data[MAX_DATA_LENGTH]; new SessionID; new Team; new WONID; new AUTHID[MAX_AUTHID_LENGTH]; new Dead; new i; new maxplayers = playercount(); convert_string(HLData, Data, MAX_DATA_LENGTH); strsplit(Data, " ", sID, MAX_NUMBER_LENGTH, ObjectiveTFC, MAX_NAME_LENGTH); if( (strcasestr(ObjectiveTFC, "flag") != -1 ) || (strcasestr(ObjectiveTFC, "goal") != -1 ) || (strcasestr(ObjectiveTFC, "key") != -1 )) { new iID = strtonum(sID); new Name[MAX_NAME_LENGTH]; if( !playerinfo(iID,Name,MAX_NAME_LENGTH, SessionID, WONID, Team, Dead, AUTHID) ) { return PLUGIN_FAILURE; } for (i=1; i<=maxplayers; i++) { if( (HaveFlagTFC[i][0] == 1) && (HaveFlagTFC[i][1] == Team) && (i != iID) ){ HaveFlagTFC[i][0] = 0; HaveFlagTFC[i][1] = 0; } } HaveFlagTFC[iID][0] = 1; HaveFlagTFC[iID][1] = Team; return PLUGIN_CONTINUE; } if((strcasestr(ObjectiveTFC, "spawn") != -1) || (strcasestr(ObjectiveTFC, "drop") != -1) || (strcasestr(ObjectiveTFC, "off") != -1) || (strcasestr(ObjectiveTFC, "hand") != -1) || (strcasestr(ObjectiveTFC, "Capture") != -1) || (strcasestr(ObjectiveTFC, "result") != -1)) { new iID = strtonum(sID); new Name[MAX_NAME_LENGTH]; if( !playerinfo(iID,Name,MAX_NAME_LENGTH, SessionID, WONID, Team, Dead, AUTHID) ) { return PLUGIN_FAILURE; } HaveFlagTFC[iID][0]=0; HaveFlagTFC[iID][1]=0; return PLUGIN_CONTINUE; } return PLUGIN_CONTINUE; } KillGlow() { new i; new iMaxPlayers = maxplayercount(); new Name[MAX_NAME_LENGTH]; new SessionID; new Team; new WONID; new AUTHID[MAX_AUTHID_LENGTH]; new Dead; for (i = 1; i <= iMaxPlayers; i++) { if(playerinfo(i,Name,MAX_NAME_LENGTH,SessionID,WONID,Team,Dead,AUTHID)==1) { glow(Name,0,0,0); } } }