liptonabcde 发表于 2005-10-7 00:51:22

加钱插件

例子:
amx_money #1 1000   给自己+1000
amx_money CT@ 1000 CT+1000
下面是源代码:

/* AMX Mod script.
*
* (c) Copyright 2002-2003, f117bomb
* This file is provided as is (no warranties).
*/

#include <amxmod>
#include <amxmisc>

/*
* Usage: amx_money <authid, nick, @team or #userid> <money>
* Examples:
* amx_money @CT 100             - adds 100 dollars to ct's money
*
*/

public admin_money(id,level,cid) {
   if (!cmd_access(id,level,cid,3))
      return PLUGIN_HANDLED
   new arg, arg2, name2
   read_argv(1,arg,31)
   read_argv(2,arg2,7)
   get_user_name(id,name2,31)
   if (arg=='@'){
      new players, inum
      get_players(players,inum,"ae",arg)
      if (inum==0){
         console_print(id,"No clients in such team")
         return PLUGIN_HANDLED
      }
      for(new a=0;a<inum;++a) {
         new money = get_user_money(players)
         set_user_money(players,str_to_num(arg2) + money ,1)
      }
      switch(get_cvar_num("amx_show_activity"))        {
              case 2:        client_print(0,print_chat,"ADMIN %s: set money on all %s",name2,arg)
              case 1:        client_print(0,print_chat,"ADMIN: set money on all %s",arg)
      }
      console_print(id,"All clients have set money")
   }
   else {
      new player = cmd_target(id,arg,3)
      if (!player) return PLUGIN_HANDLED
      new money = get_user_money(player)
      set_user_money(player,str_to_num(arg2) + money ,1)
      new name
      get_user_name(player,name,31)
      switch(get_cvar_num("amx_show_activity"))        {
              case 2:        client_print(0,print_chat,"ADMIN %s: set money on %s",name2,name)
              case 1:        client_print(0,print_chat,"ADMIN: set money on %s",name)
      }
      console_print(id,"Client ^"%s^" has set money",name)
   }
   return PLUGIN_HANDLED
}

public plugin_init() {
   register_plugin("Admin Money","0.9.3","f117bomb")
   register_concmd("amx_money","admin_money",ADMIN_LEVEL_A,"<authid, nick, @team or #userid> <money>")
   return PLUGIN_CONTINUE
}
页: [1]
查看完整版本: 加钱插件