AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Voting (https://forums.alliedmods.net/showthread.php?t=11058)

v3x 03-08-2005 19:12

Voting
 
Hey, can someone give me an example of a simple "Yes, No" vote?
IE: amx_votekick

tight2089 03-10-2005 21:59

amx_votei do stuff like isTHISmapGAY?? yes NOway

you have to keep the quiestion together otherwise the next word is going to be an answer.

or


amx_vote DESTINYlikesHISmom OHya NOway

and

amx_kick destiny yes no

stuff like so!! :D

XxAvalanchexX 03-10-2005 22:15

a) You can use parentheses in amx_vote: amx_vote "Is Catwoman hot?" "Ooh yea!" "No way!"

b) He was asking for Small code which lets him display his own vote menu.

v3x 03-11-2005 00:16

LOL, geez.. I know how to work a damn command!! I just want to know how the heck to code a simple one.

XxAvalanchexX 03-11-2005 00:45

Code:
#include <amxmodx> #include <amxmisc> // array of votes - votes[1] is yes and votes[0] is no new votes[2]; public plugin_init() {    register_plugin("Eargh!","0.10","Catwoman?!$4");    register_menucmd(register_menuid("voting"),1023,"voting_handler");    register_concmd("amx_dotehvote","cmd_dotehvote",ADMIN_VOTE,"- starts teh votez0rz!");    register_cvar("amx_vote_time","20.0"); } public cmd_dotehvote(id,level,cid) {    if(!cmd_access(id,level,cid,1)) {       return PLUGIN_HANDLED;    }    new menubody[128], keys;    format(menubody,127,"Do you like d00ds wit teh swurd?^n^n1. Yesergh^n2. Noes");    keys = MENU_KEY_1|MENU_KEY_2;    // player, keys, text, hold time, title    show_menu(id,keys,menubody,get_cvar_num("amx_vote_time"),"voting");    set_task(get_cvar_float("amx_vote_time"),"display_results");    return PLUGIN_HANDLED; } public voting_handler(id,key) {    // number they pressed -> key variable    // 1 -> 0    // 2 -> 1    // 3 -> 2    // ...    // 8 -> 7    // 9 -> 8    // 0 -> 9    // if they voted yes    if(key == 0) {       votes[0]++;    }    // if they voted no    if(key == 1) {       votes[1]++;    }    // if we should display their choices    if(get_cvar_num("amx_vote_answers")) {       new username[32];       get_user_name(id,username,31);       client_print(0,print_chat,"%s voted %s",username,(key == 0) ? "Yes" : "No");    } } public display_results() {    client_print(0,print_chat,"Voting results: %i Yes -- %i No",votes[0],votes[1]);    votes[0] = 0;    votes[1] = 0; }

v3x 03-11-2005 01:16

Nice, thanks.. One other small question to addon to this.. Say I wanted FF on or something, where would set_cvar_num("mp_friendlyfire",1) go if they voted yes?

XxAvalanchexX 03-11-2005 20:53

In display_results, you'd compare votes[0] (the yes's) to votes[1] (the no's) depending on how you want your ratio to work, and then you set friendlyfire to on or off.

Newbster 03-13-2005 22:08

What if i wanted it to vote 5 minutes before end of game? would set_task(30.0, "vote") work. (i changed name of function it would go to).

Newbster 03-13-2005 23:25

Scratch that, this is what i have
Code:

temp = float(get_cvar_num("mp_combattime")-5)
set_task(temp,"vote",9678,"",0,"b")

will this set the function "vote" to execute 5 mins before game ends?


All times are GMT -4. The time now is 13:59.

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