i tried that and it works, but i don't unerstand why won't it work for my plugin.
Code:
/******************************Knifes*****************************************/
public cmdknives(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")){
knifeonly = 1
client_cmd(id,"weapon_knife")
console_print(id,"%L",LANG_PLAYER,"KNIVES_TURNED_ON")
client_print(0, print_chat,"%L",LANG_PLAYER, "KNIVES_TURNED_ON")
show_hudmessage(0,"%L",LANG_PLAYER,"KNIVES_ENABLED_HUD")
} else if(equal(arg, "0")){
knifeonly = 0
console_print(id,"%L",LANG_PLAYER,"KNIVES_TURNED_OFF")
client_print(0, print_chat,"%L",LANG_PLAYER, "KNIVES_TURNED_OFF")
show_hudmessage(0,"%L",LANG_PLAYER,"KNIVES_DISABLED_HUD")
}
return PLUGIN_HANDLED
}
public knivesgun(id){
if(knifeonly==0){
//nothing
}
if(knifeonly==1){
new clip, ammo
new usersweapon = get_user_weapon(id,clip,ammo)
if(usersweapon==CSW_KNIFE || usersweapon == CSW_C4 && get_cvar_num("vote_allowc4") == 1 ) {
//nothing
} else {
client_cmd(id,"weapon_knife")
}
}
return PLUGIN_CONTINUE
}
public cmdvoteknives(id){
if (get_cvar_num("vote_knivesvote") == 0 ) {
client_print(id,print_chat,"%L",LANG_PLAYER,"VOTE_KNIVES_DISABLED"); }
else if (get_cvar_num ("vote_knivesvote") == 1 ) {
new Float:voting = get_cvar_float("amx_last_voting")
if (voting > get_gametime()){
client_print(id,print_chat,"%L",LANG_PLAYER,"VOTE_CASTED")
return PLUGIN_HANDLED
}
if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime()) {
client_print(id,print_chat,"%L",LANG_PLAYER,"VOTE_WAIT")
return PLUGIN_HANDLED
}
new menu_msg[256]
new name[32]
format(menu_msg,255,"%L",LANG_PLAYER,"VOTE_KNIVES")
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_knife_votes")
client_print(0,print_chat,"%L",LANG_PLAYER,"VOTE_STARTED")
choice[0]=choice[1]=0
}
return PLUGIN_HANDLED
}
public count_knivesvotes(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 knives only" : "for knives only" )
}
++choice[key]
return PLUGIN_HANDLED
}
public check_the_knife_votes(id){
if (choice[0] > choice[1]){
server_cmd("amx_knives 1")
client_print(0,print_chat,"%L",LANG_PLAYER,"VOTE_SUCEED_KNIVES",choice[0],choice[1])
} else {
server_cmd("amx_knives 0")
client_print(0,print_chat,"%L",LANG_PLAYER,"VOTE_FAILED_KNIVES",choice[0],choice[1])
}
return PLUGIN_HANDLED
}
/******************************AWP*****************************************/
public event_RoundStart_awp() {
if(awponly==0){
//nothing
}
if(awponly==1){
for(new p = 0; p < 32; p++) {
if(is_user_alive(p)) {
give_item(p, "weapon_awp")
give_item(p, "ammo_338magnum")
give_item(p, "ammo_338magnum")
give_item(p, "ammo_338magnum")
}
}
}
return PLUGIN_HANDLED
}
public cmdawp(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")){
awponly = 1
client_cmd(id,"weapon_knife")
console_print(id,"%L",LANG_PLAYER,"AWP_TURNED_ON")
client_print(0, print_chat,"%L",LANG_PLAYER, "AWP_TURNED_ON")
show_hudmessage(0,"%L",LANG_PLAYER,"AWP_ENABLED_HUD")
} else if(equal(arg, "0")){
awponly = 0
console_print(id,"%L",LANG_PLAYER,"AWP_TURNED_OFF")
client_print(0, print_chat,"%L",LANG_PLAYER, "AWP_TURNED_OFF")
show_hudmessage(0,"%L",LANG_PLAYER,"AWP_DISABLED_HUD")
}
return PLUGIN_HANDLED
}
public awpgun(id){
if(awponly==0){
//nothing
}
if(awponly==1){
new clip, ammo
new usersweapon = get_user_weapon(id,clip,ammo)
if(usersweapon==CSW_KNIFE || usersweapon == CSW_C4 && get_cvar_num("vote_allowc4") == 1 || usersweapon == CSW_AWP ) {
//nothing
} else {
client_cmd(id,"weapon_knife")
}
}
return PLUGIN_CONTINUE
}
public cmdvoteawp(id){
if (get_cvar_num("vote_awpvote") == 0 ) {
client_print(id,print_chat,"%L",LANG_PLAYER,"VOTE_AWP_DISABLED"); }
else if (get_cvar_num ("vote_awpvote") == 1 ) {
new Float:voting = get_cvar_float("amx_last_voting")
if (voting > get_gametime()){
client_print(id,print_chat,"%L",LANG_PLAYER,"VOTE_CASTED")
return PLUGIN_HANDLED
}
if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime()) {
client_print(id,print_chat,"%L",LANG_PLAYER,"VOTE_WAIT")
return PLUGIN_HANDLED
}
new menu_msg[256]
new name[32]
format(menu_msg,255,"%L",LANG_PLAYER,"VOTE_AWP")
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_awp_votes")
client_print(0,print_chat,"%L",LANG_PLAYER,"VOTE_STARTED")
choice[0]=choice[1]=0
}
return PLUGIN_HANDLED
}
public count_awpvotes(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 AWP only" : "for AWP only" )
}
++choice[key]
return PLUGIN_HANDLED
}
public check_the_awp_votes(id){
if (choice[0] > choice[1]){
server_cmd("amx_awp 1")
client_print(0,print_chat,"%L",LANG_PLAYER,"VOTE_SUCEED_AWP",choice[0],choice[1])
} else {
server_cmd("amx_awp 0")
client_print(0,print_chat,"%L",LANG_PLAYER,"VOTE_FAILED_AWP",choice[0],choice[1])
}
return PLUGIN_HANDLED
}