Bl0kc | Дата: Суббота, 23.01.2010, 09:54:24 | Сообщение # 1 |
Полковник
Группа: Пользователи
Сообщений: 152
Статус: Не в сети
| Code #include <amxmodx> #include <amxmisc> #include <fun> new vault_value[128] new votenumber = 0 new votecontroller[33][2] new option[4] new st_vote = 0 new totalvoters = 0 new bool:bVoteToStop = false new players1[32],players2[32] new bool:votedoneround = false new bool:onepass = false new boom,gibs,white new wasbomb[33]
fx_kill(id){ new vExplodeAt[3] get_user_origin(id,vExplodeAt) // TE_BEAMCYLINDER message_begin( MSG_BROADCAST,SVC_TEMPENTITY,vExplodeAt,id) write_byte( 21 ) write_coord(vExplodeAt[0]) write_coord(vExplodeAt[1]) write_coord(vExplodeAt[2] +16) write_coord(vExplodeAt[0]) write_coord(vExplodeAt[1]) write_coord(vExplodeAt[2] +1936) write_short( white ) write_byte( 0 ) // startframe write_byte( 0 ) // framerate write_byte( 3 ) // life 2 write_byte( 20 ) // width 16 write_byte( 0 ) // noise write_byte( 188 ) // r write_byte( 220 ) // g write_byte( 255 ) // b write_byte( 255 ) //brightness write_byte( 0 ) // speed message_end() // TE_EXPLOSION message_begin(MSG_BROADCAST, SVC_TEMPENTITY,{0,0,0},id) write_byte(3) write_coord(vExplodeAt[0]) write_coord(vExplodeAt[1]) write_coord(vExplodeAt[2]) write_short(boom) write_byte(150) write_byte(15) write_byte(0) message_end() //define TE_EXPLODEMODEL message_begin(MSG_BROADCAST,SVC_TEMPENTITY,{0,0,0},id) write_byte(107) // spherical shower of models, picks from set write_coord(vExplodeAt[0]) write_coord(vExplodeAt[1]) write_coord(vExplodeAt[2]) write_coord(175) //(velocity) write_short (gibs) //(model index) write_short (25) // (count) write_byte (100) // (life in 0.1's) message_end() wasbomb[id] = 1 set_user_rendering(id,kRenderFxNone, 0,0,0, kRenderTransAdd,0) user_kill(id,1) }
public admin_hu(id,level,cid){ if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
if(get_cvar_num("amx_hurryup_mode")){ console_print(id,"[AMXX] You have enabled hurry up mode") set_cvar_num("amx_hurryup_mode",0) }else { console_print(id,"[AMXX] You have disabled hurry up mode") set_cvar_num("amx_hurryup_mode",1) }
new authid[16],name[32] get_user_authid(id,authid,15) get_user_name(id,name,31) log_amx("^"%s<%d><%s><>^" hurryup", name,get_user_userid(id),authid) return PLUGIN_HANDLED }
public chk_players(){ if(votedoneround == true || get_cvar_num("amx_hurryup_mode") == 0) return PLUGIN_CONTINUE if(get_playersnum() < get_cvar_num("amx_hurryup_minplayers")) return PLUGIN_CONTINUE new inum1,inum2 get_players(players1,inum1,"ae","TERRORIST") get_players(players2,inum2,"ae","CT") if(inum1 == 1 && inum2 == 1) do_hurry(0) else if(inum1 == 1) do_hurry(1) else if(inum2 == 1) do_hurry(2) return PLUGIN_CONTINUE }
do_hurry(team){ if(!onepass){ onepass = true client_print(0,print_chat,"[AMXX] People are waiting, hurry up and die already!") return PLUGIN_CONTINUE } client_cmd(0,"play misc/hurryup.wav") votedoneround = true new menu_body[256] new Float:voting = get_cvar_float("amx_last_voting") if (voting > get_gametime()) return PLUGIN_HANDLED if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime()) return PLUGIN_HANDLED new inprogress[32] get_cvar_string("amx_vote_inprogress",inprogress,31) if(equal(inprogress, "0",1)){ new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0 set_cvar_float("amx_last_voting", get_gametime() + vote_time ) for(new a = 0; a < 33; a++) votecontroller[a][1] = 0 votenumber++ set_cvar_string("amx_vote_inprogress","1") ejl_vault("WRITE","CURRENT_VOTE","HURRYUPVOTE") bVoteToStop = true switch(team){ case 0: { format(menu_body,255,"\yOne left on a team... ^n\w^n1. Kill both to hurry things up^n2. Let them play till one wins") log_amx("World triggered ^"hurryup_vote to kill both teams^"") } case 1: { format(menu_body,255,"\yOne left on a team... ^n\w^n1. Kill him to get to new round^n2. Let him play till one team wins") log_amx("World triggered ^"hurryup_vote to kill terrorist^"") } case 2: { format(menu_body,255,"\yOne left on a team... ^n\w^n1. Kill him to get to new round^n2. Let him play till one team wins") log_amx("World triggered ^"hurryup_vote to kill CT^"") } } new keys = (1<<0)|(1<<1) format(menu_body,255,menu_body) totalvoters = 0 new Team[32] new maxpl = get_maxplayers()+1 for(new k = 1; k < maxpl; k++){ if( is_user_bot(k) && !get_cvar_num("amx_allowbotvotes") ) continue get_user_team(k,Team,33) if(!((equali(Team,"UNAS",4)) || (equali(Team,"SPEC",4)) || (get_user_time(k)== 0) )){ show_menu(k,keys,menu_body,floatround(vote_time)) totalvoters++ } }
// cmd, #of options, type of vote 5=HURRY server_cmd("bot_votebegin 2 5")
new args[1] args[0] = team set_task(vote_time,"HandleHUVote",0,args,1) client_print(0,print_chat,"[AMXX] Voting has started...") for(new j = 0; j < 4;++j) option[j] = 0 } return PLUGIN_HANDLED }
public HandleHUVote(team[]) { set_cvar_string("amx_vote_inprogress","0") ejl_vault("WRITE","CURRENT_VOTE","NULL") bVoteToStop = false for(new a = 0; a < 33; a++) votecontroller[a][1] = 0 if(st_vote == 1){ st_vote = 0 client_print(0,print_chat,"[AMXX] Voting sucessfully stopped.") return PLUGIN_HANDLED } new best = 0 new best_count = 0 for(new a = 0; a < 4; ++a) { if (option[a] > best_count){ best_count = option[a] best = a } } if(best == 0){ switch(team[0]){ case 0: { fx_kill(players1[0]) fx_kill(players2[0]) } case 1: { fx_kill(players1[0]) } case 2: { fx_kill(players2[0]) } } client_print(0,print_chat,"[AMXX] Voting over ... kill player to get to new round faster wins.") set_hudmessage(63,187,239, -1.0, 5.70, 2, 0.02, 10.0, 0.01, 0.1, 9) show_hudmessage(0,"Vote over.^nKill player to hurry round up wins.^n^n%d votes for kill to get new round^n%d votes for to let them play^n^n%d Total eligible voters", option[0],option[1],totalvoters) log_amx("World triggered ^"voting_success hurryup kill for new round^"") }else{ client_print(0,print_chat,"[AMXX] Voting over ... we will let them continue to play.") set_hudmessage(63,187,239, -1.0, 0.70, 2, 0.02, 10.0, 0.01, 0.1, 2) show_hudmessage(0,"Vote over.^nWe will continue to let them play.^n^n%d votes for kill to get new round^n%d votes for to let them play^n^n%d Total eligible voters", option[0],option[1],totalvoters) log_amx("World triggered ^"voting_success hurryup let them play^"") } return PLUGIN_HANDLED }
public bot_voteinterface(){ new arg1[8],arg2[8] read_argv(1,arg1,7) read_argv(2,arg2,7) new id = str_to_num(arg1) new key = str_to_num(arg2) - 1 vote_count(id,key) return PLUGIN_CONTINUE }
public vote_count(id,key){ ejl_vault("READ","CURRENT_VOTE","") if(equal(vault_value,"HURRYUPVOTE")){ new name[32] get_user_name(id,name,31) if(votenumber != votecontroller[id][0]){ votecontroller[id][0] = votenumber if (get_cvar_float("amx_vote_answers")) { client_print(0,print_chat,"[AMXX] %s voted for option # %d",name,key+1) } option[key] += 1 }else{ votecontroller[id][1] +=1 } }else{ return PLUGIN_CONTINUE } return PLUGIN_HANDLED }
public stopvote(id,level,cid){ if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
if(bVoteToStop == true){ new name[32] get_user_name(id,name,32) st_vote = 1 client_print(id,print_console,"[AMXX] ADMIN !!! Ignore the unknown command message -- its ok") client_print(0,print_chat,"[AMXX] %s has disabled the vote in progress.",name) } return PLUGIN_CONTINUE }
public plugin_log(){ new args = read_logargc() if(args == 2){ new msg[32] read_logargv(1,msg,31) if(msg[6] == 'S') round_start() } return PLUGIN_CONTINUE }
round_start(){ onepass = false votedoneround = false new maxpl = get_maxplayers()+1 for (new a=1; a<maxpl; a++){ if( (is_user_connected(a) == 1) && (wasbomb[a] == 1) ){ set_user_rendering(a,kRenderFxNone,255,255,255, kRenderNormal,16) wasbomb[a] = 0 } } if(bVoteToStop == true) st_vote = 1 }
public plugin_precache() { gibs = precache_model("models/hgibs.mdl") boom = precache_model("sprites/zerogxplode.spr") precache_sound("misc/hurryup.wav") return PLUGIN_CONTINUE }
public plugin_init(){ register_plugin("CS Hurry up and die","1.2","EJL") register_concmd("amx_hurryup","admin_hu",ADMIN_LEVEL_H,": toggles hurry up mode on and off") register_concmd("stopvote","stopvote",ADMIN_MAP,"stops vote in progress") register_srvcmd("bot_votesfor","bot_voteinterface") register_cvar("amx_hurryup_mode","1") set_cvar_string("amx_hurryup_mode ","1") register_cvar("amx_hurryup_minplayers","6") set_cvar_string("amx_hurryup_minplayers","6") register_cvar("amx_hurryup_interval", "10.0") set_cvar_string("amx_hurryup_interval","10.0") register_menucmd(register_menuid("One left on a team... ") ,(1<<0)|(1<<1),"vote_count") register_cvar("amx_vote_time","15") register_cvar("amx_vote_answers","1") register_cvar("amx_vote_delay", "1") register_cvar("amx_last_voting","0") register_cvar("amx_vote_inprogress","0") set_task(2.0,"delay_start") return PLUGIN_CONTINUE }
public delay_start(){ set_task(get_cvar_float("amx_hurryup_interval"),"chk_players",14435,"",0,"b") return PLUGIN_CONTINUE }
public ejl_vault(rw[],key[],value[]){ new data[192] new stxtsize = 0 new line = 0 new skip = 0 new vkey[64] new vvalue[128] new vaultwrite[192] new vaultfile[64] get_basedir(vaultfile, 63) format(vaultfile, 63, "%s/config/elj_hurryup.ini", vaultfile) if(equal(rw,"READ")){ if(file_exists(vaultfile) == 1){ copy(vault_value,128,"") while((line=read_file(vaultfile,line,data,192,stxtsize))!=0){ parse(data,vkey,64,vvalue,128) if(equal(vkey,key)){ copy(vault_value,128,vvalue) } } }else{ write_file(vaultfile, "**** Plugins use to store values -- immune to crashes and map changes **** Hurry-up ****", 0) } } else if(equal(rw,"WRITE")){ if(file_exists(vaultfile) == 1){ format(vaultwrite,192,"%s %s",key,value) while((line=read_file(vaultfile,line,data,192,stxtsize))!=0){ parse(data,vkey,64,vvalue,128) if(skip == 0){ if( (equal(data,"")) || (equal(vkey,key)) ){ skip = 1 write_file(vaultfile,vaultwrite,line-1) } } else if(equal(vkey,key)){ write_file(vaultfile,"",line-1) } } if(skip == 0){ write_file(vaultfile,vaultwrite,-1) } } } return PLUGIN_CONTINUE } вот тут нужно сделать чтобы для Tероров плагby вообще как бы не работал, только для CT. пробывал уже там везде лепить && get_user_team(0) == 2 , но ничего кроме глюков не получилось
|
|
| |