/* This plugin is for causing others to glow. * $Id: plugin_glow_CS.sma,v 1.1 2001/05/17 Wraith, and yensid $ */ #include <core> #include <console> #include <string> #include <admin> #include <adminlib> new STRING_VERSION[MAX_DATA_LENGTH] = "2.50.0"; #define ACCESS_FUN 8192 new CS=0; new TFC=0; new GlowOne=0; new GlowTwo=0; new GlowThree=0; new GlowFour=0; new GlowAll=0; ColorCheck(Color[]) { new iGoodColor = 0; new strGrBl[MAX_NAME_LENGTH]; new strRed[MAX_NAME_LENGTH]; new strGreen[MAX_NAME_LENGTH]; new strBlue[MAX_NAME_LENGTH]; new Red; new Green; new Blue; strbreak(Color, strRed, strGrBl, MAX_NAME_LENGTH); if (strlen(strGrBl)!=0) { if (strlen(strRed)<=3) { strbreak(strGrBl, strGreen, strBlue, MAX_NAME_LENGTH); if (strlen(strBlue)!=0) { if ((strlen(strGreen)<=3) && (strlen(strBlue)<=3)) { Red = strtonum(strRed); if ((Red >=0) && (Red <= 255)) { Green = strtonum(strGreen); if ((Green >=0) && (Green <= 255)) { Blue = strtonum(strBlue); if ((Blue >=0) && (Blue <= 255)) { iGoodColor = 1; } } } } } } } else if ( streq(Color,"red")==1) { iGoodColor = 1; } else if ( streq(Color, "r")==1) { iGoodColor = 1; } else if ( streq(Color, "blue")==1) { iGoodColor = 1; } else if ( streq(Color, "b")==1) { iGoodColor = 1; } else if ( streq(Color, "green")==1) { iGoodColor = 1; } else if ( streq(Color, "g")==1) { iGoodColor = 1; } else if ( streq(Color, "white")==1) { iGoodColor = 1; } else if ( streq(Color, "w")==1) { iGoodColor = 1; } else if ( streq(Color, "yellow")==1) { iGoodColor = 1; } else if ( streq(Color, "y")==1) { iGoodColor = 1; } else if ( streq(Color, "purple")==1) { iGoodColor = 1; } else if ( streq(Color, "p")==1) { iGoodColor = 1; } else if ( streq(Color, "cyan")==1) { iGoodColor = 1; } else if ( streq(Color, "c")==1) { iGoodColor = 1; } else if ( streq(Color, "magenta")==1) { iGoodColor = 1; } else if ( streq(Color, "m")==1) { iGoodColor = 1; } else if ( streq(Color, "orange")==1) { iGoodColor = 1; } else if ( streq(Color, "o")==1) { iGoodColor = 1; } else if ( streq(Color, "indigo")==1) { iGoodColor = 1; } else if ( streq(Color, "i")==1) { iGoodColor = 1; } else if ( streq(Color, "random")==1) { iGoodColor = 1; } else if ( streq(Color, "rnd")==1) { iGoodColor = 1; } else if ( streq(Color, "off")==1) { iGoodColor = 1; } return iGoodColor; } GlowHelper(User[], Color[]) { new strGrBl[MAX_NAME_LENGTH]; new strRed[MAX_NAME_LENGTH]; new strGreen[MAX_NAME_LENGTH]; new strBlue[MAX_NAME_LENGTH]; new Red; new Green; new Blue; strbreak(Color, strRed, strGrBl, MAX_NAME_LENGTH); if (strlen(strGrBl)!=0) { strbreak(strGrBl, strGreen, strBlue, MAX_NAME_LENGTH); Red = strtonum(strRed); Green = strtonum(strGreen); Blue = strtonum(strBlue); glow(User,Red,Green,Blue); } else if ((streq(Color,"red")==1)||(streq(Color,"r")==1)) { glow(User,250,10,10); } else if (( streq(Color, "blue")==1)||( streq(Color, "b")==1)) { glow(User,10,10,250); } else if (( streq(Color, "green")==1)||( streq(Color, "g")==1)) { glow(User,10,250,10); } else if (( streq(Color, "white")==1)||( streq(Color, "w")==1)) { glow(User,250,250,250); } else if (( streq(Color, "yellow")==1)||( streq(Color, "y")==1)) { glow(User,250,250,10); } else if (( streq(Color, "purple")==1)||( streq(Color, "p")==1)) { glow(User,250,10,250); } else if (( streq(Color, "cyan")==1)||( streq(Color, "c")==1)) { glow(User,10,250,250); } else if (( streq(Color, "magenta")==1)||( streq(Color, "m")==1)) { glow(User,250,10,125); } else if (( streq(Color, "orange")==1)||( streq(Color, "o")==1)) { glow(User,250,125,10); } else if (( streq(Color, "indigo")==1)||( streq(Color, "i")==1)) { glow(User,125,10,250); } else if (( streq(Color, "random")==1)||( streq(Color, "r")==1)) { Red = random(256); Green = random(256); Blue = random(256); glow(User,Red,Green,Blue); } else if ( streq(Color, "off")==1) { glow(User,0,0,0); } return; } /* This should create or turn off a glowing shell around the target. Will use the appropriate team color * if no color is specified. */ public admin_glowforce(HLCommand,HLData,HLUserName,UserIndex) { new Command[MAX_COMMAND_LENGTH]; new User[MAX_NAME_LENGTH]; new Data[MAX_DATA_LENGTH]; new Color[MAX_NAME_LENGTH]; new Target[MAX_NAME_LENGTH]; new TargetName[MAX_NAME_LENGTH]; new TargetIndex; new Model[MAX_NAME_LENGTH]; new SessionID; new Team; new Dead; new WONID; new Name[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, Color, MAX_NAME_LENGTH); if(check_user(Target)==0) { selfmessage("Unrecognized player: "); selfmessage(Target); return PLUGIN_HANDLED; } get_username(Target, TargetName, MAX_NAME_LENGTH); get_userindex(TargetName, TargetIndex); if (strlen(Color)==0) { if (GlowAll==0) { if (CS==1) { if(playerinfo(TargetIndex,Name,MAX_NAME_LENGTH,SessionID,WONID,Team,Dead)==1) { get_userinfo(Name,"model",Model,MAX_NAME_LENGTH); if (streq(Model, "vip") != 0) { glow(Name,250,250,10); } else if (Team == 1){ glow(Name,250,10,10); } else if (Team == 2) { glow(Name,10,10,250); } } } else { if(playerinfo(TargetIndex,Name,MAX_NAME_LENGTH,SessionID,WONID,Team,Dead)==1) { if (Team == 1){ glow(Name,10,10,250); } else if (Team == 2) { glow(Name,250,10,10); } else if (Team == 3) { glow(Name,10,250,10); } else { glow(Name,250,250,10); } } } } else if (GlowAll == 1 ) { if(playerinfo(TargetIndex,Name,MAX_NAME_LENGTH,SessionID,WONID,Team,Dead)==1) { glow(TargetName,0,0,0); GlowAll=0; if (Team == 1) { GlowOne = 0; } else if (Team == 2) { GlowTwo = 0; } else if (Team == 3) { GlowThree = 0; } else if (Team == 4) { GlowFour = 0; } } } } else if (ColorCheck(Color)==1) { GlowHelper(TargetName,Data); if (streq(Color, "off")==1) { if(playerinfo(TargetIndex,Name,MAX_NAME_LENGTH,SessionID,WONID,Team,Dead)==1) { GlowAll=0; if (Team == 1) { GlowOne = 0; } else if (Team == 2) { GlowTwo = 0; } else if (Team == 3) { GlowThree = 0; } else if (Team == 4) { GlowFour = 0; } } } } else { selfmessage( "Unrecognized color:"); selfmessage(Color); return PLUGIN_HANDLED; } say_command(User,Command,Data); return PLUGIN_HANDLED; } /* This should create or turn off a glowing shell around everyone. Will use the appropriate team color * if no color is specified. */ public admin_glowall(HLCommand,HLData,HLUserName,UserIndex) { new Command[MAX_COMMAND_LENGTH]; new User[MAX_NAME_LENGTH]; new Data[MAX_DATA_LENGTH]; new Model[MAX_NAME_LENGTH]; new SessionID; new Team; new Dead; new WONID; new Name[MAX_NAME_LENGTH]; new iMaxPlayers = maxplayercount(); new i; convert_string(HLCommand,Command,MAX_COMMAND_LENGTH); convert_string(HLData,Data,MAX_DATA_LENGTH); convert_string(HLUserName,User,MAX_NAME_LENGTH); if (strlen(Data)==0) { if (GlowAll==0) { if (CS==1) { for (i = 1; i <= iMaxPlayers; i++) { if(playerinfo(i,Name,MAX_NAME_LENGTH,SessionID,WONID,Team,Dead)==1) { get_userinfo(Name,"model",Model,MAX_NAME_LENGTH); if (streq(Model, "vip") != 0) { glow(Name,250,250,10); } else if (Team == 1){ glow(Name,250,10,10); } else if (Team == 2) { glow(Name,10,10,250); } } } GlowAll=1; GlowOne=1; GlowTwo=1; GlowThree=1; GlowFour=1; } else { for (i = 1; i <= iMaxPlayers; i++) { if(playerinfo(i,Name,MAX_NAME_LENGTH,SessionID,WONID,Team,Dead)==1) { if (Team == 1){ glow(Name,10,10,250); } else if (Team == 2) { glow(Name,250,10,10); } else if (Team == 3) { glow(Name,10,250,10); } else { glow(Name,250,250,10); } } } GlowAll=1; GlowOne=1; GlowTwo=1; GlowThree=1; GlowFour=1; } } else if (GlowAll == 1 ) { for (i = 1; i <= iMaxPlayers; i++) { if(playerinfo(i,Name,MAX_NAME_LENGTH,SessionID,WONID,Team,Dead)==1) { glow(Name,0,0,0); } } GlowAll=0; GlowOne=0; GlowTwo=0; GlowThree=0; GlowFour=0; } } else if (ColorCheck(Data)==1) { for (i = 1; i <= iMaxPlayers; i++) { if(playerinfo(i,Name,MAX_NAME_LENGTH,SessionID,WONID,Team,Dead)==1) { GlowHelper(Name,Data); } } if (streq(Data, "off")==1) { GlowAll=0; GlowOne=0; GlowTwo=0; GlowThree=0; GlowFour=0; } else { GlowAll=1; GlowOne=1; GlowTwo=1; GlowThree=1; GlowFour=1; } } else { selfmessage( "Unrecognized data:"); selfmessage(Data); return PLUGIN_HANDLED; } say_command(User,Command,Data); return PLUGIN_HANDLED; } /* This should create or turn off a glowing shell around everyone on a team with the appropriate team color * if no color is specified. */ public admin_glowteam(HLCommand,HLData,HLUserName,UserIndex) { new Command[MAX_COMMAND_LENGTH]; new Data[MAX_DATA_LENGTH]; new User[MAX_NAME_LENGTH]; new Target[MAX_NAME_LENGTH]; new Color[MAX_NAME_LENGTH]; new Model[MAX_NAME_LENGTH]; new SessionID; new Team; new Dead; new WONID; new Name[MAX_NAME_LENGTH]; new iMaxPlayers = maxplayercount(); new i; new GlowTeam; new GlowOn = 0; convert_string(HLCommand,Command,MAX_COMMAND_LENGTH); convert_string(HLData,Data,MAX_DATA_LENGTH); convert_string(HLUserName,User,MAX_NAME_LENGTH); strbreak(Data, Target, Color, MAX_TEXT_LENGTH); GlowTeam = strtonum(Target); if (GlowTeam == 1) { GlowOn = GlowOne; } else if (GlowTeam == 2) { GlowOn = GlowTwo; } else if (GlowTeam == 3) { GlowOn = GlowThree; } else if (GlowTeam == 4) { GlowOn = GlowFour; } if (strlen(Color)==0) { if (GlowOn == 0) { if (CS==1) { for (i = 1; i <= iMaxPlayers; i++) { if(playerinfo(i,Name,MAX_NAME_LENGTH,SessionID,WONID,Team,Dead)==1) { if (Team == GlowTeam){ get_userinfo(Name,"model",Model,MAX_NAME_LENGTH); if (streq(Model, "vip") != 0) { glow(Name,250,250,10); } else if (Team == 1){ glow(Name,250,10,10); } else if (Team == 2) { glow(Name,10,10,250); } } } } GlowOn=1; } else { for (i = 1; i <= iMaxPlayers; i++) { if(playerinfo(i,Name,MAX_NAME_LENGTH,SessionID,WONID,Team,Dead)==1) { if (Team == GlowTeam){ if (Team == 1){ glow(Name,10,10,250); } else if (Team == 2) { glow(Name,250,10,10); } else if (Team == 3) { glow(Name,10,250,10); } else { glow(Name,250,250,10); } } } } GlowOn=1; } } else if (GlowOn == 1 ) { for (i = 1; i <= iMaxPlayers; i++) { if(playerinfo(i,Name,MAX_NAME_LENGTH,SessionID,WONID,Team,Dead)==1) { if (Team == GlowTeam){ glow(Name,0,0,0); } } } GlowAll = 0; GlowOn = 0; } } else if (ColorCheck(Color)==1) { for (i = 1; i <= iMaxPlayers; i++) { if(playerinfo(i,Name,MAX_NAME_LENGTH,SessionID,WONID,Team,Dead)==1) { if (Team == GlowTeam){ GlowHelper(Name,Color); } } } if (streq(Color, "off")==1) { GlowOn = 0; GlowAll = 0; } else { GlowOn = 1; } } else { selfmessage( "Unrecognized data:"); selfmessage(Color); return PLUGIN_HANDLED; } say_command(User,Command,Data); if (GlowTeam == 1) { GlowOne = GlowOn; } else if (GlowTeam == 2) { GlowTwo = GlowOn; } else if (GlowTeam == 3) { GlowThree = GlowOn; } else if (GlowTeam == 4) { GlowFour = GlowOn; } return PLUGIN_HANDLED; } /* This should create or turn off a glowing shell around the VIP in Counter-Strike or * the civilian (civ, for short) in TFC. If no color is specified will use team color. */ public admin_glowvip(HLCommand,HLData,HLUserName,UserIndex) { new Command[MAX_COMMAND_LENGTH]; new Data[MAX_DATA_LENGTH]; new User[MAX_NAME_LENGTH]; new SessionID; new Team; new Dead; new WONID; new Model[MAX_NAME_LENGTH]; new Name[MAX_NAME_LENGTH]; new iMaxPlayers = maxplayercount(); new i; if (CS != 1 && TFC != 1) { selfmessage("This command can only be used in Counter-Strike or TFC."); return PLUGIN_HANDLED; } convert_string(HLCommand,Command,MAX_COMMAND_LENGTH); convert_string(HLData,Data,MAX_DATA_LENGTH); convert_string(HLUserName,User,MAX_NAME_LENGTH); if (strlen(Data)==0 ) { for (i = 1; i <= iMaxPlayers; i++) { if(playerinfo(i,Name,MAX_NAME_LENGTH,SessionID,WONID,Team,Dead)==1) { get_userinfo(Name,"model",Model,MAX_NAME_LENGTH); if (streq(Model, "vip") != 0) { if ( GlowTwo==0 ) { glow(Name,250,250,10); GlowTwo = 1; } else { glow(Name,0,0,0); GlowTwo = 0; GlowAll = 0; } } if (streq(Model, "civilian") != 0) { if ( GlowOne==0 ) { glow(Name,10,10,250); GlowOne=1; } else { glow(Name,0,0,0); GlowOne = 0; GlowAll = 0; } } } } } else if (ColorCheck(Data)==1) { for (i = 1; i <= iMaxPlayers; i++) { if(playerinfo(i,Name,MAX_NAME_LENGTH,SessionID,WONID,Team,Dead)==1) { get_userinfo(Name,"model",Model,MAX_NAME_LENGTH); if ((streq(Model, "vip") != 0)||( streq(Model, "civilian") != 0)) { GlowHelper(Name,Data); } } } if (streq(Data, "off")==1) { if (CS == 1) { GlowTwo = 0; GlowAll = 0; } else { GlowOne = 0; GlowAll = 0; } } else { if (TFC == 1) { GlowOne = 1; } } } else { selfmessage( "Unrecognized data:"); selfmessage(Data); return PLUGIN_HANDLED; } say_command(User,Command,Data); return PLUGIN_HANDLED; } public plugin_init() { plugin_registerinfo("Glow Plugin","Used for making others glow.",STRING_VERSION); plugin_registercmd("admin_glowall","admin_glowall", ACCESS_FUN, "admin_glowall [<color>/random/off]: Make people glow team colors, or add a specific <color> name or RGB code, random, or off."); plugin_registercmd("admin_glowteam", "admin_glowteam", ACCESS_FUN, "admin_glowteam: <team#> [<color>/random/off]: Make team glow team colors, or add a specific <color> name or RGB code, random, or off."); if (fileexists("cstrike.WAD")==1) { CS=1; plugin_registercmd("admin_glowvip", "admin_glowvip", ACCESS_FUN, "admin_glowvip [<color>/random/off]: Make VIP/Civilian glow team colors, or add a specific <color> name or RGB code, random, or off."); } if (fileexists("tfc.WAD")==1) { TFC=1; plugin_registercmd("admin_glowciv", "admin_glowvip", ACCESS_FUN, "admin_glowciv [<color>/random/off]: Make VIP/Civilian glow team colors, or add a specific <color> name or RGB code, random, or off."); } return PLUGIN_CONTINUE; }