731 发表于 2008-4-23 15:57:02

点通高手们来看看这个监狱插件能修改吗~~!jim_yang点通的前辈们来!

这个插件娱乐性很强,可惜是AMX的。我装了AMX兼容,加载进去运行。服务器很容易死机,那个高手能修改成AMXX,和决绝死机问题!

/* AMX Mod X script.
*
* 劫持监狱
* 由UFo汉化
* email: czcaozhao-42@sohu.com
*
*
* QQ:250700724
*
* *******************************************************************************
*
* Ported from 1.03 to 1.04 By KingPin(kingpin@onexfx.com). I take no responsibility
* for this file in any way. Use at your own risk. No warranties of any kind.
* This file mirrored at : http://www.onexfx.com in the downloads section.
*
* *******************************************************************************
*
*
* Description:
*
* This is a CS plugin that adds a new game mode. Here is how it works:
* Each team has a jail at their respawn, when you kill enemy players they are sent
* to your jail. In order to win the round you must capture all enemy players in your
* jail. You can free your team mates from the enemy jail by walking into it without
* being killed. You get one frag for each team mate rescued.
*
* Console Commands:
*
* sv_jailbreak - allows you to enable/disable the plugin, default is 1.
* Amx_jailbreak - Allows admins to use this without having amx_rcon
*
* Say Commands For Clients:
*
* /jailbreak - shows a help file about the plugin.
*
*
* Revision History
*
* v1.04: - Ported to AMXX. Added /jailbreak as a say command for help.
* - Needs jailbreak.txt file in "/addons/amxx/custom/jailbreak/"
* - Added Amx_jailbreak 1/0 cvar
*
* v1.03: - players now actually die and respawn
*
* v1.02: - fixed bug where you could leave the jail area while being "in jail"
* - it now takes 5 seconds to rescue a team mate, you have to stay inside the jail during this period
* - if you stay inside the enemy jail when no team mates are in there you will be captured
* - when put in jail you lose your primary weapon
* - can only rescue team mates from jail every 30 seconds
*
* v1.01: - Changed glow effect while in prison (easier to see who is in prison and who isn't)
* - If you try to escape 3 times in a row you get burried and cannot move until rescued
* - Fixed bug where dead people could free prisoners
* - No longer allowed to plant the bomb on de_ maps
* - Made the jail a little smaller
* - Changed colors to blue and red
*
* v1.00: - Initial Version
*
*/
#include <amxmodx>
#include <fun>
#define TE_BEAMPOINTS 0
#define TE_SPRITETRAIL 15
#define JAILSIZE 150
#define JAILLIFE 50 // seconds*10
#define JAILBEAMWIDTH 15
#define JAILBEAMNOISE 0
#define JAILBEAMBRIGHTNESS 64
#define RESCUETIME 30.0
#define MAXESCAPEATTEMPTS 3
#define BURYDEPTH 40
#define RESCUECOUNTDOWN 5
new bool:TJailSet // Terrorist = Team 1
new bool:CTJailSet // Counter-Terrorist = Team 2
new bool:RestartingRound
new TJailCoords
new CTJailCoords
new PlayerCoords
new bool:IsInJail
new bool:CheckIfStuck
new bool:IsBuried
new EscapeAttempts
new Float:TRescue
new Float:CTRescue
new JailBeam
new gmsgScoreAttrib
public new_round(id){
if (get_cvar_num("sv_jailbreak")==0)
return PLUGIN_CONTINUE
new teamnumber=get_user_team(id)
if (teamnumber==1 && !TJailSet && is_user_alive(id)){
get_user_origin(id, TJailCoords)
TJailSet=true
}
else if (teamnumber==2 && !CTJailSet && is_user_alive(id)){
get_user_origin(id, CTJailCoords)
CTJailSet=true
}
IsInJail=false
IsBuried=false
RestartingRound=false
EscapeAttempts=0
set_user_godmode(id)
set_user_rendering(id)
return PLUGIN_CONTINUE
}
public death(){
if (get_cvar_num("sv_jailbreak")==0 || RestartingRound)
return PLUGIN_CONTINUE
new victim_id = read_data(2)
if (victim_id){
new parm
parm=victim_id
set_task(0.5,"respawn",852,parm,2)
}
return PLUGIN_CONTINUE
}
public create_jail(){
if (get_cvar_num("sv_jailbreak")==0)
return PLUGIN_CONTINUE
new red, green, blue
new origin
new x1, y1, x2, y2, height
new i, j, k
new shape = {{1,1},{-1,1},{-1,-1},{1,-1}}
for (j=0; j<4; j++){
height=30*j-30
for (i=0; i<4; i++){
x1=shape*JAILSIZE
y1=shape*JAILSIZE
if (i<3){
x2=shape*JAILSIZE
y2=shape*JAILSIZE
}
else{
x2=shape*JAILSIZE
y2=shape*JAILSIZE
}
for (k=1; k<3; k++){
if (k==1){
origin=TJailCoords
origin=TJailCoords
origin=TJailCoords
red=255
green=0
blue=0
}
else if (k==2){
origin=CTJailCoords
origin=CTJailCoords
origin=CTJailCoords
red=0
green=0
blue=255
}
message_begin( MSG_BROADCAST, SVC_TEMPENTITY )
write_byte( TE_BEAMPOINTS )
write_coord(origin+x1)
write_coord(origin+y1)
write_coord(origin+height)
write_coord(origin+x2)
write_coord(origin+y2)
write_coord(origin+height)
write_short(JailBeam) // model
write_byte( 0 ) // start frame
write_byte( 0 ) // framerate
write_byte( JAILLIFE ) // life
write_byte( JAILBEAMWIDTH ) // width
write_byte( JAILBEAMNOISE ) // noise
write_byte( red ) // r, g, b
write_byte( green ) // r, g, b
write_byte( blue ) // r, g, b
write_byte( JAILBEAMBRIGHTNESS ) // brightness
write_byte( 0 ) // speed
message_end()
}
}
}
return PLUGIN_CONTINUE
}
public check_position(){
if (get_cvar_num("sv_jailbreak")==0)
return PLUGIN_CONTINUE
new origin, playerorigin, players
new i, numofplayers, id, teamnumber
new hudmsg
new name
new parm
get_players(players, numofplayers)
for (i=0; i<numofplayers; i++){
id=players
if (!is_user_alive(id))
continue
get_user_origin(id, playerorigin)
teamnumber = get_user_team(id)
if (teamnumber==1){
origin=CTJailCoords
origin=CTJailCoords
origin=CTJailCoords
}
else if (teamnumber==2){
origin=TJailCoords
origin=TJailCoords
origin=TJailCoords
}
if (CheckIfStuck && PlayerCoords==playerorigin){
origin+=random_num(-JAILSIZE+20,JAILSIZE-20)
origin+=random_num(-JAILSIZE+20,JAILSIZE-20)
origin+=1 // Avoid getting teleported all over the place on certain maps
set_user_origin(id, origin)
PlayerCoords=origin
CheckIfStuck=true
}
else if (IsInJail){
CheckIfStuck=false
if(origin-playerorigin > JAILSIZE || origin-playerorigin < -JAILSIZE ||
origin-playerorigin > JAILSIZE || origin-playerorigin < -JAILSIZE ||
origin-playerorigin > JAILSIZE || origin-playerorigin < -JAILSIZE){
origin+=random_num(-JAILSIZE+20,JAILSIZE-20)
origin+=random_num(-JAILSIZE+20,JAILSIZE-20)
origin+=1 // Avoid getting teleported all over the place on certain maps
EscapeAttempts++
if (EscapeAttempts>=MAXESCAPEATTEMPTS){
get_user_name(id,name,31)
if (teamnumber==1)
set_hudmessage(255, 128, 128, -1.0, 0.3, 0, 6.0, 6.0, 0.1, 0.2, 1)
else if (teamnumber==2)
set_hudmessage(128, 128, 255, -1.0, 0.3, 0, 6.0, 6.0, 0.1, 0.2, 1)
IsBuried=true
CheckIfStuck=false
origin-=BURYDEPTH
set_user_origin(id, origin)
format (hudmsg, 127, "%s 哈 已被抓到监狱 正在试着逃跑", name)
show_hudmessage(0,hudmsg)
}
else{
set_user_origin(id, origin)
PlayerCoords=origin
CheckIfStuck=true
}
}
}
else{
CheckIfStuck=false
if(!(origin-playerorigin > JAILSIZE || origin-playerorigin < -JAILSIZE ||
origin-playerorigin > JAILSIZE || origin-playerorigin < -JAILSIZE ||
origin-playerorigin > JAILSIZE || origin-playerorigin < -JAILSIZE)){
if (teamnumber==1 && TRescue < get_gametime())
TRescue=get_gametime()+RESCUETIME
else if (teamnumber==2 && CTRescue < get_gametime())
CTRescue=get_gametime()+RESCUETIME
else
continue
parm=id
parm=RESCUECOUNTDOWN
rescue_countdown(parm)
}
}
}
return PLUGIN_CONTINUE
}
public rescue_countdown(parm[]){
new id = parm
new countdown = parm
new teamnumber = get_user_team(id)
new hudmsg, name
new teamname
new numsaved=0
new origin, playerorigin, players, prisonerorigin
new j, numofplayers, prisonerid
get_user_name(id,name,31)
if (teamnumber==1){
origin=CTJailCoords
origin=CTJailCoords
origin=CTJailCoords
}
else if (teamnumber==2){
origin=TJailCoords
origin=TJailCoords
origin=TJailCoords
}
get_user_origin(id, playerorigin)
if(!(origin-playerorigin > JAILSIZE || origin-playerorigin < -JAILSIZE ||
origin-playerorigin > JAILSIZE || origin-playerorigin < -JAILSIZE ||
origin-playerorigin > JAILSIZE || origin-playerorigin < -JAILSIZE ||
IsInJail)){ // If isn't outside the jail and isn't a prisoner
if (parm!=0){
parm--
set_task(1.0,"rescue_countdown",654,parm,2)
}
}
else{
if (teamnumber==1)
TRescue=get_gametime()
else if (teamnumber==2)
CTRescue=get_gametime()
return PLUGIN_CONTINUE
}
if (countdown){
if (teamnumber==1)
set_hudmessage(255, 128, 128, -1.0, 0.25, 0, 1.0, 1.0, 0.1, 0.1, 2)
else if (teamnumber==2)
set_hudmessage(128, 128, 255, -1.0, 0.2, 0, 1.0, 1.0, 0.1, 0.1, 3)
format (hudmsg, 127, "%s 正在努力营救队友... %d", name, countdown)
show_hudmessage(0,hudmsg)
}
else{
get_players(players, numofplayers)
for (j=0; j<numofplayers; j++){
prisonerid=players
if (get_user_team(id)==get_user_team(prisonerid) && IsInJail && prisonerid){
IsInJail=false
scoreboard(prisonerid,0)
set_user_godmode(prisonerid)
set_user_rendering(prisonerid)
numsaved++
if (IsBuried==true){
get_user_origin(prisonerid, prisonerorigin)
prisonerorigin+=BURYDEPTH
set_user_origin(prisonerid, prisonerorigin)
PlayerCoords=prisonerorigin
CheckIfStuck=true
}
}
}
if (numsaved){
if (teamnumber==1)
set_hudmessage(255, 128, 128, -1.0, 0.25, 0, 6.0, 6.0, 0.1, 0.2, 2)
else if (teamnumber==2)
set_hudmessage(128, 128, 255, -1.0, 0.2, 0, 6.0, 6.0, 0.1, 0.2, 3)
if (numsaved==1 && teamnumber==1)
teamname="恐怖分子"
else if (numsaved==1 && teamnumber==2)
teamname="反恐专家"
else if (numsaved>1 && teamnumber==1)
teamname="恐怖分子"
else if (numsaved>1 && teamnumber==2)
teamname="反恐专家"
format (hudmsg, 127, "%s 已被救出 %d %s 从监狱", name, numsaved, teamname)
show_hudmessage(0,hudmsg)
set_user_frags(id, get_user_frags(id)+numsaved)
}
else{
if (teamnumber==1)
set_hudmessage(255, 128, 128, -1.0, 0.25, 0, 6.0, 6.0, 0.1, 0.2, 2)
else if (teamnumber==2)
set_hudmessage(128, 128, 255, -1.0, 0.2, 0, 6.0, 6.0, 0.1, 0.2, 3)
format (hudmsg, 127, "%s 监狱里没有队友 被俘获了", name)
show_hudmessage(0,hudmsg)
IsInJail=true
IsBuried=false
EscapeAttempts=0
if (teamnumber==1){
set_user_rendering(id,kRenderFxGlowShell,0,0,128, kRenderTransTexture, 128)
}
else if (teamnumber==2){
set_user_rendering(id,kRenderFxGlowShell,128,0,0, kRenderTransTexture, 128)
}
CheckIfStuck=false
set_user_health(id, 1124)
set_user_godmode(id,1)
engclient_cmd(id,"weapon_knife")
}
}
return PLUGIN_CONTINUE
}
public end_round(){
if (get_cvar_num("sv_jailbreak")==0)
return PLUGIN_CONTINUE
TJailSet=false
CTJailSet=false
RestartingRound=true
return PLUGIN_CONTINUE
}
public scoreboard(id,state){ // 0 - nothing, 1 - dead, 2 - bomb
message_begin( MSG_ALL, gmsgScoreAttrib,{0,0,0},0)
write_byte(id)
write_byte(state)
message_end()
return PLUGIN_HANDLED
}
public switch_toknife(id){
if (get_cvar_num("sv_jailbreak")==0)
return PLUGIN_CONTINUE
if (IsInJail || read_data(2)==6) // 6 = c4
engclient_cmd(id,"weapon_knife")
return PLUGIN_CONTINUE
}
public skin_selected(id)
{
if (get_cvar_num("sv_jailbreak") == 1 && !RestartingRound)
{
new parm
parm=id
parm=1
set_task(0.5,"wait_alive",853,parm,2)
}
return PLUGIN_CONTINUE
}
public wait_alive(parm[]){
new id = parm
if (!is_user_alive(id))
{
respawn(parm)
}
return PLUGIN_CONTINUE
}
public respawn(parm[])
{
new id = parm
if (!get_user_team(id) || !id || RestartingRound)
return PLUGIN_CONTINUE
set_task(0.2,"put_in_jail",855,parm,1)
spawn(id)
engclient_cmd(id,"weapon_knife")
return PLUGIN_CONTINUE
}
public put_in_jail(parm[]){
new id = parm
new origin
IsInJail=true
IsBuried=false
EscapeAttempts=0
scoreboard(id,1)
set_user_godmode(id,1)
new teamnumber = get_user_team(id)
if (teamnumber==1){
origin=CTJailCoords
origin=CTJailCoords
origin=CTJailCoords
set_user_rendering(id,kRenderFxGlowShell,0,0,128, kRenderTransTexture, 128)
}
else if (teamnumber==2){
origin=TJailCoords
origin=TJailCoords
origin=TJailCoords
set_user_rendering(id,kRenderFxGlowShell,128,0,0, kRenderTransTexture, 128)
}
origin+=random_num(-JAILSIZE+20,JAILSIZE-20)
origin+=random_num(-JAILSIZE+20,JAILSIZE-20)
origin+=1 // Avoid getting teleported all over the place on certain maps
set_user_origin(id, origin)
PlayerCoords=origin
CheckIfStuck=true
new players, numofplayers, targetid, i, talive, ctalive
talive = 0
ctalive = 0
get_players(players, numofplayers)
for (i=0; i<numofplayers; i++){
targetid=players
teamnumber = get_user_team(targetid)
if (is_user_alive(targetid) && !IsInJail){
if (teamnumber==1)
++talive
else if (teamnumber==2)
++ctalive
}
}
if (!talive || !ctalive){
for (i=0; i<numofplayers; i++){
targetid=players
teamnumber = get_user_team(targetid)
set_user_godmode(targetid)
if (teamnumber==1 && !talive)
user_kill(targetid,1)
else if (teamnumber==2 && !ctalive)
user_kill(targetid,1)
}
}
return PLUGIN_CONTINUE
}
public check_alive(){
if (get_cvar_num("sv_jailbreak")==0)
return PLUGIN_CONTINUE
new players, numofplayers, targetid, i, talive, ctalive, teamnumber
talive = 0
ctalive = 0
get_players(players, numofplayers)
for (i=0; i<numofplayers; i++){
targetid=players
teamnumber = get_user_team(targetid)
if (is_user_alive(targetid) && !IsInJail){
if (teamnumber==1)
++talive
else if (teamnumber==2)
++ctalive
}
}
if (!talive || !ctalive){
for (i=0; i<numofplayers; i++){
targetid=players
teamnumber = get_user_team(targetid)
set_user_godmode(targetid)
if (teamnumber==1 && !talive)
user_kill(targetid,1)
else if (teamnumber==2 && !ctalive)
user_kill(targetid,1)
}
}
return PLUGIN_CONTINUE
}
public plugin_precache(){
JailBeam = precache_model("sprites/zbeam4.spr")
return PLUGIN_CONTINUE
}
//************* /jailbreak public command Start (KingPin) *************************
public starthelp(id)
{
show_motd(id,"/addons/amxx/custom/jailbreak/jailbreak.txt","Jail Break")
return PLUGIN_HANDLED
}
//************* /jailbreak public command end (KingPin) ****************************
//************* AMX_JailBreak Cvar Start (KingPin) *********************************
public admin_jailbreak(id,level){
if (!(get_user_flags(id)&level)){
console_print(id," 你没权力去使用那个命令.")
return PLUGIN_HANDLED
}
if (read_argc() < 2){
new jailbreak_cvar = get_cvar_num("sv_jailbreak")
console_print(id," ^"sv_jailbreak^" is ^"%i^"",jailbreak_cvar)
return PLUGIN_HANDLED
}
new jailbreak
read_argv(1,jailbreak,6)
server_cmd("sv_jailbreak %s",jailbreak)
console_print(id," 劫持监狱 被打开 %s",jailbreak)
return PLUGIN_HANDLED
}
public check_jailbreak(id){
new jailbreak = get_cvar_num("sv_jailbreak")
client_print(id,print_chat," 劫持监狱 被关闭 %i",jailbreak)
return PLUGIN_HANDLED
}
//************* AMX_JailBreak Cvar End (KingPin) *********************************
public plugin_init()
{
gmsgScoreAttrib = get_user_msgid("ScoreAttrib")
register_plugin("劫持 监狱","1.03","由UFo汉化")
register_cvar("Jail_Break","1.03",FCVAR_SERVER)
register_event("SendAudio","end_round","a","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw")
register_event("ResetHUD", "new_round", "b")
register_event("DeathMsg","death","a")
register_event("CurWeapon","switch_toknife","be","1=1","2!29")
register_clcmd("say /jailbreak","starthelp")
register_concmd("/jailbreak","starthelp",0,",: Shows a help screen about Jail Break")
register_concmd("amx_jailbreak","admin_jailbreak",ADMIN_LEVEL_A,"0/1")
register_menucmd(register_menuid("Terrorist_Select"),1023,"skin_selected")
register_menucmd(register_menuid("CT_Select"),1023,"skin_selected")
register_menucmd(-26,1023,"skin_selected") // VGUI
register_menucmd(-27,1023,"skin_selected") // VGUI
register_cvar("sv_jailbreak","1",0)
set_task(10.0,"check_alive",456,"",0,"b")
set_task(2.0,"create_jail",987,"",0,"b")
set_task(1.0,"check_position",963,"",0,"b")
return PLUGIN_CONTINUE
}

jim_yang 发表于 2008-4-23 16:05:52

回复: 点通高手们来看看这个监狱插件能修改吗~~!

在amxx下面重新编译一下

731 发表于 2008-4-23 17:33:01

回复: 点通高手们来看看这个监狱插件能修改吗~~!

编译出错!jim_yang 大哥。

jim_yang 发表于 2008-4-23 17:47:43

回复: 点通高手们来看看这个监狱插件能修改吗~~!

把"state"改成"status"

731 发表于 2008-4-23 19:57:01

回复: 点通高手们来看看这个监狱插件能修改吗~~!

编译通过!不知道还会不会当机,试下先。谢谢jim_yang的鼎力相助!

731 发表于 2008-4-23 20:23:48

回复: 点通高手们来看看这个监狱插件能修改吗~~!

jim_yang 大哥我又有麻烦事来麻烦你了,能不能帮我改成地图开始前2局使用监狱模式?

731 发表于 2008-4-24 21:37:04

回复: 点通高手们来看看这个监狱插件能修改吗~~!jim_yang点通的前辈们来!

继续顶起~~~!顶到前辈们来。
页: [1]
查看完整版本: 点通高手们来看看这个监狱插件能修改吗~~!jim_yang点通的前辈们来!