Raised This Month: $ Target: $400
 0% 

Knives Only not drop bomb


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
BoK | Krazy
Member
Join Date: Dec 2005
Location: Dayton, OH
Old 12-30-2005 , 15:36   Knives Only not drop bomb
Reply With Quote #1

I need help trying to recode this for my private use so that when knives only is on it does not drop the bomb. I have tried some stuff and had no luck. Usually i am pretty good with guess and checking.

Code:
/*********************************************************************
AMX Mod Script
Created by BillyTheKid
Test it first @ 69.31.7.140:27016
Knives Only
Version 0.7
Email = admin@madtechview

Commands -
amx_knivesonly <1|0> Default off

1 = on
0 = off

Client Command -
say /voteknivesonly
Starts a vote to turn knives Only On and off...


Description - This will force users to knife only
              If guns are drawn they will be dropped


BugFixes    - Added Admin Level Access to the amx_knivesonly Command
  		  and added vote Level Access for the /voteknivesonly

Added - 	  I added a command for voting instead of /voteknivesonly 
              an admin can do a amx_voteknivesonly

Thanks to Zaltoa @ [email protected]
I used his code as a template to make this one 
*********************************************************************/

#include <amxmodx>
#include <amxmisc>


new knifeonly = 0
new choice[2]
new voteknifesonly[] = "\yKnives Only?\w^n^n1. On^n2. Off"

public plugin_init(){
register_plugin("Knives Only","0.1","BillyTheKid")
register_concmd("amx_knivesonly","cmdknifes_only",ADMIN_LEVEL_A,"- disable and enable knife war 1 = on 0 = off")
register_concmd("amx_voteknivesonly","cmdvoteknifes_only",ADMIN_LEVEL_A,"- Starts a vote for Knives Only")
register_concmd("say /voteknivesonly","cmdvote",ADMIN_LEVEL_A,"- Starts a vote for Knives Only")
register_menucmd(register_menuid("\yKnives Only?"),(1<<0)|(1<<1),"count_votes")
register_event("CurWeapon","knife","b")
}

public cmdknifes_only(id){
   new arg[2]
   read_argv(1,arg,1)

   new cAdmin[32], cAuthid[32] 
   get_user_name(id, cAdmin, 31) 
   get_user_authid(id, cAuthid, 31) 
   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,"Knives Only has been turned on.")
   show_hudmessage(0,"Knives Only has been turned on.")
   log_amx("%s<%s> has turned Knives Only on", cAdmin, cAuthid)
   } else if(equal(arg,"0")){
   knifeonly = 0
   console_print(id,"Knives Only has been turned off.")
   show_hudmessage(0,"Knives Only has been turned off.")
   log_amx("%s<%s> has turned Knives Only off", cAdmin, cAuthid)
   } else {
   if (knifeonly==0){
   console_print(id,"Usage: amx_knivesonly 1 = 0n 0 = off Currently: OFF")
   }
   if (knifeonly==1){
   console_print(id,"Usage: amx_knivesonly 1 = 0n 0 = off Currently: ON")
   }
   }
   return PLUGIN_CONTINUE
   }

public knife(id){
        if(knifeonly==0){
            //nothing
        }
        if(knifeonly==1){
            new clip, ammo
            new usersweapon = get_user_weapon(id,clip,ammo)
            client_cmd(id, "drop")
            if(usersweapon==CSW_KNIFE) {
                //nothing
            } else {
                client_cmd(id,"weapon_knife")
            }
        }
        return PLUGIN_CONTINUE
}

public cmdvote(id){
    new Float:voting = get_cvar_float("amx_last_voting")
    new cAdmin[32], cAuthid[32] 
    get_user_name(id, cAdmin, 31) 
    get_user_authid(id, cAuthid, 31)
    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 awhile before you can vote again.*")
        return PLUGIN_HANDLED
    }
    new menu_msg[256]
    format(menu_msg,255,voteknifesonly)
    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,"*Voting has started.*")
    log_amx("%s<%s> started a vote for Knives Only", cAdmin, cAuthid)
    choice[0]=choice[1]=0
    return PLUGIN_HANDLED     
}

public cmdvoteknifes_only(id){
    new cAdmin[32], cAuthid[32] 
    get_user_name(id, cAdmin, 31) 
    get_user_authid(id, cAuthid, 31)
    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 awhile before you can vote again.*")
        return PLUGIN_HANDLED
    }
    new menu_msg[256]
    format(menu_msg,255,voteknifesonly)
    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,"*Voting has started.*")
    log_amx("%s<%s> started a vote for Knives Only", cAdmin, cAuthid)
    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 voted %s", name, key ? "against Knives Only" : "for Knives Only" )
    }
    ++choice[key]
    return PLUGIN_HANDLED
}

public check_the_votes(id){
    if (choice[0] > choice[1]){
        server_cmd("amx_knivesonly 1")
        client_print(0,print_chat,"* Votes For Knives Only Succeded (yes ^"%d^") (no ^"%d^"). *",choice[0],choice[1])
    } else {
        server_cmd("amx_knivesonly 0")
        client_print(0,print_chat,"* Votes Against Knives Only Succeded (yes ^"%d^") (no ^"%d^"). *",choice[0],choice[1])
    }
    return PLUGIN_CONTINUE
}
I am guessing you have to change something in this area
Code:
public knife(id){
        if(knifeonly==0){
            //nothing
        }
        if(knifeonly==1){
            new clip, ammo
            new usersweapon = get_user_weapon(id,clip,ammo)
            client_cmd(id, "drop")
            if(usersweapon==CSW_KNIFE) {
                //nothing
            } else {
                client_cmd(id,"weapon_knife")
            }
        }
        return PLUGIN_CONTINUE
}
__________________
BoK | Krazy is offline
Send a message via AIM to BoK | Krazy
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:51.


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