|
楼主 |
发表于 2010-9-7 09:26:24
|
显示全部楼层
来自 中国–浙江–杭州
无法下载附件的,下面是源代码:
//在Config目录下必须有OPUnlimitedMoney.ini文件,其中将需要永远16000的用户ID写进去,一行一个ID
#include <amxmodx>
#include <cstrike>
#include <amxmisc>
#include <fun>
#define PLUGIN "OP永远16000"
#define VERSION "1.0"
#define AUTHOR "DNA"
new g_motdFile[64]
new needCheck
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("ResetHUD", "new_round", "be")
register_event("Money","read_gmsg_Money","b")
get_configsdir(g_motdFile, 63)
format(g_motdFile, 63, "%s/OPUnlimitedMoney.ini", g_motdFile)
//判断配置文件是否存在
if ( file_exists( g_motdFile ) ) {
needCheck = 1
} else {
needCheck = 0
log_amx("配置文件OPUnlimitedMoney.ini不存在")
}
}
//根据用户ID与配置文件匹配,如果配置存在,则将用户的金钱设置为16000
public checkUser(id) {
new name[32], message[192], len, line = 0
get_user_name( id, name, 31)
while ( read_file( g_motdFile, line++, message, 191, len) ) {
if ( equali(message, name) ) {
//设置玩家可用钱为16000
cs_set_user_money(id, 16000, 1)
}
}
}
//用户的金钱发生变动后(买枪、买甲的时候),立即重新设置为16000
public read_gmsg_Money(id)
{
if ( needCheck == 1 ) {
checkUser(id)
}
return PLUGIN_CONTINUE
}
//新的一局开始时,将OP的金钱设置为16000
public new_round()
{
if ( needCheck == 1 ) {
new maxplayers
maxplayers = get_maxplayers()
for ( new id = 1; id <= maxplayers; id++ ) {
if ( !is_user_connected(id) ) continue
checkUser(id)
}
}
return PLUGIN_CONTINUE
} |
|