AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   help with vote part in kick plugin (https://forums.alliedmods.net/showthread.php?t=57045)

AAleaderNik 06-26-2007 23:31

help with vote part in kick plugin
 
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 :(

heres the code

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
}

if you can please help me thanks in advance

kmal2t 06-27-2007 03:46

Re: help with vote part in kick plugin
 
Just restrict people's access to the j flag and it's the exact same thing. That or I'm pretty sure there are already existing plugins that can add more specific flags for certain commands such as amx_votekick.

AAleaderNik 06-27-2007 20:20

Re: help with vote part in kick plugin
 
ya either way it still doesnt compile any help would be much appreciated

kmal2t 06-28-2007 00:21

Re: help with vote part in kick plugin
 
Did you actually read what I said? You don't need to make a new plugin for this just use default amxx and disable an admins j flag access and its the same thing.

AAleaderNik 06-28-2007 00:51

Re: help with vote part in kick plugin
 
but if u read the code im not just kicking im makin them close steam default amxx doesnt do that

plus im tryin to learn scripting at the same time and just using other peoples stuff doesnt help me learn

AAleaderNik 06-28-2007 01:23

Re: help with vote part in kick plugin
 
Code:

/* amx_stfu - |.:A|A:.| 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[]="|.:A|A:.| 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 and leave?^n^n1. yes^n2. no",name)
        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")
        new option[2]
        option[0]=option[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")
        }
        ++option[key]
        return PLUGIN_HANDLED
}

public check_stfu_votes(id){
        if (option[0] > option[1]){
                console_cmd("Quit")
                client_print(0,print_chat,"Voting successful (yes ^"%d^") (no ^"%d^").",option[0],option[1])
                } else {
                client_print(0,print_chat,"Voting Unsuccessful (yes ^"%d^") (no ^"%d^").",option[0],option[1])
        }
        return PLUGIN_CONTINUE
}

k now im only down to line 72 error which is the ++option[key] line any ideas?


All times are GMT -4. The time now is 21:31.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.