naja, erstmal vorläufig. man kann mit admin_gb_weapon weapon_xxx ausser dem messer eine weitere waffe einstellen, die benutzt werden darf, z.b. weapon_scout, weapon_tmp oder weapon_p228. admin_gb_weapon weapon_knife erlaubt nur das messer (logisch), und admin_gb_weapon alle erlaubt alle waffen (wer hätte das gedacht?).
Code:
/* Gh0sTbUsTeR Mode by CoWs | Element
devilzero@tiscalinet.ch <mailto:devilzero@tiscalinet.ch>
Modifiziert dieses Plugin so viel ihr wollt
aber lasst mir nen Credit uebrig ;) */
#include <string>
#include <admin>
#include <adminlib>
#define ACCESS_GB 8192
#define ACCESS_CONSOLE 131072
#define T 3
new STRING_VERSION[MAX_DATA_LENGTH]= "2.50.50";
new GBMode;
new Planting = 0;
new Noclip[MAX_PLAYERS];
new AllowedWeapon[MAX_NAME_LENGTH];
public admin_gbmode(HLCommand,HLData,HLUserName,UserIndex) {
new Command[MAX_COMMAND_LENGTH];
new Data[MAX_DATA_LENGTH];
new UserName[MAX_NAME_LENGTH];
convert_string(HLCommand,Command,MAX_NAME_LENGTH);
convert_string(HLData,Data,MAX_NAME_LENGTH);
convert_string(HLUserName,UserName,MAX_NAME_LENGTH);
if(strlen(Data) == 0) {
snprintf(Data,MAX_TEXT_LENGTH,"^"admin_gbmode^" is ^"%i^"",GBMode);
selfmessage(Data);
} else if(check_param(Data) > GBMode) {
set_vaultdata("logd_gb","1");
GBMode = 1;
say_command(UserName,Command,Data);
exec("sv_restartround 10");
snprintf(Data,MAX_TEXT_LENGTH,"Gh0sTbUsTeR Mode startet in 10 Sekunden.\nErlaubte Waffe: %s",AllowedWeapon[7]);
centersay(Data,10, 10, 255, 255);
set_timer("noclipall",10,0);
} else if(check_param(Data) < GBMode) {
set_vaultdata("logd_gb","0");
GBMode = 0;
exec("sv_restartround 10");
say_command(UserName,Command,Data);
centersay("Gh0sTbUsTeR Mode vorbei...*sniff*", 12, 10, 255, 255);
}
return PLUGIN_HANDLED;
}
public admin_gb_weapon(HLCommand,HLData,HLUserName,UserIndex) {
new Command[MAX_COMMAND_LENGTH];
new Data[MAX_DATA_LENGTH];
new UserName[MAX_NAME_LENGTH];
new i,Dead;
convert_string(HLCommand,Command,MAX_NAME_LENGTH);
convert_string(HLData,Data,MAX_NAME_LENGTH);
convert_string(HLUserName,UserName,MAX_NAME_LENGTH);
if(strlen(Data) == 0) {
snprintf(Data,MAX_TEXT_LENGTH,"^"admin_gb_weapon^" is ^"%s^"",AllowedWeapon[7]);
selfmessage(Data);
} else if(strncmp(Data,"weapon_",7) == 0) {
set_vaultdata("logd_gb_weapon",Data);
strcpy(AllowedWeapon,Data,MAX_NAME_LENGTH);
say_command(UserName,Command,Data);
for(i=1;i<=maxplayercount();i++) {
if(playerinfo(i,UserName, MAX_NAME_LENGTH,_,_,_,Dead) == 1 && Dead == 0) {
execclient(UserName,"weapon_knife");
execclient(UserName,AllowedWeapon);
}
}
snprintf(Data,MAX_TEXT_LENGTH,"Gh0sTbUsTeR Mode: Erlaubte Waffe ist nun %s.",Data[7]);
centersay(Data,10, 10, 255, 255);
} else {
set_vaultdata("logd_gb_weapon","alle");
strcpy(AllowedWeapon,"alle",MAX_NAME_LENGTH);
say_command(UserName,Command,Data);
centersay("Gh0sTbUsTeR Mode: Alle Waffen sind nun erlaubt.", 12, 10, 255, 255);
}
return PLUGIN_HANDLED;
}
public plugin_command(HLCommand,HLData,HLUserName,UserIndex) {
new Command[MAX_COMMAND_LENGTH];
new UserName[MAX_NAME_LENGTH];
convert_string(HLCommand,Command,MAX_COMMAND_LENGTH);
if(GBMode == 1 && strncmp(Command,"weapon_",7) == 0 && strcmp(AllowedWeapon,"alle") != 0 && strcmp(Command,"weapon_knife") != 0 && (Planting != UserIndex || strcmp(Command,"weapon_c4") != 0) && strcmp(Command,AllowedWeapon) != 0) {
convert_string(HLUserName,UserName,MAX_NAME_LENGTH);
execclient(UserName,AllowedWeapon);
messageex(UserName,"You may not use this weapon in Gh0sTbUsTeR Mode",print_chat);
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
public HandleSay(HLCommand,HLData,HLUserName,UserIndex) {
new Data[MAX_DATA_LENGTH];
new UserName[MAX_NAME_LENGTH];
new Team,Dead;
convert_string(HLData,Data,MAX_DATA_LENGTH);
strstripquotes(Data);
if (GBMode == 1 && strcasestr(Data,"iwantplant") != -1 && Planting == 0 && playerinfo(UserIndex,UserName,MAX_NAME_LENGTH,_,_,Team,Dead) == 1 && Team == 1 && Dead == 0) {
noclip(UserName, 0);
Planting = UserIndex;
execclient(UserName,"weapon_c4");
set_timer("TimerNoClip",10,0);
}
return PLUGIN_CONTINUE;
}
public TimerNoClip(Timer,Repeat,HLUserName,HLParam) {
new UserName[MAX_NAME_LENGTH];
convert_string(HLUserName,UserName,MAX_NAME_LENGTH);
Planting = 0;
noclip(UserName,1);
}
public noclipall(Timer,Repeat,HLUserName,HLParam) {
new UserName[ MAX_NAME_LENGTH ];
new Dead;
new i;
if(GBMode == 1) {
for(i=1;i<=maxplayercount();i++) {
if(playerinfo(i,UserName, MAX_NAME_LENGTH,_,_,_,Dead) == 1 && Dead == 0 && Noclip[i] == 0) {
noclip(UserName, 1);
execclient(UserName,"weapon_knife");
execclient(UserName,AllowedWeapon);
Noclip[i] = 1;
}
}
set_timer("noclipall",T,0);
}
}
public specmode(HLCommand,HLData,HLUserName,UserIndex) {
Noclip[UserIndex] = 0;
}
public logd_ghostbusters(HLCommand,HLData,HLUserName,UserIndex) {
new i;
for(i=1;i<MAX_PLAYERS;i++) {
Noclip[i] = 0;
}
}
public plugin_init() {
plugin_registerinfo("Gh0sTbUsTeR Mode","Noclips all players and gives them special commands",STRING_VERSION);
plugin_registercmd("say_team","HandleSay",ACCESS_ALL);
plugin_registercmd("admin_gbmode", "admin_gbmode", ACCESS_GB, "admin_gbmode <1 || 0> Gh0sTbUsTeR Mode");
plugin_registercmd("admin_gb_weapon", "admin_gb_weapon", ACCESS_GB, "admin_gbweapon <^"weapon_xxx^" || ^"alle^"> Gh0sTbUsTeR Mode Waffe");
plugin_registercmd("specmode", "specmode", ACCESS_ALL);
plugin_registercmd("logd_ghostbusters", "logd_ghostbusters", ACCESS_CONSOLE);
plugin_registerhelp("say_team",ACCESS_ALL,"say_team iwantplant: Disables noclipmode on you for 10 seconds");
exec( "logd_reg 62 admin_command logd_ghostbusters" );
get_vaultnumdata("logd_gb",GBMode);
set_vaultnumdata("logd_gb",GBMode);
get_vaultdata("logd_gb_weapon",AllowedWeapon,MAX_NAME_LENGTH);
if(strncmp(AllowedWeapon,"weapon_",7) != 0) {
strcpy(AllowedWeapon,"alle",MAX_NAME_LENGTH);
}
set_vaultdata("logd_gb_weapon",AllowedWeapon);
set_timer("noclipall",T,0);
return PLUGIN_CONTINUE;
}