/* [WHO]Them Custom Script http://www.clanwho.com them@clanwho.com ICQ: 34419165 Credits: Admin Mod and its default script Copyright (C) 2000, Alfred Reynolds. parts by: Nathan O'Sullivan (snippets) Jaguar (chunks) */ #include #include #include #include #define ALL 0 #define LEV1 1 #define LEV2 1<<1 #define LEV4 1<<2 #define LEV8 1<<3 #define LEV16 1<<4 #define LEV32 1<<5 #define LEV64 1<<6 #define LEV128 1<<7 #define LEV256 1<<8 #define LEV512 1<<9 #define LEV1024 1<<10 #define LEV2048 1<< 11 #define LEV4096 1<<12 #define LEV8192 1<<13 #define LEV16384 1<<14 #define LEV32768 1<<15 enum PRINT_TYPE { print_console, print_center, print_chat, } #define NULL_CHAR '^0' #define MAX_NAME_LENGTH 30 #define MAX_DATA_LENGTH 200 #define MAX_PLAYERS 22 #define DEFAULT_TELEPORT_MODE 0 #define SPEAKTIMELEFT_BARRIER 60 //Idea ripped from jaguar's script (cuz its just a good idea) #define ADMIN_SAY_LEVEL 64 #define ADMIN_BSAY_LEVEL 64 #define ADMIN_MAP_LEVEL 2 #define ADMIN_VOTE_KICK_LEVEL 1 #define ADMIN_VOTE_MAP_LEVEL 1 #define ADMIN_VOTE_RESTART_LEVEL 1 #define ADMIN_GRAVITY_LEVEL 32 #define ADMIN_PAUSE_LEVEL 8 #define ADMIN_PASS_LEVEL 16 #define ADMIN_FRIENDLYFIRE_LEVEL 32 #define ADMIN_TEAMPLAY_LEVEL 32 #define ADMIN_FRAGLIMIT_LEVEL 2 #define ADMIN_TIMELIMIT_LEVEL 2 #define ADMIN_KICK_LEVEL 128 #define ADMIN_CFG_LEVEL 512 #define ADMIN_RESTARTROUND_LEVEL 4 #define ADMIN_PREMATCH_LEVEL 4 #define ADMIN_UNBAN_LEVEL 256 #define ADMIN_BAN_LEVEL 256 #define ADMIN_RCON_LEVEL 512 #define ADMIN_EXECUTE_LEVEL 512 #define ADMIN_ALLEXEC_LEVEL 512 #define ADMIN_SPEAK_LEVEL 64 #define ADMIN_DOTELEPORT_LEVEL 64 #define ADMIN_SETTELETOME_LEVEL 512 #define ADMIN_ALLTELETOME_LEVEL 512 #define ADMIN_SETFUNON_LEVEL 512 #define ADMIN_SETFUNOFF_LEVEL 512 #define ADMIN_SETFUNALL_LEVEL 512 #define ADMIN_TELEPORT_LEVEL 512 new user[50]; // the username of the person calling the script new command[40]; //the command that was passed new telex[MAX_PLAYERS]; new teley[MAX_PLAYERS]; new telez[MAX_PLAYERS]; new allowteleport[MAX_PLAYERS]; new watchuser[MAX_PLAYERS]; new watchusercommand[MAX_PLAYERS][20]; /***************************************************************************** HELPER FUNCTIONS ******************************************************************************/ public clear_variables() { new i=0; for(i=0; i (ratio/100)*d ) { new rc; rc=check_user(vote_kick_username); if( rc>0 ) { new real_user[32]; if ( rc == 2 || rc == 3 ) { get_username( vote_kick_username, real_user,32); } else { strncpy(real_user ,vote_kick_username,32); } new msg[200]; strncpy(msg,real_user,32); strncat(msg," kicked due to vote",200-strlen(real_user)); say(msg); message(real_user,"You have been kicked due to a vote"); kick(real_user); } } else { say("Not enough votes for kick"); } } else { say("Not enough votes for kick"); } } admin_vote_map(map[]) { if (unauthorized(ADMIN_VOTE_MAP_LEVEL)) return; if ( valid_map(map) == 1) { new msg[100]; if (strlen(map)<1) { message(user,"Incorrect commandline"); } strncpy(msg,"Change map to ",strlen("Change map to ")); strcat(msg,map); log(msg); vote(msg,"Yes","No","map_vote",map); } else message(user,"Map does not exist"); } public map_vote(a,b,c,d) { new vote_map[100]; new tell[500]; convert_string(b,vote_map,100); if ( a == 1 ) { new ratio = getvar("map_ratio"); if ( ratio == 0 ) { say("Map vote is not enabled"); return; } if ( c > (ratio/100)*d ) { strncpy(tell,"Change of map to ",strlen("Change of map to ")); strncat(tell,vote_map,500); strncat(tell," due to vote",500); centersay(tell,10,0,255,0); changelevel(vote_map); } else { say("Not enough votes for map change"); } } else { say("Not enough votes for map change"); } } // FROM Nathan O'Sullivan admin_vote_restart(unused[]) { if (unauthorized(ADMIN_VOTE_RESTART_LEVEL)==0 && vote_allowed()==1) { new msg[100]; strncpy(msg,"Restart map & begin play?",strlen("Restart map & begin play?") ); vote(msg,"Yes","No","restart_vote",unused); } else message(user,"Vote not allowed at this time"); } public restart_vote(a,b,c,d) { new vote_map[100]; convert_string(b,vote_map,100); if ( a == 1 ) { new ratio = getvar("map_ratio"); if ( ratio == 0 ) { say("Restart vote is not enabled"); return; } if ( c > (ratio/100)*d ) { new tleft, tlimit; tleft = timeleft() - 10; // # seconds till restart! tlimit = getvar("mp_timelimit"); tlimit = tlimit + (tlimit - tleft/60); new str[100],tmp[50]; strncpy(str,"mp_timelimit ",50); numtostr(tlimit,tmp); strncat(str,tmp,50); exec (str); exec ("sv_restartround 10"); } else { say("Not enough votes for map restart"); } } else { say("Not enough votes for map restart"); } } admin_gravity(a[]) { if (unauthorized(ADMIN_GRAVITY_LEVEL)) return; new msg[100]; strncpy(msg,"sv_gravity ",strlen("sv_gravity ")); strcat(msg,a); say("Changing gravity to:"); say(a); exec(msg); } admin_pause(a) { if (unauthorized(ADMIN_PAUSE_LEVEL)) return; new msg[100]; strncpy(msg,"pausable ",strlen("pausable ")); if ( a == 1) { strcat(msg," 1"); log("setting pausable to 1"); } else { strcat(msg," 0"); log("setting pausable to 0"); } exec(msg); } admin_pass(a[]) { if (unauthorized(ADMIN_PASS_LEVEL)) return; new msg[100]; strncpy(msg,"sv_password ",strlen("sv_password ")); strcat(msg,a); a[strlen(a)-1]=0; log("setting password"); exec(msg); } admin_friendlyfire(a[]) { if (unauthorized(ADMIN_FRIENDLYFIRE_LEVEL)) return; new msg[100]; strncpy(msg,"mp_friendlyfire ",strlen("mp_friendlyfire ")); strcat(msg,a); log("setting mp_friendlyfire"); exec(msg); } admin_teamplay(a[]) { if (unauthorized(ADMIN_TEAMPLAY_LEVEL)) return; new msg[100]; strncpy(msg,"mp_teamplay ",strlen("mp_teamplay ")); strcat(msg,a); log("setting mp_teamplay"); exec(msg); } admin_fraglimit(a[]) { if (unauthorized(ADMIN_FRAGLIMIT_LEVEL)) return; new msg[100]; strncpy(msg,"mp_fraglimit ",strlen("mp_fraglimit ")); strcat(msg,a); log("setting mp_fraglimit"); exec(msg); } admin_timelimit(a[]) { if (unauthorized(ADMIN_TIMELIMIT_LEVEL)) return; new msg[100]; strncpy(msg,"mp_timelimit ",strlen("mp_timelimit ")); strcat(msg,a); log("setting mp_timelimit"); exec(msg); } admin_kick(kick_user[]) { if (unauthorized(ADMIN_KICK_LEVEL)) return; new real_user[MAX_NAME_LENGTH]; usersearch(kick_user, real_user); message(real_user,"You have been kicked by "); message(real_user,user); kick(real_user); } admin_cfg(a[]) { if (unauthorized(ADMIN_CFG_LEVEL)) return; new msg[100]; strncpy(msg,"exec ",strlen("exec ")); strcat(msg,a); log("Executing script"); exec(msg); } admin_restartround(a[]) { if (unauthorized(ADMIN_RESTARTROUND_LEVEL)) return; new msg[100]; strncpy(msg,"sv_restartround ",strlen("sv_restartround ")); strcat(msg,a); log("setting sv_restartround"); exec(msg); } admin_prematch(a[]) { if (unauthorized(ADMIN_PREMATCH_LEVEL)) return; new msg[100]; strncpy(msg,"tfc_clanbattle_prematch ",strlen("tfc_clanbattle_prematch ")); strcat(msg,a); log("setting tfc_clanbattle_prematch"); exec(msg); } admin_unban(a[]) { if (unauthorized(ADMIN_UNBAN_LEVEL)) return; unban(a); log("Unbanning user:"); log(a); } admin_ban(ban_user[]) { if (unauthorized(ADMIN_BAN_LEVEL)) return; if (check_user(ban_user)==1) { new real_user[MAX_NAME_LENGTH]; get_username(ban_user,real_user,MAX_NAME_LENGTH); //LogCommand(); ban(real_user,0); } else { message(user, "Unrecognized player: "); message(user, ban_user); } } admin_reload() { reload(); } admin_timeleft() { speaktimeleft(); } admin_rcon(a[]) { if (unauthorized(ADMIN_RCON_LEVEL)) return; new tellout[500]; if ( streq(a, "rcon_password", strlen("rcon_password")) || streq(a, "RCON_PASSWORD", strlen("RCON_PASSWORD"))) { message(user, "Denied, command logged and red flagged for review"); strncpy(tellout, "WARNING: ", strlen("WARNING: ")); strcat(tellout, user); strcat(tellout, " has attempted to change the rcon_password, BANNING"); ban(user, 0); kick(user); return; } strncpy(tellout, "ADMIN COMMAND: ", strlen("ADMIN COMMAND: ")); strncat(tellout, user,500); strncat(tellout, " just issued an rcon command.",500); say(tellout); exec(a); } admin_execute(a[]) { if (unauthorized(ADMIN_EXECUTE_LEVEL)) return; new i=0; new n=0; new username[MAX_NAME_LENGTH]; new usernumstr[MAX_NAME_LENGTH]; for(i=0; a[i] != ' '; i=i+1) usernumstr[i] = a[i]; i=i+1; for(n=0; a[i+n] != NULL_CHAR; n=n+1) a[n] = a[i+n]; a[n] = NULL_CHAR; usersearch(usernumstr, username); if(check_user(username)==1) { execclient(username, a); } else message(user, "Could not find player"); } admin_allexec(a[]) { if (unauthorized(ADMIN_ALLEXEC_LEVEL)) return; execute_all(a); } admin_test(passed_data[]) { new sayname[MAX_NAME_LENGTH]; usersearch(passed_data, sayname); message(user, sayname); } admin_speak(a[]) { if (unauthorized(ADMIN_SPEAK_LEVEL)) return; new d[300]; new x = 0; new time1 = timeleft(); if(lastcallforspeak < time1 + speaktimeleft_intervals) return; lastcallforspeak = time1; strncpy(d, "speak ", strlen("speak ")); d[6] = '^"'; for(x=7; x<299 && a[x-7] != NULL_CHAR; x=x+1) d[x] = a[x-7]; d[x] = '^"'; d[x+1] = NULL_CHAR; execute_all(d); } admin_messagemode() { if (unauthorized(ADMIN_SAY_LEVEL)) return; new usernum=0; get_userindex(user,usernum); watchuser[usernum] = 1; strncpy(watchusercommand[usernum], "admin_say", strlen("admin_say")+1); execclient(user, "messagemode"); } admin_setteleport() { new x=0, y=0, z=0; get_userorigin(user, x, y, z); setteleportuser(user, x, y, z); } admin_doteleport() { if (unauthorized(ADMIN_DOTELEPORT_LEVEL)) return; teleportuser(user); } admin_setteletome(usernumstr[]) { if (unauthorized(ADMIN_SETTELETOME_LEVEL)) return; new userid1 = 0; new wonid1 = 0; new usernum=0; new username[MAX_NAME_LENGTH]; usernum = strtonum(usernumstr); if(check_user(usernumstr)!=1) playerinfo(usernum, username, MAX_NAME_LENGTH, userid1, wonid1); if(check_user(username)!=1) get_username(usernumstr, username, MAX_NAME_LENGTH); if(check_user(username)==1) { new x=0, y=0, z=0; get_userorigin(user, x, y, z); setteleportuser(username, x, y, z); } else message(user, "Could not find player"); } admin_allteletome() { if (unauthorized(ADMIN_ALLTELETOME_LEVEL)) return; new userid1 = 0; new wonid1 = 0; new username[MAX_NAME_LENGTH]; new i = 0; new x = 0; new x1, y1, z1; x = maxplayercount(); for(i=1; i<=x; i=i+1) { playerinfo(i, username, MAX_NAME_LENGTH, userid1, wonid1); if(check_user(username)==1) { get_userorigin(username, x1, y1, z1); setteleportuser(username, x1, y1, z1); } } } admin_funteleport() { new indexholder = 0; get_userindex(user, indexholder); if(allowteleport[indexholder]==1) teleportuser(user); else message(user, "You're not authorized to use the fun stuff, ask an admin"); } admin_setfunon(a[]) { if (unauthorized(ADMIN_SETFUNON_LEVEL)) return; new i=0; new n=0; new indexholder = 0; new userid1 = 0; new wonid1 = 0; new usernum=0; new username[MAX_NAME_LENGTH]; new usernumstr[MAX_NAME_LENGTH]; for(i=0; a[i] != ' ' && a[i] != NULL_CHAR; i=i+1) usernumstr[i] = a[i]; i=i+1; for(n=0; a[i+n] != NULL_CHAR; n=n+1) a[n] = a[i+n]; a[n] = NULL_CHAR; usernum = strtonum(usernumstr); if(check_user(usernumstr)!=1) playerinfo(usernum, username, MAX_NAME_LENGTH, userid1, wonid1); if(check_user(username)!=1) get_username(usernumstr, username, MAX_NAME_LENGTH); if(check_user(username)==1) { get_userindex(username, indexholder); setfunon(indexholder); } else message(user, "Could not find player"); } admin_setfunoff(a[]) { if (unauthorized(ADMIN_SETFUNOFF_LEVEL)) return; new i=0; new n=0; new indexholder = 0; new userid1 = 0; new wonid1 = 0; new usernum=0; new username[MAX_NAME_LENGTH]; new usernumstr[MAX_NAME_LENGTH]; for(i=0; a[i] != ' ' && a[i] != NULL_CHAR; i=i+1) usernumstr[i] = a[i]; i=i+1; for(n=0; a[i+n] != NULL_CHAR; n=n+1) a[n] = a[i+n]; a[n] = NULL_CHAR; usernum = strtonum(usernumstr); if(check_user(usernumstr)!=1) playerinfo(usernum, username, MAX_NAME_LENGTH, userid1, wonid1); if(check_user(username)!=1) get_username(usernumstr, username, MAX_NAME_LENGTH); if(check_user(username)==1) { get_userindex(username, indexholder); setfunoff(indexholder); } else message(user, "Could not find player"); } admin_setfunall(a[]) { if (unauthorized(ADMIN_SETFUNALL_LEVEL)) return; new i = 0; new n = 0; new num = 0; new numstr[5]; for(i=0; a[i] != ' ' && a[i] != NULL_CHAR; i=i+1) numstr[i] = a[i]; i=i+1; for(n=0; a[i+n] != NULL_CHAR; n=n+1) a[n] = a[i+n]; a[n] = NULL_CHAR; num = strtonum(numstr); for(i=0; i