|
楼主 |
发表于 2008-4-2 21:26:35
|
显示全部楼层
来自 中国–甘肃–兰州
回复: 关于惩戒鞭尸者的插件
下面的是完整的代码,大家可以先看一看,然后再想想办法:到底能不能获取玩家用枪来射击尸体的事件(即判断出这个鞭尸者的行为)?
[php]#include <amxmodx>
#define MAX_DISTANCE 75 // detect distance...
#define MAX_PLAYERS 32 // server maximum players
new sprayidorigins[3]
new vorigin[MAX_PLAYERS][3]
new d_index
public plugin_init() {
register_plugin("Auto-logo punisher","0.01","[PAPA]PERt+")
register_event( "RoundTime", "reset_table", "bc" );
register_event("23", "checkspray", "a", "1=112")
register_event( "DeathMsg", "store_table", "a" );
server_cmd("cl_corpsestay 180")
}
public store_table() {
new victim = read_data( 2 );
new name[32]
get_user_name(victim, name , 31);
get_user_origin( victim, vorigin[d_index], 0 );
d_index++
return PLUGIN_CONTINUE;
}
public reset_table() {
d_index = 0
new i;
for (i=0; i < MAX_PLAYERS; i++) {
vorigin[0] = 0;
vorigin[1] = 0;
vorigin[2] = 0;
}
return PLUGIN_CONTINUE;
}
public checkspray() {
new sprayid = read_data(2) ;
sprayidorigins[0] = read_data(3);
sprayidorigins[1] = read_data(4);
sprayidorigins[2] = read_data(5);
new j;
for ( j=0; j < MAX_PLAYERS; j++) {
new distance = get_distance(vorigin[j], sprayidorigins);
if ( distance < MAX_DISTANCE ) {
new name[32]
get_user_name(sprayid,name,31)
client_cmd(sprayid,"kill")
client_print(0,print_chat, "[AMXX] 警告:玩家 %s 由于喷尸而被处死!",name)
user_kill(sprayid,1)
client_cmd(sprayid,"kill")
break
}
}
return PLUGIN_CONTINUE
}[/php] |
|