| csykosoma |
12-16-2011 03:49 |
[REQ] need update for an auto team randmizer plugin
i have found this plugin that randomizes the teams after one team wins x amount of rounds. unfortunately, this plugin is broken because when it randomizes, afk spectators are forced to a team where they will be stuck to the rotating spectator camera or spawned alive as spectators.
if anyone does update... also the admin immunity could be removed and a message could show in chat after each round (there is already a command /ownage that does this) announcing the current score of each team.
i would be appreciative. its a great plugin with a few minor issues.
http://forums.alliedmods.net/showthread.php?t=52190
PHP Code:
/* AMX Mod X script. * * Skunage(c) Copyright 2002, SuicideDog * Streak Ownage(c) Copyright 2007, Travo * * Plugin changes map when teams are lopsided and * one side gets skunked * * Skunage Code gleemed from OLO'S Win Limit plugin * Streak Ownage Code gleemed from SuicideDog's Skunage plugin * This file is provided as is (no warranties). * */
#include <amxmodx> #include <cstrike> #include <fun>
new ct_score = 0 new terrorist_score = 0 new ct_shscore = 0 new terrorist_shscore = 0 new cvOwn
public plugin_init(){ register_plugin("Streak Ownage","1.0","SuicideDog/Travo") register_event("TeamScore", "team_score", "a") register_event("ResetHUD", "new_round", "bc") register_concmd("amx_shake", "shaketeams", ADMIN_KICK, "<Randomizes the players within Ts and CTs>") register_clcmd("say /ownage","check_ownage_score",0,"<Tells you the current Ownage score>") register_cvar("travo_streakownage","v1.0",FCVAR_SERVER|FCVAR_UNLOGGED|FCVAR_SPONLY) cvOwn = register_cvar("amx_skunk","7") return PLUGIN_CONTINUE }
public team_score(){ new team[2] read_data(1,team,1) if (team[0]=='C') ct_score = read_data(2) else if (team[0]=='T') terrorist_score = read_data(2) return PLUGIN_CONTINUE }
public new_round(){ new winlimit = get_pcvar_num(cvOwn) new allowwin = winlimit/4; // little leeway for losing team ie. CT-4 T-1 = true new ct_current = ct_score-ct_shscore new terrorist_current = terrorist_score-terrorist_shscore if (get_playersnum()<5) { ct_shscore = ct_score,terrorist_shscore = terrorist_score ct_current = 0, terrorist_current = 0 } if ((ct_current<0) || (terrorist_current<0)) { ct_shscore = ct_score,terrorist_shscore = terrorist_score ct_current = 0, terrorist_current = 0 } if ((ct_current>=terrorist_current) && (terrorist_current>allowwin) && (ct_current+terrorist_current>0)) { ct_shscore = ct_score,terrorist_shscore = terrorist_score ct_current = 0, terrorist_current = 0 } if ((terrorist_current>=ct_current) && (ct_current>allowwin) && (ct_current+terrorist_current>0)) { ct_shscore = ct_score,terrorist_shscore = terrorist_score ct_current = 0, terrorist_current = 0 } if ((ct_current-terrorist_current) >= winlimit) { client_print(0,print_chat,"[AMXX] CT's have OWNED T's with score of %d to %d. Randomizing teams...",ct_current,terrorist_current) shaketeams() ct_shscore = ct_score,terrorist_shscore = terrorist_score } if ((terrorist_current-ct_current) >= winlimit) { client_print(0,print_chat,"[AMXX] T's have OWNED CT's with score of %d to %d. Randomizing teams...",terrorist_current,ct_current) shaketeams() ct_shscore = ct_score,terrorist_shscore = terrorist_score } return PLUGIN_CONTINUE }
public shaketeams(){ // 0=Leavealone 1=T 2=CT 3=Pickrand new Playerteam[32] = 0, tplayers=0, tcts=0, tts=0, overflow = 0, randnum, g_maxplayers g_maxplayers = get_maxplayers() + 2 for(new i=0;i<g_maxplayers;i++) // check teams and determine which can be switched { if(is_user_connected(i)) { if((get_user_flags(i) & ADMIN_IMMUNITY) || (is_user_bot(i)) || (is_user_hltv(i)) || (cs_get_user_team(i) == CS_TEAM_SPECTATOR)) { Playerteam[i] = 0 if (cs_get_user_team(i) == CS_TEAM_T) tts++ else if (cs_get_user_team(i) == CS_TEAM_CT) tcts++ } else { Playerteam[i] = 3 tplayers++ } } else { g_maxplayers-- } } while(tplayers>0 && overflow<3000) // determine which team we are gonna put the switchers on { randnum = random_num(1,g_maxplayers) overflow++ //make the loop un-infinite so it doesnt crash server on error
if(is_user_connected(randnum) && Playerteam[randnum]==3) { if(tts < tcts) { Playerteam[randnum] = 1 tts++ tplayers-- } else { Playerteam[randnum] = 2 tcts++ tplayers-- } } } for(new i=0;i<g_maxplayers;i++) // perform all switches and respawn all players { if(is_user_connected(i)) { if (Playerteam[i]>0) { switch(Playerteam[i]) { case 1 : { cs_set_user_team(i, CS_TEAM_T) } case 2 : { cs_set_user_team(i, CS_TEAM_CT) } } } new ids[3] num_to_str(i,ids,2) set_task(0.1,"revive",0,ids,2,"a",2) } } return PLUGIN_HANDLED }
public check_ownage_score(id){ new winlimit = get_pcvar_num(cvOwn) new ct_current = ct_score-ct_shscore new terrorist_current = terrorist_score-terrorist_shscore client_print(id,print_chat,"[AMXX] Current Ownage score is CT: %d to T: %d. The team reset is set to %d wins.",ct_current,terrorist_current,winlimit) return PLUGIN_HANDLED }
public revive(ids[]){ new id = str_to_num(ids) spawn(id) give_item(id,"weapon_knife") }
|