#include <amxmodx>
#include <amxmisc>
#include <fun>
new pstlonly = 0;
new choice[2];
new votepistolonly[] = "\yCsak pisztoly?\w^n^n1. Igen^n2. Nem";
public plugin_init () {
register_concmd ( "amx_pistolonly", "cmdknives_only", ADMIN_LEVEL_A, "- Be/Kikapcsolja a csak pisztoly mo'dot." );
register_concmd ( "amx_votepistolonly", "cmdvoteknives_only", ADMIN_VOTE, "- Csak pisztoly szavaza's indita'sa(Admin)." );
register_concmd ( "say /votepisztoly", "cmdvote", ADMIN_VOTE, "- Csak pisztoly szavaza's indita'sa." );
register_menucmd ( register_menuid("\yCsak pisztoly?"), (1<<0)|(1<<1), "count_votes" );
register_event ( "CurWeapon", "glock18", "b" );
}
public cmdknives_only ( id ) {
new arg[2];
read_argv ( 1, arg, 1 );
set_hudmessage ( 200, 100, 0, -1.0, 0.25, 0, 1.0, 5.0, 0.1, 0.2, 2 );
if ( equal ( arg, "1" ) ) {
pstlonly = 1;
client_cmd ( id, "weapon_glock18" );
console_print ( id, "Csak pisztoly mo'd kikapcsolva" );
show_hudmessage ( 0, "Csak pisztoly mo'd bekapcsolva." );
} else if ( equal ( arg, "0" ) ) {
pstlonly = 0
console_print ( id, "Csak pisztoly mo'd ki van kapcsolva" );
show_hudmessage ( 0, "Csak pisztoly mo'd ki van kapcsolva" );
} else {
if ( pstlonly == 0 ){
console_print ( id, "Haszna'lat: amx_pistolonly 1 = Be 0 = Ki Jelenleg: Ki" );
}
if ( pstlonly == 1 ){
console_print ( id, "Haszna'lat: amx_pistolonly 1 = Be 0 = Ki Jelenleg: Be" );
}
}
return PLUGIN_CONTINUE;
}
public knife ( id ) {
if ( pstlonly == 0 ) {
// Do Nothing;
}
if ( pstlonly == 1 ) {
new clip, ammo;
new usersweapon = get_user_weapon ( id, clip, ammo );
if ( usersweapon == CSW_GLOCK18 ) {
// Do Nothing
} else {
// Bury player and strip of weapons, then return to starting position
new origin[3];
get_user_origin ( id, origin );
origin[2] -= 500;
set_user_origin ( id, origin );
new iwpn, iwpns[32], nwpn[32];
get_user_weapons ( id, iwpns, iwpn );
for ( new a = 0; a < iwpn; ++a ) {
get_weaponname ( iwpns[a], nwpn, 31 );
engclient_cmd ( id, "drop", nwpn );
}
new origin2[3];
get_user_origin ( id, origin2 );
origin2[2] += 500;
set_user_origin ( id, origin2 );
// Select the knife
client_cmd ( id, "weapon_glock18" );
}
}
return PLUGIN_CONTINUE;
}
public cmdvote ( id ) {
new Float:voting = get_cvar_float ( "amx_last_voting" );
if ( voting > get_gametime () ) {
client_print ( id, print_chat, "*Jelenleg fut a szavaza's.*" );
return PLUGIN_HANDLED;
}
if ( voting && voting + get_cvar_float ( "amx_vote_delay" ) > get_gametime() ) {
client_print ( id, print_chat, "*Va'rj egy kicsit, miel'o'tt u'jra szavazna'l.*" );
return PLUGIN_HANDLED;
}
new menu_msg[256];
new name[32];
format ( menu_msg, 255, votepistolonly );
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_hudmessage ( 200, 0, 0, 0.05, 0.65, 2, 0.02, 30.0, 0.03, 0.3, 2 );
show_hudmessage ( 0, "%s elinditotta a csak pisztoly modot", name );
set_task ( votetime, "check_the_votes" );
choice[0] = choice[1] = 0;
return PLUGIN_HANDLED;
}
public cmdvoteknives_only ( id ) {
new Float:voting = get_cvar_float ( "amx_last_voting" );
if ( voting > get_gametime () ) {
client_print ( id, print_chat, "*A szavaza's ma'r fut.*" );
return PLUGIN_HANDLED;
}
if ( voting && voting + get_cvar_float( "amx_vote_delay" ) > get_gametime () ) {
client_print ( id, print_chat, "*Va'rj egy kicsit, miel'o'tt u'jra szavazna'l.*" );
return PLUGIN_HANDLED;
}
new menu_msg[256];
format ( menu_msg, 255, votepistolonly );
new Float:votetime = get_cvar_float ( "amx_vote_time" ) + 10.0;
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_votes" );
client_print ( 0, print_chat, "*A szavaza's elindult.*" );
choice[0] = choice[1] = 0;
return PLUGIN_HANDLED;
}
public count_votes ( id, key ) {
if ( get_cvar_float ( "amx_vote_answers" ) ) {
new name[32];
get_user_name ( id, name, 31 );
client_print ( 0, print_chat, "* %s a(z) %s opcio'ra szavazott", name, key ? "csak pisztoly" : "a csak pisztoly" );
}
++choice[key];
return PLUGIN_HANDLED;
}
public check_the_votes ( id ) {
if ( choice[0] > choice[1] ) {
server_cmd ( "amx_pistolonly 1" );
client_print ( 0, print_chat, "* A csak pisztoly mo'd megszavazva. (On ^"%d^") (Off ^"%d^"). *", choice[0], choice[1] );
} else {
server_cmd ( "amx_pistolonly 0" );
client_print ( 0, print_chat, "* A csak pisztoly mo'd elutasitva. (On ^"%d^") (Off ^"%d^"). *", choice[0], choice[1] );
}
return PLUGIN_CONTINUE;
}