/* This plugin contains various teleporting commands.*/ /* $Id: plugin_move.sma,v 1.0 2001/04/07 yensid Exp $ */ #include <core> #include <console> #include <string> #include <admin> #include <adminlib> #define ACCESS_MOVE 8192 new STRING_VERSION[MAX_DATA_LENGTH] = "2.50.0"; public admin_handleto(HLCommand,HLData,HLUserName,UserIndex) { new Command[MAX_COMMAND_LENGTH]; new Data[MAX_DATA_LENGTH]; new User[MAX_NAME_LENGTH]; new X = 0; new Y = 0; new Z = 0; new Text[MAX_TEXT_LENGTH]; new Target[MAX_NAME_LENGTH]; new Cmd[MAX_DATA_LENGTH]; new iCmd = 0; new TargetName[MAX_NAME_LENGTH]; convert_string(HLCommand,Command,MAX_COMMAND_LENGTH); convert_string(HLData,Data,MAX_DATA_LENGTH); convert_string(HLUserName,User,MAX_NAME_LENGTH); strbreak(Data,Target,Cmd, MAX_DATA_LENGTH); iCmd = strtonum(Cmd); if (strlen(Cmd) == 0){ iCmd = 1; } if (check_user(Target)==0) { selfmessage("Unrecognized player: "); selfmessage(Target); return PLUGIN_HANDLED; } say_command(User,Command,Data); get_username(Target,TargetName,MAX_NAME_LENGTH); if (streq(TargetName, User)==0) { if (check_immunity(TargetName)==1) { snprintf(Text, MAX_TEXT_LENGTH, "Laf. You can't teleport %s, you silly bear.", TargetName); say(Text); return PLUGIN_HANDLED; } } if( get_userorigin(User, X, Y, Z)==1 ) { if (streq(Command, "admin_to_x")==1) { if (iCmd == 0) { X -= 96; } else { X += 96; } } else if (streq(Command, "admin_to_y")==1) { if (iCmd == 0) { Y -= 96; } else { Y += 96; } } else if (streq(Command, "admin_to_z")==1) { if (iCmd == 0) { Z -= 96; } else { Z += 96; } } if(teleport(Target ,X, Y, Z)==1) { snprintf(Text, MAX_TEXT_LENGTH, "Here comes %s!", TargetName); selfmessage(Text); } else { selfmessage("Teleportation Failed."); } } else { selfmessage("Failed Gettin User Origin."); } return PLUGIN_HANDLED; } public admin_handlego(HLCommand,HLData,HLUserName,UserIndex) { new Command[MAX_COMMAND_LENGTH]; new Data[MAX_DATA_LENGTH]; new User[MAX_NAME_LENGTH]; new X = 0; new Y = 0; new Z = 0; new Text[MAX_TEXT_LENGTH]; new Target[MAX_NAME_LENGTH]; new Cmd[MAX_DATA_LENGTH]; new iCmd = 0; new TargetName[MAX_NAME_LENGTH]; convert_string(HLCommand,Command,MAX_COMMAND_LENGTH); convert_string(HLData,Data,MAX_DATA_LENGTH); convert_string(HLUserName,User,MAX_NAME_LENGTH); strbreak(Data,Target,Cmd, MAX_DATA_LENGTH); iCmd = strtonum(Cmd); if (strlen(Cmd) == 0){ iCmd = 1; } if (check_user(Target)==0) { selfmessage("Unrecognized player: "); selfmessage(Target); return PLUGIN_HANDLED; } say_command(User,Command,Data); get_username(Target,TargetName,MAX_NAME_LENGTH); if( get_userorigin(Target, X, Y, Z)==1 ) { if (streq(Command, "admin_go_x")==1) { if (iCmd == 0) { X -= 96; } else { X += 96; } } else if (streq(Command, "admin_go_y")==1) { if (iCmd == 0) { Y -= 96; } else { Y += 96; } } else if (streq(Command, "admin_go_z")==1) { if (iCmd == 0) { Z -= 96; } else { Z += 96; } } if(teleport(User ,X, Y, Z)==1) { snprintf(Text, MAX_TEXT_LENGTH, "Here you go to %s!", TargetName); selfmessage(Text); } else { selfmessage("Teleportation Failed."); } } else { selfmessage("Failed Gettin Target Origin."); } return PLUGIN_HANDLED; } public admin_handlesend(HLCommand,HLData,HLUserName,UserIndex) { new Command[MAX_COMMAND_LENGTH]; new Data[MAX_DATA_LENGTH]; new User[MAX_NAME_LENGTH]; new X = 0; new Y = 0; new Z = 0; new Text[MAX_TEXT_LENGTH]; new Target1[MAX_NAME_LENGTH]; new Target2[MAX_NAME_LENGTH]; new Cmd[MAX_DATA_LENGTH]; new iCmd = 0; new TargetName1[MAX_NAME_LENGTH]; new TargetName2[MAX_NAME_LENGTH]; convert_string(HLCommand,Command,MAX_COMMAND_LENGTH); convert_string(HLData,Data,MAX_DATA_LENGTH); convert_string(HLUserName,User,MAX_NAME_LENGTH); strbreak(Data,Target1,Cmd, MAX_DATA_LENGTH); strbreak(Cmd,Target2,Cmd, MAX_DATA_LENGTH); iCmd = strtonum(Cmd); if (strlen(Cmd) == 0){ iCmd = 1; } if (check_user(Target1)==0) { selfmessage("Unrecognized player: "); selfmessage(Target1); return PLUGIN_HANDLED; } if (check_user(Target2)==0) { selfmessage("Unrecognized player: "); selfmessage(Target2); return PLUGIN_HANDLED; } say_command(User,Command,Data); get_username(Target1,TargetName1,MAX_NAME_LENGTH); get_username(Target2,TargetName2,MAX_NAME_LENGTH); if( get_userorigin(Target2, X, Y, Z)==1 ) { if (streq(Command, "admin_send_x")==1) { if (iCmd == 0) { X -= 96; } else { X += 96; } } else if (streq(Command, "admin_send_y")==1) { if (iCmd == 0) { Y -= 96; } else { Y += 96; } } else if (streq(Command, "admin_send_z")==1) { if (iCmd == 0) { Z -= 96; } else { Z += 96; } } if(teleport(Target1 ,X, Y, Z)==1) { snprintf(Text, MAX_TEXT_LENGTH, "Sending %s to %s!", TargetName1, TargetName2); selfmessage(Text); } else { selfmessage("Teleportation Failed."); } } else { selfmessage("Failed Gettin Target Origin."); } return PLUGIN_HANDLED; } public plugin_init() { plugin_registerinfo("Plugin for teleporting.","Commands for teleporting.",STRING_VERSION); plugin_registercmd("admin_to","admin_handleto",ACCESS_MOVE,"admin_to <target>: Brings target to your cooridnates."); plugin_registercmd("admin_to_x","admin_handleto",ACCESS_MOVE,"admin_to_x <target> <^"0^" | ^"1^">: Brings target next to you, shifted on the X axis. (0) and (1 - default) determine which side."); plugin_registercmd("admin_to_y","admin_handleto",ACCESS_MOVE,"admin_to_y <target> <^"0^" | ^"1^">: Brings target next to you, shifted on the Y axis. (0) and (1 - default) determine which side."); plugin_registercmd("admin_to_z","admin_handleto",ACCESS_MOVE,"admin_to_z <target> <^"0^" | ^"1^">: Brings target below (0) or on top of (1 - default) you."); plugin_registercmd("admin_go","admin_handlego",ACCESS_MOVE,"admin_go <target>: Sends you to target's cooridnates."); plugin_registercmd("admin_go_x","admin_handlego",ACCESS_MOVE,"admin_go_x <target> <^"0^" | ^"1^">: Sends you to target, shifted on the X axis. (0) and (1 - default) determine which side."); plugin_registercmd("admin_go_y","admin_handlego",ACCESS_MOVE,"admin_go_y <target> <^"0^" | ^"1^">: Sends you to target, shifted on the Y axis. (0) and (1 - default) determine which side."); plugin_registercmd("admin_go_z","admin_handlego",ACCESS_MOVE,"admin_go_z <target> <^"0^" | ^"1^">: Sends you below (0) or on top of (1 - default) target."); plugin_registercmd("admin_send","admin_handlesend",ACCESS_MOVE,"admin_send <target1> <target2>: Sends target1 to target2's cooridnates."); plugin_registercmd("admin_send_x","admin_handlesend",ACCESS_MOVE,"admin_send_x <target1> <target2> <^"0^" | ^"1^">: Sends target1 next to target2, shifted on the X axis. (0) and (1 - default) determine which side."); plugin_registercmd("admin_send_y","admin_handlesend",ACCESS_MOVE,"admin_send_y <target1> <target2> <^"0^" | ^"1^">: Sends target1 next to target2, shifted on the Y axis. (0) and (1 - default) determine which side."); plugin_registercmd("admin_send_z","admin_handlesend",ACCESS_MOVE,"admin_send_z <target1> <target2> <^"0^" | ^"1^">: Sends target1 below (0) or on top of (1 - default) target2."); return PLUGIN_CONTINUE; }