Raised This Month: $51 Target: $400
 12% 

Plugin Request: Bladez Only by Vote [DoD]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
pendragon
Senior Member
Join Date: Mar 2004
Location: In a bubble
Old 04-13-2004 , 04:05   Plugin Request: Bladez Only by Vote [DoD]
Reply With Quote #1

I do believe that SidLuke wrote this one....

@sidluke
I know you are busy like crazy working on other DoD specific amxx stuff... so I am just posting this in case someone else wants to give this one a shot.
My clients would very much appreciate it - cause everyone loves it on my servers.

Thanks ahead of time guys.

Code:
/*
*   AMX MOD script.
*
*   "Bladez Only by Vote [DoD]"
*
*   © Copyright 2003, "BIGGZ"
* This file is provided as is (no warranties).
*
* Based on Knife Arena v0.9 by tcquest78
*
* Altered to weapons found in DoD,
* the Knife for both Allies and Germans,
* the Spade, and the Para-Knife!
*
* Thanks to all that helped,...Ludwig van's "THE MAN"!!!
*
* amx_bladez 1 - restricts weapons to knives
*            0 - enables all weapons
*
* NOTE: Plugin adminvote from AMX 0.9.x required!!!
*/

#include <amxmod>
#include <amxmisc>

new bool:KnifeEnabled
new option[2]

public amx_enablebladez(id,level,cid) {
   if (!cmd_access(id,level,cid,1))
      return PLUGIN_HANDLED

   new arg1[4]
   read_argv(1,arg1,3)
   if ( equal(arg1,"1")||equali(arg1,"on") ){
      KnifeEnabled = true
      unpause("b","switchweapon")

      for ( new i=1;i<get_maxplayers();i++ )
        switchweapon(i)
   }
   else if (equal(arg1,"0")||equali(arg1,"off")){
      KnifeEnabled = false
      pause("b","switchweapon")
   }
   else {
      console_print(id,"Bladez Only Mode is %s",KnifeEnabled ? "enabled" : "disabled")
      return PLUGIN_HANDLED
   }

   console_print(id,"Bladez Only Mode %s",KnifeEnabled ? "enabled" : "disabled")
   client_print(0,print_center,"Bladez Only Mode Has Been %s!",KnifeEnabled ? "Enabled" : "Disabled")

   set_hudmessage(0, 100, 0, 0.05, 0.65, 2, 0.02, 10.0, 0.01, 0.1, 2)
   show_hudmessage(0,KnifeEnabled ? "Bladez Only Allowed" : "All Guns Allowed" )
   return PLUGIN_HANDLED
}

public switchweapon(id) {
   engclient_cmd(id,"weapon_amerknife")
   engclient_cmd(id,"weapon_gerknife")
   engclient_cmd(id,"weapon_spade")
}

new votepistols[] = "AMX %s <span class='searchlite'>Bladez</span> Only Mode?^n^n1. Yes^n2. No"

public vote_bladez(id){
   if (!cmd_access(id,level,cid,1))
      return PLUGIN_HANDLED

   new Float:voting = get_cvar_float("amx_last_voting")
   if (voting > get_gametime()){
      client_print(id,print_chat,"* There is already one voting...")
      return PLUGIN_HANDLED
   }
   if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime()) {
      client_print(id,print_chat,"* Voting not allowed at this time...")
      return PLUGIN_HANDLED
   }
   new menu_msg[256]
   format(menu_msg,255,votepistols,KnifeEnabled ? "Disable" : "Enable")
   new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0
   set_cvar_float("amx_last_voting",  get_gametime() + vote_time )
   show_menu(0,(1<<0)|(1<<1),menu_msg,floatround(vote_time))
   set_task(vote_time,"check_votes")
   client_print(0,print_chat,"* Voting has started...")
   option[0]=option[1]=0
   return PLUGIN_HANDLED
}

public vote_count(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" : "for" )
   }
   ++option[key]
   return PLUGIN_HANDLED
}

public check_votes(id){
   if (option[0] > option[1]){
      server_cmd(  "amx_bladez %s", KnifeEnabled ? "off" : "on" )
      client_print(0,print_chat,"* Voting successful (yes ^"%d^") (no ^"%d^").",option[0],option[1])
   }
   else{
      client_print(0,print_chat,"* Voting failed (yes ^"%d^") (no ^"%d^").",option[0],option[1])
   }
   return PLUGIN_CONTINUE
}

public plugin_init() {
   register_plugin("Bladez Only by Vote","0.9","BIGGZ")
   register_event("CurWeapon","switchweapon","be","1=1","2!1","2!2","2!19")
   register_concmd("amx_bladez","amx_enablebladez",ADMIN_LEVEL_B,"<1|0> - <span class='searchlite'>bladez</span> only mode")
   register_clcmd("say /votebladez","vote_bladez",ADMIN_LEVEL_B,"- start voting session for <span class='searchlite'>bladez</span> only mode")
   register_menucmd(register_menuid("Bladez Only Mode?"),(1<<0)|(1<<1),"vote_count")
   pause("b","switchweapon")
   return PLUGIN_CONTINUE
}
pendragon is offline
Send a message via ICQ to pendragon
dragonchaos
Member
Join Date: Mar 2004
Old 04-13-2004 , 07:17  
Reply With Quote #2

it looks like all you may have to change is the <amxmod> to <amxmodx>

and line 67
from this:
Code:
public vote_bladez(id){
to this:
Code:
public vote_bladez(id,level,cid){

this compiles fine, can't test it though.

Edit: Added a couple lines to work in cstrike, and it works there, so I would assume it works in dod (again, can't test dod).
dragonchaos is offline
pendragon
Senior Member
Join Date: Mar 2004
Location: In a bubble
Old 04-13-2004 , 20:24  
Reply With Quote #3

thank you - i will test it by friday nad report back.

pendragon is offline
Send a message via ICQ to pendragon
SidLuke
Senior Member
Join Date: Mar 2004
Location: Poland, Chrzanow
Old 04-15-2004 , 12:14  
Reply With Quote #4

Posted Bladez Only by vote
SidLuke is offline
Send a message via AIM to SidLuke Send a message via MSN to SidLuke
pendragon
Senior Member
Join Date: Mar 2004
Location: In a bubble
Old 04-15-2004 , 19:35  
Reply With Quote #5

works dandy guys! thank u so much.

p.s. the only problem associated with this arrises if you use sturmbot and tehre are bots in the current map. Not all players will be listed in the amx_who and thus, not all admins get their rights, and specific to this subject - players not listed in amx_who also are immune to the bladez only rule set by this script.

I posted about this problem in sturmbot's forums and I am waiting to hear back - unfortunately sturmbot forums are down and have been for over a week so who knows what is going on over there.
__________________
pendragon is offline
Send a message via ICQ to pendragon
Reply



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 13:45.


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