Soo
Ich habe die adminvote.sma umgeändert wie befohlen
Hier ist die
/* AMX Mod script.
*
* (c) Copyright 2002, OLO
* This file is provided as is (no warranties).
*
*/
#include <amxmod>
#include <amxmisc>
/*
* vote for changing the level:
* amx_votemap < map > [ map ]
* examples:
* amx_votemap "de_dust"
* amx_votemap "de_dust" "de_dust2" "cs_italy"
*
* vote for kicking the player:
* amx_votekick < part of nick >
* examples:
* amx_votekick "Man"
*
* vote for banning and kicking the player for 30 minutes:
* amx_voteban < part of nick >
* examples:
* amx_voteban "Man"
*
* custom voting:
* amx_vote < question > < answer1 > < answer2 >
* examples:
* amx_vote "sv_restart" "5" "0"
* amx_vote "mp_timelimit" "20" "45"
* amx_vote "are you hungry?" "yes" "no"
*
*/
new bool:cstrike_running
new answer[128]
new option_name[4][32]
new option[4]
new valid_maps = 0
new Float:vote_ratio
new yesnovote
new bool:executeresult
new logfilename[256]
public delay_action(cmd[])
server_cmd(cmd)
public check_votes() {
new players[32], inum, best = 0
get_players(players,inum,"c")
for(new a = 0; a < 4; ++a)
if (option[a] > option[best])
best = a
new Float:result_v = inum ? (float(option[best]) / float(inum)) : 0.0
if (result_v<vote_ratio){client_cmd(id,"spk misc/votefailed")
if (yesnovote)
client_print(0,print_chat,"* Voting failed (yes ^"%d^") (no ^"%d^") (needed ^"%.2f^")",
option[0], inum-option[0] ,vote_ratio)
else
client_print(0,print_chat,"* Voting failed (ratio ^"%.2f^") (needed ^"%.2f^")",
result_v, vote_ratio)
log_to_file(logfilename,"Vote: Voting failed (ratio ^"%.2f^") (needed ^"%.2f^")",
result_v, vote_ratio)
return PLUGIN_HANDLED
}
new execute[256]client_cmd(id,"spk misc/votepast")
new len = format(execute,255,answer,option_name[best])
if (executeresult){
executeresult = false
set_task(2.0,"delay_action",0,execute,len + 1)
}
client_print(0,print_chat,"* Voting successful (ratio ^"%.2f^") (needed ^"%.2f^"). The result: %s",
result_v,vote_ratio,execute)
log_to_file(logfilename,"Vote: Voting successful (ratio ^"%.2f^") (needed ^"%.2f^") (result ^"%s^")",
result_v,vote_ratio,execute)
return PLUGIN_HANDLED
}
public vote_count(id,key){
if (get_cvar_float("amx_vote_answers")) {
new name[32]
get_user_name(id,name,31)
if (yesnovote)
client_print(0,print_chat,"* %s voted %s",name,key ? "against" : "for" )
else
client_print(0,print_chat,"* %s voted for option #%d",name,key+1)
}
if (yesnovote){
if (!key) ++option[key]
}
else
++option[key]
return PLUGIN_HANDLED
}
public admin_votemap(id,level,cid) {
if (!cmd_access(id,level,cid,2))
return PLUGIN_HANDLED
new Float:voting = get_cvar_float("amx_last_voting")
if (voting > get_gametime()){
console_print(id,"There is already one voting...")
return PLUGIN_HANDLED
}
if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime()) {
console_print(id,"Voting not allowed at this time")
return PLUGIN_HANDLED
}
new argc = read_argc()
if (argc > 5)
argc = 5
valid_maps = 0
option_name[0][0] = option_name[1][0] = option_name[2][0] = option_name[3][0] = 0
for(new i = 1; i < argc; ++i){
read_argv(i,option_name[valid_maps],31)
if (is_map_valid(option_name[valid_maps]))
valid_maps++;
}
if (valid_maps == 0) {
console_print(id,"Given %s not valid",(argc==2)?"map is":"maps are")
return PLUGIN_HANDLED
}
new menu_msg[256]
new keys = 0
if (valid_maps > 1){
keys = (1<<9)
if(cstrike_running)
copy(menu_msg,255,"\yAMX Choose map \w^n^n")
else
copy(menu_msg,255,"AMX Choose map ^n^n")
new temp[128]
for(new a = 0; a < valid_maps; ++a){
format(temp,127,"%d. %s^n",a+1,option_name[a])
add(menu_msg,255,temp)
keys |= (1<<a)
}
add(menu_msg,255,"^n0. None")
yesnovote = 0
}
else{
if(cstrike_running)
format(menu_msg,255,"\yAMX Change map to %s?\w^n^n1. Yes^n2. No",option_name[0])
else
format(menu_msg,255,"AMX Change map to %s?^n^n1. Yes^n2. No",option_name[0])
keys = (1<<0)|(1<<1)
yesnovote = 1
}
new authid[16],name[32]
get_user_authid(id,authid,15)
get_user_name(id,name,31)
if (argc==2)
log_to_file(logfilename,"Vote: ^"%s<%d><%s><>^" vote map (map ^"%s^")",
name,get_user_userid(id),authid,option_name[0])
else
log_to_file(logfilename,"Vote: ^"%s<%d><%s><>^" vote maps (map#1 ^"%s^") (map#2 ^"%s^") (map#3 ^"%s^") (map#4 ^"%s^")",
name,get_user_userid(id),authid,option_name[0],option_name[1],option_name[2],option_name[3])
switch(get_cvar_num("amx_show_activity")) {
case 2: client_print(0,print_chat,"%s %s: vote map(s)",name,
(get_user_flags(id) & ADMIN_USER) ? "PLAYER" : "ADMIN")
case 1: client_print(0,print_chat,"%s: vote map(s)",
(get_user_flags(id) & ADMIN_USER) ? "PLAYER" : "ADMIN")
}
executeresult = true
new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0
set_cvar_float("amx_last_voting", get_gametime() + vote_time )
vote_ratio = get_cvar_float("amx_votemap_ratio")
copy(answer,127,"changelevel %s")
show_menu(0,keys,menu_msg,floatround(vote_time))
set_task(vote_time,"check_votes")
console_print(id,"Voting has started...")client_cmd(id,"spk misc/votenow")
for(new j=0;j<4;++j)option[j]=0
return PLUGIN_HANDLED
}
public admin_vote(id,level,cid) {
if (!cmd_access(id,level,cid,4))
return PLUGIN_HANDLED
new Float:voting = get_cvar_float("amx_last_voting")
if (voting > get_gametime()){
console_print(id,"There is already one voting...")
return PLUGIN_HANDLED
}
if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime()) {
console_print(id,"Voting not allowed at this time")
return PLUGIN_HANDLED
}
new quest[48]
read_argv(1,quest,47)
if ((contain(quest,"sv_password")!=-1)||(contain(quest,"rcon_password")!=-1)||
(contain(quest,"kick")!=-1)||(contain(quest,"addip")!=-1)||(contain(quest,"ban")!=-1)){
console_print(id,"Voting for that has been forbidden")
return PLUGIN_HANDLED
}
read_argv(2,option_name[0],31)
read_argv(3,option_name[1],31)
new authid[16],name[32]
get_user_authid(id,authid,15)
get_user_name(id,name,31)
log_to_file(logfilename,"Vote: ^"%s<%d><%s><>^" vote custom (question ^"%s^") (option#1 ^"%s^") (option#2 ^"%s^")",
name,get_user_userid(id),authid,quest,option_name[0],option_name[1])
switch(get_cvar_num("amx_show_activity")) {
case 2: client_print(0,print_chat,"%s %s: vote custom",
(get_user_flags(id) & ADMIN_USER) ? "PLAYER" : "ADMIN",name )
case 1: client_print(0,print_chat,"%s: vote custom",
(get_user_flags(id) & ADMIN_USER) ? "PLAYER" : "ADMIN")
}
new menu_msg[256]
new keys = (1<<0)|(1<<1)
if(cstrike_running)
format(menu_msg,255,"\yAMX Vote: %s?\w^n^n1. %s^n2. %s",quest,option_name[0],option_name[1])
else
format(menu_msg,255,"AMX Vote: %s?^n^n1. %s^n2. %s",quest,option_name[0],option_name[1])
executeresult = false
new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0
set_cvar_float("amx_last_voting", get_gametime() + vote_time )
vote_ratio = get_cvar_float("amx_vote_ratio")
format(answer,127,"%s %%s",quest)
show_menu(0,keys,menu_msg,floatround(vote_time))
set_task(vote_time,"check_votes")
console_print(id,"Voting has started...")client_cmd(id,"spk misc/votenow")
for(new j=0;j<4;++j)option[j]=0
yesnovote = 0
return PLUGIN_HANDLED
}
public admin_votekickban(id,level,cid) {
if (!cmd_access(id,level,cid,2))
return PLUGIN_HANDLED
new Float:voting = get_cvar_float("amx_last_voting")
if (voting > get_gametime()){
console_print(id,"There is already one voting...")
return PLUGIN_HANDLED
}
if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime()) {
console_print(id,"Voting not allowed at this time")
return PLUGIN_HANDLED
}
new cmd[32]
read_argv(0,cmd,31)
new voteban = equal(cmd,"amx_voteban") ? 1 : 0
new arg[32]
read_argv(1,arg,31)
new player = cmd_target(id,arg,1)
if (!player) return PLUGIN_HANDLED
if (voteban && is_user_bot(player)) {
new imname[32]
get_user_name(player,imname,31)
console_print(id,"That action can't be performed on bot ^"%s^"",imname)
return PLUGIN_HANDLED
}
new keys = (1<<0)|(1<<1)
new menu_msg[256]
get_user_name(player,arg,31)
if(cstrike_running)
format(menu_msg,255,"\yAMX %s %s?\w^n^n1. Yes^n2. No", voteban ? "Ban" : "Kick", arg)
else
format(menu_msg,255,"AMX %s %s?^n^n1. Yes^n2. No", voteban ? "Ban" : "Kick", arg)
yesnovote = 1
if (voteban)
get_user_authid(player,option_name[0],31)
else
num_to_str(get_user_userid(player),option_name[0],31)
new authid[16],name[32]
get_user_authid(id,authid,15)
get_user_name(id,name,31)
log_to_file(logfilename,"Vote: ^"%s<%d><%s><>^" vote %s (target ^"%s^")",
name,get_user_userid(id),authid,voteban ? "ban" : "kick",arg)
switch(get_cvar_num("amx_show_activity")) {
case 2: client_print(0,print_chat,"%s %s: vote %s for %s",
(get_user_flags(id) & ADMIN_USER) ? "PLAYER" : "ADMIN",name,voteban ? "ban" : "kick",arg )
case 1: client_print(0,print_chat,"%s: vote %s for %s",
(get_user_flags(id) & ADMIN_USER) ? "PLAYER" : "ADMIN",voteban ? "ban" : "kick",arg)
}
executeresult = true
new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0
set_cvar_float("amx_last_voting", get_gametime() + vote_time )
vote_ratio = get_cvar_float(voteban ? "amx_voteban_ratio" : "amx_votekick_ratio")
copy(answer,127, voteban ? "banid 30.0 %s kick" : "kick #%s")
show_menu(0,keys,menu_msg,floatround(vote_time))
set_task(vote_time,"check_votes")
console_print(id,"Voting has started...")client_cmd(id,"spk misc/votenow")
for(new j=0;j<4;++j)option[j]=0
return PLUGIN_HANDLED
}
public plugin_init() {
register_plugin("Admin Votes","0.9.2","default")
register_menucmd(register_menuid("AMX Change map to ") ,(1<<0)|(1<<1),"vote_count")
register_menucmd(register_menuid("AMX Choose map ") ,(1<<0)|(1<<1)|(1<<2)|(1<<3),"vote_count")
register_menucmd(register_menuid("AMX Kick ") ,(1<<0)|(1<<1),"vote_count")
register_menucmd(register_menuid("AMX Ban ") ,(1<<0)|(1<<1),"vote_count")
register_menucmd(register_menuid("AMX Vote: ") ,(1<<0)|(1<<1),"vote_count")
register_concmd("amx_votemap","admin_votemap",ADMIN_VOTE,"<map> [map] [map] [map]")
register_concmd("amx_votekick","admin_votekickban",ADMIN_VOTE,"<authid, nick or #userid>")
register_concmd("amx_voteban","admin_votekickban",ADMIN_VOTE,"<authid, nick or #userid>")
register_concmd("amx_vote","admin_vote",ADMIN_VOTE,"<question> <answer#1> <answer#2>")
register_cvar("amx_votekick_ratio","0.40")
register_cvar("amx_voteban_ratio","0.40")
register_cvar("amx_votemap_ratio","0.40")
register_cvar("amx_vote_ratio","0.02")
register_cvar("amx_vote_time","10")
register_cvar("amx_vote_answers","1")
register_cvar("amx_vote_delay","60")
register_cvar("amx_last_voting","0")
set_cvar_float("amx_last_voting",0.0)
register_cvar("amx_show_activity","2")
new mod_name[32]
get_modname(mod_name,31)
cstrike_running = equal(mod_name,"cstrike") ? true : false
get_time("addons/amx/logs/admin%m%d.log",logfilename,255)
return PLUGIN_CONTINUE
}
Und dann habe ich einmal sc.bat ausgeführt!
Dann bin ich in denn Compiled ordner gegangen und da war keine adminvote.amx datei....!
Und was soll ich in den .res dateien reinschribbeln? denn pfad zu denn votenow,votepassed und votefailed?
Grez Star