|
发表于 2008-12-21 18:39:23
|
显示全部楼层
来自 中国–北京–北京–海淀区
回复: 求一个杀人奖励金钱的插件
- #include <amxmodx>
- #include <fakemeta>
-
- #define PLUGIN "Test"
- #define AUTHOR "Jim"
- #define VERSION "1.0"
-
- #define MONEY_FUNCTION 3
-
- #define get_player_team(%1) get_pdata_int(%1, 114)
-
- #if MONEY_FUNCTION == 1
- #include <cstrike>
- #define add_player_money(%1,%2) cs_set_user_money(%1, cs_get_user_money(%1) + %2)
- #else
- #if MONEY_FUNCTION == 2
- #include <unlimited_money>
- #define add_player_money(%1,%2) cs_set_user_money2(%1, cs_get_user_money2(%1) + %2)
- #else
- #define add_player_money(%1,%2) set_pdata_int(%1, 115, get_pdata_int(%1, 115) + %2)
- #endif
- #endif
-
- #define MONEY_KNIFE 1000
- #define MONEY_GRENADE 300
- #define MONEY_HEADSHOT 500
- #define MONEY_FIRSTKILLER 1000
- #define MONEY_KILLSTREAK 1000
- #define MONEY_BOMBPLANTER 2000
- #define MONEY_BOMBDEFUSER 2000
-
- new bool:firstkiller
- new lastkiller
-
- stock get_loguser_index()
- {
- new loguser[80], name[32]
- read_logargv(0, loguser, 79)
- parse_loguser(loguser, name, 31)
- return get_user_index(name)
- }
-
- public plugin_init()
- {
- register_plugin(PLUGIN, VERSION, AUTHOR)
- register_event("DeathMsg", "event_death", "a")
- register_logevent("round_start", 2, "1=Round_Start")
- register_logevent("bomb_planted", 3, "2=Planted_The_Bomb")
- register_logevent("bomb_defused", 3, "2=Defused_The_Bomb")
- }
-
- public round_start()
- {
- firstkiller = false
- lastkiller = 0
- }
-
- public bomb_planted()
- {
- new id = get_loguser_index()
- if(is_user_connected(id))
- add_player_money(id, MONEY_BOMBPLANTER)
- }
-
- public bomb_defused()
- {
- new id = get_loguser_index()
- if(is_user_connected(id))
- add_player_money(id, MONEY_BOMBDEFUSER)
- }
-
- public event_death()
- {
- new k = read_data(1)
- new v = read_data(2)
-
- if(!k || k == v || get_player_team(k) == get_player_team(v))
- return
-
- if(k != lastkiller)
- {
- lastkiller = k
- }
- else
- {
- add_player_money(k, MONEY_KILLSTREAK)
- }
-
- if(!firstkiller)
- {
- add_player_money(k, MONEY_FIRSTKILLER)
- firstkiller = true
- }
-
- new w[3]
- read_data(3, w, 2)
-
- if(w[0] == 'k')
- {
- add_player_money(k, MONEY_KNIFE)
- }
- if(w[1] == 'r')
- {
- add_player_money(k, MONEY_GRENADE)
- }
- if(read_data(4))
- {
- add_player_money(k, MONEY_HEADSHOT)
- }
- }
复制代码 |
|