|
本帖最后由 Hebe 于 2009-7-15 18:24 编辑
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fakemeta_stocks>
#pragma semicolon 1
#define PLUGIN "Punisher"
#define VERSION "1.4.1"
#define AUTHOR "R3X"
#define Keyspunisher (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)
#define TASK_BLUR 1
#define TASK_FALL 33
#define TASK_HOST 65
#define TASK_DETONATE 97
#define TASK_EXEC 129
//#define TASK_BALL 161
#define set_blur(%1) fm_set_rendering(id, kRenderFxNone, _,_,_, kRenderTransTexture, %1)
#define FALL_DOWN "models/apache.mdl"
#define HOST_MODEL "models/hostage.mdl"
#define C4_MODEL "models/w_c4.mdl"
#define EXEC_MODEL "models/v_deagle.mdl"
#define BALL_MODEL "models/football.mdl"
new gHeliSound[]="ambience/heli-pass.wav";
new gSound[]="ambience/lightningbolt.wav";
new gC4[]="weapons/c4_beep5.wav";
new gC4exp[]="weapons/c4_explode1.wav";
new gWeaponSnd[]="weapons/deagle-1.wav";
#define SIZEOFMETHODS 8
new gszMethods[SIZEOFMETHODS][]={
"random",
"explode",
"blur",
"light",
"falldown",
"hostage",
"execution",
"football"
};
new MenuPospunisher;
new MenuPlayerspunisher[32];
new g_punish[33];
new MethodOffset[33];
new g_Amount[33];
new gmsgScreenFade;
new iLightning, iExplosion;
new bool:g_freeze[33];
public plugin_init(){
register_plugin(PLUGIN, VERSION, AUTHOR);
register_dictionary("punisher.txt");
register_menucmd(register_menuid("punishment"), Keyspunisher, "Pressedpunishment");
register_menucmd(register_menuid("punisher"), Keyspunisher, "Pressedpunisher");
register_clcmd("punisher", "cmd_punishser",ADMIN_SLAY, "<Punisher>");
new szCmd[30];
for(new i=0;i<SIZEOFMETHODS;i++){
formatex(szCmd, 29, "amx_punisher_%s", gszMethods);
register_concmd(szCmd,"cmd_amx_punisher_", ADMIN_SLAY, "<#userid, Nick, SteamId>");
}
register_event("DeathMsg", "eventDeathMsg", "a");
gmsgScreenFade=get_user_msgid("ScreenFade");
register_forward(FM_PlayerPreThink, "eventPreThink");
register_forward( FM_CmdStart, "fwCmdStart");
register_forward(FM_Think, "eventThink");
server_cmd("amx_addmenuitem ^"Punisher ;D^" ^"punisher^" ^"hu^" ^"punisher.amxx^"");
}
public eventThink(ent){
new class[10];
pev(ent, pev_classname, class, 9);
if(equal(class,"myhost")){
set_pev(ent, pev_nextthink, get_gametime()+0.1);
}
else if(equal(class,"football")){
set_pev(ent, pev_nextthink, get_gametime()+0.05);
new Float:Origin[3];
pev(ent, pev_origin, Origin);
Origin[2]-=5.0;
set_pev(ent, pev_origin, Origin);
new id=pev(ent, pev_owner);
Origin[0]=fm_entity_range(ent, id);
if(Origin[0] < 40.0){
slay(pev(ent, pev_euser1), id);
}
if(Origin[0] > 250.0){
new param[1];
param[0]=ent;
EntRemove(param);
}
}
}
public plugin_precache(){
iLightning=precache_model("sprites/lgtning.spr");
iExplosion=precache_model("sprites/bexplo.spr");
precache_model(FALL_DOWN);
precache_model(HOST_MODEL);
precache_model(C4_MODEL);
precache_model(EXEC_MODEL);
precache_model(BALL_MODEL);
precache_sound(gSound);
precache_sound(gHeliSound);
precache_sound(gC4);
precache_sound(gC4exp);
precache_sound(gWeaponSnd);
}
/*
Commands
*/
public cmd_punishser(id, level, cid) {
if(!cmd_access(id, level, cid, 1)) return PLUGIN_HANDLED;
ShowMenupunisher(id, MenuPospunisher=0);
return PLUGIN_HANDLED;
}
public cmd_amx_punisher_(id, level, cid){
if(!cmd_access(id, level, cid, 2)) return PLUGIN_HANDLED;
new szTarget[34], iTarget;
read_argv(1, szTarget, 33);
iTarget=cmd_target(id, szTarget,0);
if(is_user_alive(iTarget)){
new szCmd[33];
read_argv(0, szCmd, 32);
if(containi(szCmd,"random")>=0)
formatex(szCmd, 32, "amx_punisher_%s", gszMethods[random_num(1, SIZEOFMETHODS-1)]);
if(containi(szCmd,"explode")>=0)
ExplodePlayer(id, iTarget);
else if(containi(szCmd,"blur") >=0)
BlurPlayer(id, iTarget);
else if(containi(szCmd,"light") >=0)
LightPlayer(id, iTarget);
else if(containi(szCmd,"falldown") >=0)
FallDownPlayer(id, iTarget);
else if(containi(szCmd,"hostage")>=0)
HostagePlayer(id, iTarget);
else if(containi(szCmd, "execution")>=0)
ExecutionPlayer(id, iTarget);
else if(containi(szCmd, "football")>=0)
FootballPlayer(id, iTarget);
}
return PLUGIN_HANDLED;
}
/*
Menus
*/
public ShowMenupunisher(id, position) {
// Menu stuff //
if (position < 0) { return 0; }
new i, k;
new MenuBody[255];
new CurrentKey = 0;
new Start = position * 7;
new Num;
new UserName[32];
get_players(MenuPlayerspunisher, Num);
if (Start >= Num) { Start = position = MenuPospunisher = 0; }
new Len = format(MenuBody, 255, "\yPunisher player\R%d/%d^n\w^n", position+1, (Num / 7 + ((Num % 7) ? 1 : 0 )) );
new End = Start + 7;
new Keys = (1<<9);
if (End > Num) { End = Num; }
for(i=Start;i<End;i++) {
k = MenuPlayerspunisher;
get_user_name(k, UserName, 31);
if(is_user_alive(k)){
Keys |= (1<<CurrentKey++);
Len += format(MenuBody[Len], (255-Len), "\w%i. %s^n", CurrentKey, UserName);
}else
Len += format(MenuBody[Len], (255-Len), "\d%i. %s^n", ++CurrentKey, UserName);
}
if (End != Num) {
format(MenuBody[Len], (255-Len), "^n\w9. Next^n%s", position ? "\w0. Back" : "\w0. Exit");
Keys |= (1<<8);
}
else {
format(MenuBody[Len], (255-Len), "^n%s", position ? "\w0. Back" : "\w0. Exit");
}
show_menu(id, Keys, MenuBody, -1, "punisher");
return 0;
}
public Pressedpunisher(id, key) {
switch (key) {
case 8: ShowMenupunisher(id, ++MenuPospunisher); // More Option
case 9: ShowMenupunisher(id, --MenuPospunisher); // Back Option
default: {
// Get User ID
new PlayerID = MenuPlayerspunisher[MenuPospunisher * 7 + key];
if(!is_user_alive(PlayerID)) return PLUGIN_HANDLED;
Showpunishment(id, PlayerID);
}
}
return PLUGIN_HANDLED;
}
public Showpunishment(id, who) {
if(!is_user_alive(who)) return;
g_punish[id]=who;
new UserName[32];
get_user_name(who, UserName, 31);
new szMenu[264], iLen=0;
new Keys=(1<<8)|(1<<9);
iLen+=formatex(szMenu[iLen], 263, "\yPunish %s^n^n\w", UserName);
if(MethodOffset[id]<0) MethodOffset[id]=0;
new start=MethodOffset[id], stop=min(5+MethodOffset[id], SIZEOFMETHODS-1);
new buff[16];
for(new j=0, i=start;i<=stop;j++,i++){
Keys|=(1<<j);
formatex(buff, 15, "%s",gszMethods);
strtoupper(buff);
iLen+=formatex(szMenu[iLen], 263-iLen, "\w%d. %L^n", j+1, id, buff);
}
iLen+=formatex(szMenu[iLen], 263-iLen, "^n");
if(start>0){
Keys|=(1<<6);
iLen+=formatex(szMenu[iLen], 263-iLen, "7. Previous^n");
}
if(5+MethodOffset[id] < SIZEOFMETHODS){
Keys|=(1<<7);
iLen+=formatex(szMenu[iLen], 263-iLen, "8. Next^n");
}
iLen+=formatex(szMenu[iLen], 263-iLen, "^n9. Back^n 0. Exit");
show_menu(id, Keys, szMenu, -1, "punishment"); // Display menu
}
public Pressedpunishment(id, key) {
if(key<0 || !is_user_alive(g_punish[id])) return;
switch (key) {
case 6:{
MethodOffset[id]-=6;
Showpunishment(id, g_punish[id]);
}
case 7:{
MethodOffset[id]+=6;
Showpunishment(id, g_punish[id]);
}
case 8:{
ShowMenupunisher(id, MenuPospunisher);
MethodOffset[id]=0;
}
case 9:{
MethodOffset[id]=0;
}
default:{
client_cmd(id, "amx_punisher_%s #%d", gszMethods[key+MethodOffset[id]], get_user_userid(g_punish[id]));
MethodOffset[id]=0;
}
}
}
/*
Events
*/
public eventDeathMsg(){
//new iKiller=read_data(1);
new iVictim=read_data(2);
if(task_exists(TASK_BLUR+iVictim))
remove_task(TASK_BLUR+iVictim);
}
public eventPreThink(id){
if(g_freeze[id]){
new button=pev(id,pev_button);
set_pev(id,pev_velocity,Float:{0.0,0.0,0.0}); // stop motion
set_pev(id, pev_oldbuttons, pev(id,pev_oldbuttons)&(~IN_DUCK));
engfunc(EngFunc_SetClientMaxspeed,id,0.00001); // keep immobile
if(( button & IN_JUMP) && !(pev(id,pev_oldbuttons) & IN_JUMP) && (pev(id,pev_flags) & FL_ONGROUND))
【帖子长度限制源码无法全发】
劳烦哪位汉化一下!
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注个册吧
×
|