找回密码
 注-册

QQ登录

只需一步,快速开始

查看: 1676|回复: 0

[AMXX] 能不能把这个源码改成DOD用得

[复制链接]
rebeccs 发表于 2009-2-10 20:54:22 | 显示全部楼层 |阅读模式
/* AMX Mod script.
*
* Made by AssKicR
*
* This file is provided as is (no warranties).
*
* Desripion:
* Give Players Unlimited Ammo.
*
* Commands:
* amx_ammo <authid, nick, @team or #userid>   // Unlimited Ammo
* amx_unammo <authid, nick, @team or #userid> // Reset to normal
*
* Cvars:
* sv_dropwpn   - Drops his weapon when he gets more ammo
* sv_oneround  - Removes unlimited ammo power every new round
*
* Eksamples:
* Give AssKicR Unlimited Ammo            - amx_ammo AssKicR
* Remove AssKicRs Unlimited Ammo         - amx_unammo AssKicR
* Give all CT unlimited Ammo            - amx_ammo @CT
* Remove unlimited Ammo from all Terrorists - amx_ammo @TERRORISTS
* Give player #7 unlimited ammo            - amx_ammo #7
*
* Credits::
* Psyko - The Idea
* {HOJ} Batman & AssKicR - For making the orignal code that i stole ^_^
*
*Changelog:
*V 1.0 -- Original version
*V 1.1 -- Added amx_ammo @ALL & amx_unammo @ALL
*
*/  

#include <amxmod>
#include <amxmisc>
#include <fun>

