AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Can someone help me create a vote plugin. (https://forums.alliedmods.net/showthread.php?t=12817)

-D|H-Maverick 04-25-2005 18:51

Can someone help me create a vote plugin.
 
I want to create a plugin that can toggle axn_bunnyjump with a vote. I am relatively new to AMXX coding so I might make some mistakes.

I started with the commands I wanted
Code:

public plugin_init() {
    register_plugin("Vote Bhop","0.1","Maverick")
    register_cvar("amx_votebhopon","1")
    register_concmd("amx_votebhop","cmdvotebhop",ADMIN_VOTE,"Votes to toggle bhop")
    register_clcmd("say votebhop","cmdclvotebhop",0,"Votes to toggle bhop")
}

Then, I wanted to make it so if cvar amx_votebhopon = 0, clients couldnt vote. I thought it through and started from a number of different way, but I kept getting stuck.

Then theres the part of making the vote, vote ratios, TOGGLING axn_bunnjump from "0" to "1" depending on the current setting, and a lot more.

I've looked through scripts, examples, other vote plugins, and tutorials and have found nothing to help me. If you want, you could finish the plugin for me and take credit, and I'll look through it and see what you did, or you could tell me how to.

Also, if there is a plugin like this out there (exactly or very close so that I could change the vote), that would also be good to know. I did at least six searches and couldn't find anything related to what I want.

n0obie4life 04-26-2005 02:39

Re: Can someone help me create a vote plugin.
 
Quote:

Originally Posted by -D|H-Maverick
I want to create a plugin that can toggle axn_bunnyjump with a vote. I am relatively new to AMXX coding so I might make some mistakes.

I started with the commands I wanted
Code:

public plugin_init() {
    register_plugin("Vote Bhop","0.1","Maverick")
    register_cvar("amx_votebhopon","1")
    register_concmd("amx_votebhop","cmdvotebhop",ADMIN_VOTE,"Votes to toggle bhop")
    register_clcmd("say votebhop","cmdclvotebhop",0,"Votes to toggle bhop")
}

Then, I wanted to make it so if cvar amx_votebhopon = 0, clients couldnt vote. I thought it through and started from a number of different way, but I kept getting stuck.

Then theres the part of making the vote, vote ratios, TOGGLING axn_bunnjump from "0" to "1" depending on the current setting, and a lot more.

I've looked through scripts, examples, other vote plugins, and tutorials and have found nothing to help me. If you want, you could finish the plugin for me and take credit, and I'll look through it and see what you did, or you could tell me how to.

Also, if there is a plugin like this out there (exactly or very close so that I could change the vote), that would also be good to know. I did at least six searches and couldn't find anything related to what I want.

err, no problem :D. i'll get on it then release it to YOU only. unless its requested again and again.

n0obie4life 04-26-2005 05:54

nvm i'll share ma script with u :D.

Code:
 public cmdvotepara(id){     new Float:voting = get_cvar_float("amx_last_voting")     if (voting > get_gametime()){         client_print(id,print_chat,"*A vote has already been cast.*")         return PLUGIN_HANDLED     }     if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime()) {         client_print(id,print_chat,"*Please wait a while before you can vote again.*")         return PLUGIN_HANDLED     }     new menu_msg[256]     new name[32]     format(menu_msg,255," Do you want Para Only?^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_the_para_votes")     client_print(0,print_chat,"*Voting has started.*")     choice[0]=choice[1]=0     return PLUGIN_HANDLED  }  public count_paravotes(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 para only" : "for para only" )     }     ++choice[key]     return PLUGIN_HANDLED  }  public check_the_para_votes(id){     if (choice[0] > choice[1]){         server_cmd("amx_para 1")         client_print(0,print_chat,"* Votes For Para Only Succeded (yes ^"%d^") (no ^"%d^"). *",choice[0],choice[1])         } else {         server_cmd("amx_para 0")         client_print(0,print_chat,"* Votes Against Para Only Succeded (yes ^"%d^") (no ^"%d^"). *",choice[0],choice[1])     }     return PLUGIN_CONTINUE  }

just make the nesscary edits. mine doens't have an admin vote, so what you have to do is copy the whole of this section "cmdvotepara" and edit to admin voting.


All times are GMT -4. The time now is 16:43.

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