i need help with this i got this code for voting when i used search to see if there was a voting tutorial but anyway im trying to make a vote that only i can start and if sucessful it kicks the certain person like amx_vote_stfu (player name) and right now im getting compiling errors and even if i didnt i have a feeling it wouldnt work
Code:
/* amx_stfu - Nik
* v1.0- made plugin usable to quit players steam
* v2.0- prints who got kicked
* v3.0- added vote for kick*/
#include <amxmodx>
#include <amxmisc>
new PLUGIN[]="amx_stfu"
new VERSION[]="3.0"
new AUTHOR[]="Nik"
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_concmd("amx_stfu", "Quit", ADMIN_IMMUNITY, "<auth, name, or id> -Forces player to quit")
register_concmd("amx_vote_stfu", "cmdvotestfu", ADMIN_IMMUNITY, "<auth, name, or id> - make a vote for quit")
return PLUGIN_CONTINUE
}
public Quit(id,level,cid) {
if(!cmd_access(id,level,cid,1))
return PLUGIN_HANDLED
new arg[32]
read_argv(1, arg, 31)
new player = cmd_target(id, arg, 2)
if(player != 0) client_cmd(player, "quit")
new authid[32], authid2[32],name[32],name2[32]
get_user_authid(id,authid,31)
get_user_authid(player,authid2,31)
get_user_name(id,name,31)
get_user_name(player,name2,31)
switch (get_cvar_num("amx_show_activity")) {
case 2: client_print(0,print_chat,"%s made %s stfu and leave",name,name2)
case 1: client_print(0,print_chat,"%s stfu and left",name2)
}
return PLUGIN_HANDLED
}
public cmdvotestfu(id){
new float:voting = get_cvar_float("amx_last_voting")
if (voting > get_gametime()){
client_print(id,print_chat,("A vote is already in session")
return PLUGIN_HANDLED
}
if (voting && voting + get_cvar_float("amx_vote_delay")> get_gametime()){
client_print(id,print_chat,("You must wait to vote again")
return PLUGIN_HANDLED
}
new menu_msg[256]
new name[32]
format(menu_msg,255,"Make %s stfu?^n^n1. yes^n2. no")
new float:votetime = get_cvar_float("amx_vote_time") + 10.0
get_user_info(id, "name",name,31)
set_cvar_float("amx_last_voting", get_gametime() + votetime)
show_menu(0,(1<<0)|(1<<1),menu_msg,floatround(votetime))
set_task(votetime,"check_stfu_votes")
client_print(0,print_chat,"Voting Started")
choice[0]=choice[1]=0
return PLUGIN_HANDLED
}
public count_stfuvotes(id,key){
if(get_cvar_float("amx_vote_answers")){
new name[32]
get_user_name(id,name,31)
client_print(0,print_chat,"%s voted %s", name,key ? "against" : "for")
}
++choice[key]
return PLUGIN_HANDLED
}
public check_stfu_votes(id){
if (choice[0] > choice[1]){
console_cmd("Quit")
client_print(0,print_chat,"Voting successful (yes ^"%d^") (no ^"%d^").",choice[0],choice[1])
} else {
client_print(0,print_chat,"Voting Unsuccessful (yes ^"%d^") (no ^"d%^").".choice[0],choice[1])
}
return PLUGIN_CONTINUE
}