// VARIABLES
new bool:AmmoMaster[33]
//----------------------------------------------------------------------------------------------
public plugin_init() {
   register_event("CurWeapon","changeWeapon","be","1=1")  
   register_plugin("Admin Ammo","1.0","AssKicR")  
   register_concmd("amx_ammo","admin_ammo",ADMIN_LEVEL_A,"<authid, nick, @team or #userid>")  
   register_concmd("amx_unammo","admin_unammo",ADMIN_LEVEL_A,"<authid, nick, @team or #userid>")
   if (!cvar_exists("sv_dropwpn")) register_cvar("sv_dropwpn", "0" )
}
//----------------------------------------------------------------------------------------------
public admin_ammo(id,level,cid) {
   if (!cmd_access(id,level,cid,2))
      return PLUGIN_HANDLED
   new arg[32], name2[32]
   get_user_name(id,name2,31)
  
   read_argv(1,arg,31)
   if ((arg[0]=='@') && (arg[1]!='A')) {
      new players[32], inum
      get_players(players,inum,"ae",arg[1])
      if (inum==0){
         console_print(id,"No clients in such team")
         return PLUGIN_HANDLED
      }
      for(new a=0;a<inum;++a)
         AmmoMaster[players[a]]=true
      switch(get_cvar_num("amx_show_activity"))   {
   case 2:   client_print(0,print_chat,"ADMIN %s: set unlimited ammo on all %s",name2,arg[1])
   case 1:   client_print(0,print_chat,"ADMIN: set unlimited ammo on all %s",arg[1])
      }
      console_print(id,"All clients on %s have unlimited ammo",arg[1])
   }
   else if ((arg[0]=='@') && (arg[1]=='A') && (arg[2]=='L') && (arg[2]=='L')) {
      new players[32], inum
      get_players(players,inum,"")
        
      for(new a=0;a<inum;++a)
         AmmoMaster[players[a]]=true
      switch(get_cvar_num("amx_show_activity"))   {
   case 2:   client_print(0,print_chat,"ADMIN %s: set unlimited ammo on all players",name2)
   case 1:   client_print(0,print_chat,"ADMIN: set unlimited ammo on all players")
      }
      console_print(id,"All clients have unlimited ammo")
   }
   else {
      new player = cmd_target(id,arg,7)
      if (!player) return PLUGIN_HANDLED
      AmmoMaster[player]=true
      new name[32]
      get_user_name(player,name,31)
      switch(get_cvar_num("amx_show_activity"))   {
   case 2:   client_print(0,print_chat,"ADMIN %s: set unlimited ammo on %s",name2,name)
   case 1:   client_print(0,print_chat,"ADMIN: set unlimited ammo on %s",name)
      }
      console_print(id,"Client ^"%s^" has unlimited ammo",name)
   }
   return PLUGIN_HANDLED  
}
//----------------------------------------------------------------------------------------------
public admin_unammo(id,level,cid) {
   if (!cmd_access(id,level,cid,2))
      return PLUGIN_HANDLED
   new arg[32], name2[32]
   get_user_name(id,name2,31)
   read_argv(1,arg,31)
   if ((arg[0]=='@') && (arg[1]!='A')){
      new players[32], inum
      get_players(players,inum,"ae",arg[1])
      if (inum==0){
         console_print(id,"No clients in such team")
         return PLUGIN_HANDLED
      }
      for(new a=0;a<inum;++a)
         AmmoMaster[players[a]]=false
      switch(get_cvar_num("amx_show_activity"))   {
   case 2:   client_print(0,print_chat,"ADMIN %s: removed unlimited ammo from all %s",name2,arg[1])
   case 1:   client_print(0,print_chat,"ADMIN: Removed unlimited ammo from all %s",arg[1])
      }
      console_print(id,"No clients on %s have unlimited ammo",arg[1])
   }
   else if ((arg[0]=='@') && (arg[1]=='A') && (arg[2]=='L') && (arg[2]=='L')) {
      new players[32], inum
      get_players(players,inum,"")
        
      for(new a=0;a<inum;++a)
         AmmoMaster[players[a]]=false
      switch(get_cvar_num("amx_show_activity"))   {
   case 2:   client_print(0,print_chat,"ADMIN %s: removed unlimited ammo from all players",name2)
   case 1:   client_print(0,print_chat,"ADMIN: removed unlimited ammo from all players")
      }
      console_print(id,"No clients have unlimited ammo")
   }
   else {
      new player = cmd_target(id,arg,7)
      if (!player) return PLUGIN_HANDLED
      AmmoMaster[player]=false
      new name[32]
      get_user_name(player,name,31)
      switch(get_cvar_num("amx_show_activity"))   {
   case 2:   client_print(0,print_chat,"ADMIN %s: removed unlimited ammo from %s",name2,name)
   case 1:   client_print(0,print_chat,"ADMIN: Removed unlimited ammo from %s",name)
      }
      console_print(id,"Client ^"%s^" doesn't have unlimited ammo",name)
   }
   return PLUGIN_HANDLED  
}
//----------------------------------------------------------------------------------------------
public changeWeapon(id)
{
    if ( !AmmoMaster[id] ) return PLUGIN_CONTINUE
    new  clip, ammo
    new wpn_id=get_user_weapon(id, clip, ammo);
    new wpn[32]

    if ( wpn_id==CSW_C4 || wpn_id==CSW_HEGRENADE || wpn_id == CSW_SMOKEGRENADE || wpn_id == CSW_FLASHBANG || wpn_id == CSW_KNIFE ) return PLUGIN_CONTINUE
   
    // Never Run Out of Ammo!
    //server_print("STATUS ID=%d CLIP=%d, AMMO=%d WPN=%d", id, clip, ammo, wpn_id)
    if ( clip == 0 )
    {
      //server_print("INVOKING PUNISHER MODE! ID=%d CLIP=%d, AMMO=%d WPN=%d", id, clip, ammo, wpn_id)
      get_weaponname(wpn_id,wpn,31)
      //highly recommend dropping weapon - buggy without it!
      if ( get_cvar_num("sv_dropwpn")!=0 ) engclient_cmd(id,"drop",wpn)  //TEST
      give_item(id,wpn)
      engclient_cmd(id, wpn )
      engclient_cmd(id, wpn ) // Checking to see if multple sends helps - sometimes this doesn't work... ;-(
      engclient_cmd(id, wpn ) // Checking to see if multple sends helps - sometimes this doesn't work... ;-(
    }
    return PLUGIN_CONTINUE
}
//----------------------------------------------------------------------------------------------
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注-册

本版积分规则

Archiver|手机版|小黑屋|DoDVip ( 桂ICP备14000730号 )

GMT+8, 2024-5-3 13:24 , Processed in 0.049203 second(s), 20 queries .

Powered by Discuz! X3.5

Copyright © 2001-2024 Tencent Cloud.

快速回复 返回顶部 返回列表