Simple Adminmod Team Change Plugin
j0e
Join Date: 2002-11-01 Member: 2840Banned
<div class="IPBDescription">it just forces a player to change teams</div> <b>new commands:
admin_marine player
admin_alien player</b>
/* copy/pasted from plugin_CS.sma
d_h_johnson@hotmail.com
*/
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
#define ACCESS_CHANGE_TEAM 8192
public admin_changeteam(HLCommand,HLData,HLUserName,UserIndex) {
new Command[MAX_COMMAND_LENGTH];
new Data[MAX_DATA_LENGTH];
new TargetName[MAX_NAME_LENGTH];
new Text[MAX_TEXT_LENGTH];
new User[MAX_NAME_LENGTH];
convert_string(HLCommand,Command,MAX_NAME_LENGTH);
convert_string(HLData,Data,MAX_NAME_LENGTH);
convert_string(HLUserName,User,MAX_NAME_LENGTH);
if (check_user(Data) == 1) {
get_username(Data,TargetName,MAX_NAME_LENGTH);
say_command(User,Command,TargetName);
if (check_immunity(TargetName) != 0) {
snprintf(Text, MAX_TEXT_LENGTH, "Laf. You can't move %s onto another team, you silly bear.", TargetName);
messageex(User,Text,print_chat);
} else if (streq(Command,"admin_alien")==1) {
execclient(TargetName, "readyroom;jointeamtwo");
execclient(TargetName, "echo admin has changed your team"); } else if (streq(Command,"admin_marine")==1) {
execclient(TargetName, "readyroom;jointeamone");
execclient(TargetName, "echo admin has changed your team"); }
} else {
selfmessage("Unrecognized player: ");
selfmessage(Data);
}
return PLUGIN_HANDLED;
}
public plugin_init() {
plugin_registercmd("admin_alien","admin_changeteam",ACCESS_CHANGE_TEAM,"admin_alien <target>: Changes target to the alien team.");
plugin_registercmd("admin_marine","admin_changeteam",ACCESS_CHANGE_TEAM,"admin_marine <target>: Changes target to the marine team.");
return PLUGIN_CONTINUE;
}
admin_marine player
admin_alien player</b>
/* copy/pasted from plugin_CS.sma
d_h_johnson@hotmail.com
*/
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
#define ACCESS_CHANGE_TEAM 8192
public admin_changeteam(HLCommand,HLData,HLUserName,UserIndex) {
new Command[MAX_COMMAND_LENGTH];
new Data[MAX_DATA_LENGTH];
new TargetName[MAX_NAME_LENGTH];
new Text[MAX_TEXT_LENGTH];
new User[MAX_NAME_LENGTH];
convert_string(HLCommand,Command,MAX_NAME_LENGTH);
convert_string(HLData,Data,MAX_NAME_LENGTH);
convert_string(HLUserName,User,MAX_NAME_LENGTH);
if (check_user(Data) == 1) {
get_username(Data,TargetName,MAX_NAME_LENGTH);
say_command(User,Command,TargetName);
if (check_immunity(TargetName) != 0) {
snprintf(Text, MAX_TEXT_LENGTH, "Laf. You can't move %s onto another team, you silly bear.", TargetName);
messageex(User,Text,print_chat);
} else if (streq(Command,"admin_alien")==1) {
execclient(TargetName, "readyroom;jointeamtwo");
execclient(TargetName, "echo admin has changed your team"); } else if (streq(Command,"admin_marine")==1) {
execclient(TargetName, "readyroom;jointeamone");
execclient(TargetName, "echo admin has changed your team"); }
} else {
selfmessage("Unrecognized player: ");
selfmessage(Data);
}
return PLUGIN_HANDLED;
}
public plugin_init() {
plugin_registercmd("admin_alien","admin_changeteam",ACCESS_CHANGE_TEAM,"admin_alien <target>: Changes target to the alien team.");
plugin_registercmd("admin_marine","admin_changeteam",ACCESS_CHANGE_TEAM,"admin_marine <target>: Changes target to the marine team.");
return PLUGIN_CONTINUE;
}
Comments
Looks good though
1) i don't want to try to spell khara/khaara/kharaa/khaaraa when i am in a hurry to move someone. admin_alien is a lot easier for me
2) you said yours has a bug: "on the scoreboard they change to RR team, but they remain where they were as a marine/kharaa and can just not do anything." so i didn't want to use it
when you fix that bug, i'll be happy to use yours <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile.gif' border='0' valign='absmiddle' alt='smile.gif'><!--endemo-->
It still stops them from changing until those 2 mins are up... just not in the best way yet, hehe.
you could add logd functionallity to the am plugin so that a recently chomped/crushed/impaled/shot-the-fug-up player can be auto-switched if the teams become too uneven.
or prehaps the next release will have some form of auto-balancing enabled. *cough*mp_autobalance*cough*
i showed it to bugblatter - he sent you an email about it <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile.gif' border='0' valign='absmiddle' alt='smile.gif'><!--endemo--> i'll be happy to send you whatever info i can to help
here's an adminmod forums post confirming it with other people also the same problem with 1.02
<a href='http://www.ozforums.com/showthread.php?s=&postid=490470' target='_blank'>http://www.ozforums.com/showthread.php?s=&...=&postid=490470</a>
(1.02 relevant posts at the bottom)
Logd works correctly with 1.02