Valaki megnézné,hogy mi lehet ezzel a baj? Ha igenre vagy nemre megyek,a szavazást mindenféleképpen nem-nek számítja.SMA:
Kód:
#include <amxmod>
#include <amxmisc>
#include <colorchat>
new votefor = 0
new Float:vote_ratio
public restart_round(time[])
{
server_cmd("sv_restartround %s",time)
return PLUGIN_CONTINUE
}
public delay_msg() {
set_hudmessage(0, 255, 255, -1.0, 0.35, 1, 2.0, 6.0, 0.8, 0.8, 1)
show_hudmessage(0,"- HARC -")
return PLUGIN_CONTINUE
}
public check_votes() {
new players[32],inum
get_players(players,inum,"c")
new Float:voteresult = inum ? (float(votefor) / float(inum)) : 0.0
if (voteresult<vote_ratio){
ColorChat(0, GREEN,"^x01* ^x03Kor ujrainditas szavazas ^x04sikertelen. ^x01(^x03igen: ^x04^"%d^"^x01) (^x03nem: ^x04^"%d^"^x01) (^x03szukseges: ^x04^"%.2f^"^x01)",votefor,inum-votefor,vote_ratio)
return PLUGIN_HANDLED
}
set_task(2.0,"restart_round",0,"1",1)
set_task(4.0,"restart_round",0,"1",1)
set_task(6.0,"restart_round",0,"3",1)
set_task(12.0,"delay_msg")
ColorChat(0, GREEN, "^x01* ^x03Kor ujrainditas szavazas ^x04sikeres. ^x01(^x03arany: ^x04^"%.2f^"^x01) (^x03szukseges: ^x04^"%.2f^"^x01)",voteresult,vote_ratio)
ColorChat(0, GREEN, "^x01* Kor ujrainditas 3-szor...")
return PLUGIN_HANDLED
}
public count_votes(id,key){
new name[32]
get_user_name(id,name,31)
ColorChat(0, GREEN, "^x01* ^x03%s ^x01szavazata ^x04%s",name,key ? "against" : "for")
if (!key) ++votefor
return PLUGIN_HANDLED
}
public voterr(id,level,cid) {
new Float:voting = get_cvar_float("amx_last_voting")
if (voting > get_gametime()){
ColorChat(id, GREEN, "^x01* ^x03Mar inditott valaki ^x04szavazast^x03...")
return PLUGIN_HANDLED
}
if (voting && voting + get_cvar_float("amx_voterr_delay") > get_gametime()) {
ColorChat(id, GREEN, "^x01* ^x03Jelenleg nem lehet ^x04restart szavazast inditani^x01.")
return PLUGIN_HANDLED
}
new msg[256]
new keys = (1<<0)|(1<<1)
format(msg,255,"Szeretnel kor ujrainditast?^n^n1. Igen^n2. Nem")
new Float:vote_time = get_cvar_float("amx_voterr_time") + 2.0
set_cvar_float("amx_last_voting", get_gametime() + vote_time)
vote_ratio = get_cvar_float("amx_voterr_ratio")
show_menu(0,keys,msg,floatround(vote_time))
set_task(vote_time,"check_votes")
ColorChat(id, GREEN, "^x01* ^x03Kor ujrainditas szavazas ^x04megkezdodott^x03...")
votefor = 0
return PLUGIN_HANDLED
}
public plugin_init() {
register_plugin("AMX Public Restart Round Vote","1.0","Marach")
register_menucmd(register_menuid("Restart round?") ,(1<<0)|(1<<1),"count_votes")
register_clcmd("say voterr","voterr",0,"- starts a vote to restart round")
register_clcmd("say_team voterr","voterr",0,"- starts a vote to restart round")
register_cvar("amx_voterr_delay","60")
register_cvar("amx_voterr_time","10")
register_cvar("amx_voterr_ratio","0.60")
register_cvar("amx_last_voting","0")
set_cvar_float("amx_last_voting",0.0)
}