nwb13请进 !(源码修改)
以下内容为amx0.99的mapconfig.sma的源码,我想在amxx1.0下使用这个插件。请您抽空帮忙修改一下 !
/* AMX Mod script.
*
* Custom Map Configs 0.8
*Set map-specific variables and commands
*
* by JustinHoMi (justin@justinmitchell.net)
*http://www.modkillers.com
*#modkillers in irc.gamesnet.net
*
* Place your custom configs in the designated folder
*(addons/amx/map_configs by default)
* Configs should be in the format "mapname.cfg"
* Insert any cvar or cmd to be executed at map change
*
* Changelog:
*0.9.9 - Added translations support for AMX Mod 0.9.9
*0.61- Changes load delay to 6s (to work better with SQL ServerCfg)
*0.6 - Execs configs rather than loading file
* - Delays execution for 5s after map changes
*0.5 - Initial release
*
*/
#include <translator>
#include <amxmod>
#include <amxmisc>
new currentmap
public plugin_init(){
load_translations("mapconfig")
register_plugin(_T("Custom Map Configs"),"0.9.9","JustinHoMi")
new filename, filepath
get_basedir(filepath, 63)
get_mapname(currentmap,31)
new len = format(filename,127,"%s/config/maps/%s.cfg",filepath,currentmap)
if (file_exists(filename))
{
set_task(6.1,"delayed_load",0,filename,len+1)
}
}
public delayed_load(filename[])
{
server_print(_T("Loading custom map config for %s"), currentmap)
server_cmd("exec %s",filename)
}
谢谢 !期待你的回复 。。。。 授人之鱼不如授人之渔
来看看怎么修改吧
#include <translator> 这个是0.99专用的,在amxx里是不存在的,于是删掉
#include <amxmod> 这个修不修改都一样,amxx里可兼容大部分的amx代码
#include <amxmisc> amx和amxx基本相似,可以不用改
new currentmap
public plugin_init(){
load_translations("mapconfig") 0.99专用,在amxx里是register_dictionary来实现的
register_plugin(_T("Custom Map Configs"),"0.9.9","JustinHoMi") 注意标红色的部分,这是0.99专用的,于是删掉
new filename, filepath
get_basedir(filepath, 63) 可以不修改,但是下面的路径要修改,建议修改为get_configsdir这样更方便
get_mapname(currentmap,31)
new len = format(filename,127,"%s/config/maps/%s.cfg",filepath,currentmap) 这个取决于文件的路径了,可以按自己的需要修改
if (file_exists(filename))
{
set_task(6.1,"delayed_load",0,filename,len+1)
}
}
public delayed_load(filename[])
{
server_print(_T("Loading custom map config for %s"), currentmap) 同理,去掉0.99专用的多语言函数
server_cmd("exec %s",filename)
}
下面是修改好的,复制回去自己编译吧,配置文件在configs/maps目录下
#include <amxmodx>
#include <amxmisc>
new currentmap
public plugin_init(){
register_plugin("Custom Map Configs","0.9.9","JustinHoMi | nwb13")
new filename, filepath
get_configsdir(filepath, 63)
get_mapname(currentmap,31)
new len = format(filename,127,"%s/maps/%s.cfg",filepath,currentmap)
if (file_exists(filename))
{
set_task(6.1,"delayed_load",0,filename,len+1)
}
}
public delayed_load(filename[])
{
server_print("Loading custom map config for %s", currentmap)
server_cmd("exec %s",filename)
} 嗯,不错,这样的老师难找哦,支持 nwb13,回复好快,万分感激中。。。。。。。。 ! :79::79: Post by olol
嗯,不错,这样的老师难找哦,支持
恩`我们DT的骄傲~ :78: 详细、直观,呵呵。好老师呀。。。下次我就不愁会为一个函数的某个参数而为难了。 佩服真是强人我要好好学习 来上课了,来上课了,快坐好 呵呵~~看见难得的好贴了!
我改了一个,想用于CS1.5用的,但是有三处错误,能帮指教一下吗?
) return PLUGIN_HANDLED
slay_player(id,player,type)
}
return PLUGIN_HANDLED
}
explode(vec1) {
// blast circles
message_begin( MSG_BROADCAST,SVC_TEMPENTITY,vec1)
write_byte( 21 )
write_coord(vec1)
write_coord(vec1)
write_coord(vec1 + 16)
write_coord(vec1)
write_coord(vec1)
write_coord(vec1 + 1936)
write_short( s2white )
write_byte( 0 ) // startframe
write_byte( 0 ) // framerate
write_byte( 2 ) // life
write_byte( 16 ) // width
write_byte( 0 ) // noise
write_byte( 188 ) // r
write_byte( 220 ) // g
write_byte( 255 ) // b
write_byte( 255 ) //brightness
write_byte( 0 ) // speed
message_end()
//Explosion2
message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
write_byte( 12 )
write_coord(vec1)
write_coord(vec1)
write_coord(vec1)
write_byte( 188 ) // byte (scale in 0.1's)
write_byte( 10 ) // byte (framerate)
message_end()
//s2smoke
message_begin( MSG_BROADCAST,SVC_TEMPENTITY,vec1) write_byte( 5 )
write_coord(vec1)
write_coord(vec1)
write_coord(vec1)
write_short( s2smoke )
write_byte( 2 )
write_byte( 10 )
message_end()
}
blood(vec1) {
//LAVASPLASH
message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
write_byte( 10 )
write_coord(vec1)
write_coord(vec1)
write_coord(vec1)
message_end()
}
lightning(vec1,vec2) {
//Lightning
message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
write_byte( 0 )
write_coord(vec1)
write_coord(vec1)
write_coord(vec1)
write_coord(vec2)
write_coord(vec2)
write_coord(vec2)
write_short( light )
write_byte( 1 ) // framestart
write_byte( 5 ) // framerate
write_byte( 2 ) // life
write_byte( 20 ) // width
write_byte( 30 ) // noise
write_byte( 200 ) // r, g, b
write_byte( 200 ) // r, g, b
write_byte( 200 ) // r, g, b
write_byte( 200 ) // brightness
write_byte( 200 ) // speed
message_end()
//Sparks
message_begin( MSG_PVS, SVC_TEMPENTITY,vec2)
write_byte( 9 )
write_coord( vec2 )
write_coord( vec2 )
write_coord( vec2 )
message_end()
//s2smoke
message_begin( MSG_BROADCAST,SVC_TEMPENTITY,vec2)
write_byte( 5 )
write_coord(vec2)
write_coord(vec2)
write_coord(vec2)
write_short( s2smoke )
write_byte( 10 )
write_byte( 10 )
message_end()
}
//ADMIN FIRE v1.0.0 by f117bomb
//=========================================================
new gmsgDamage,smoke,mflash
new onfire
public ignite_effects(skIndex[]) {
new kIndex = skIndex
gmsgDamage = get_user_msgid("Damage")
if (is_user_alive(kIndex) && onfire ) {
new korigin
get_user_origin(kIndex,korigin)
//TE_SPRITE - additive sprite, plays 1 cycle
message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
write_byte( 17 )
write_coord(korigin)// coord, coord, coord (position)
write_coord(korigin)
write_coord(korigin)
write_short( mflash ) // short (sprite index)
write_byte( 20 ) // byte (scale in 0.1's)
write_byte( 200 ) // byte (brightness)
message_end()
//Smoke
message_begin( MSG_BROADCAST,SVC_TEMPENTITY,korigin)
write_byte( 5 )
write_coord(korigin)// coord coord coord (position)
write_coord(korigin)
write_coord(korigin)
write_short( smoke )// short (sprite index)
write_byte( 20 ) // byte (scale in 0.1's)
write_byte( 15 ) // byte (framerate)
message_end()
set_task(0.2, "ignite_effects" , 0 , skIndex, 2)
}
else {
if( onfire ) {
emit_sound(kIndex,CHAN_AUTO, "scientist/scream21.wav", 0.6, ATTN_NORM, 0, PITCH_HIGH)
onfire = 0
}
}
return PLUGIN_CONTINUE
}
public ignite_player(skIndex[]) {
new kIndex = skIndex
if (is_user_alive(kIndex) && onfire ) {
new korigin
new players, inum = 0
new pOrigin
new kHeath = get_user_health(kIndex)
get_user_origin(kIndex,korigin)
//create some damage
set_user_health(kIndex,kHeath - 10)
message_begin(MSG_ONE, gmsgDamage, {0,0,0}, kIndex)
write_byte(30) // dmg_save
write_byte(30) // dmg_take
write_long(1<<21) // visibleDamageBits
write_coord(korigin) // damageOrigin.x
write_coord(korigin) // damageOrigin.y
write_coord(korigin) // damageOrigin.z
message_end()
//create some sound
emit_sound(kIndex,CHAN_ITEM, "ambience/flameburst1.wav", 0.6, ATTN_NORM, 0, PITCH_NORM)
//Ignite Others
get_players(players,inum,"a")
for(new i = 0 ;i < inum; ++i) {
get_user_origin(players,pOrigin)
if( get_distance(korigin,pOrigin) < 100) {
if( !onfire] ) {
new spIndex
spIndex = players
new pName, kName
get_user_name(players,pName,31)
get_user_name(kIndex,kName,31)
emit_sound(players,CHAN_WEAPON ,"scientist/scream07.wav", 1.0, ATTN_NORM, 0, PITCH_HIGH)
client_print(0,3,"* OH! NO! fire %s let %s give !",kName,pName)
onfire] =1
ignite_player(players)
ignite_effects(players)
}
}
}
players = 0
pOrigin = 0
korigin = 0
//Call Again in 2 seconds
set_task(2.0, "ignite_player" , 0 , skIndex, 2)
}
return PLUGIN_CONTINUE
}
public fire_player(id,level,cid) {
if (!cmd_access(id,level,cid,2))
return PLUGIN_HANDLED
new arg
read_argv(1,arg,31)
new victim = cmd_target(id,arg,7)
if (!victim)
return PLUGIN_HANDLED
new skIndex
skIndex = victim
new name
get_user_name(victim,name,31)
onfire = 1
ignite_effects(skIndex)
ignite_player(skIndex)
new adminname
get_user_name(id,adminname,31)
switch(get_cvar_num("amx_show_activity")) {
case 2: client_print(0,print_chat," OP %s: 对 %s fire.",adminname,name)
case 1: client_print(0,print_chat," OP: 对 %s fire.",name)
}
console_print(id,"Client ^"%s^" has been set on fire...",name)
log_amx("ADMIN FIRE - this command was issued by %s. Admin has set fire to %s",adminname,name)
return PLUGIN_HANDLED
}
//ADMIN ROCKET v1.3 by f117bomb
//=========================================================
newm_blueflare2,rmflash,rgmsgDamage,white,rsmoke,rocket_z
public rocket_liftoff(svictim[]) {
new victim = svictim
set_user_gravity(victim,-0.50)
client_cmd(victim,"+jump;wait;wait;-jump")
emit_sound(victim, CHAN_VOICE, "weapons/rocket1.wav", 1.0, 0.5, 0, PITCH_NORM)
rocket_effects(svictim)
return PLUGIN_CONTINUE
}
public rocket_effects(svictim[]) {
new victim = svictim
if ( is_user_alive(victim) ) {
new vorigin
get_user_origin(victim,vorigin)
message_begin(MSG_ONE, rgmsgDamage, {0,0,0}, victim)
write_byte(30) // dmg_save
write_byte(30) // dmg_take
write_long(1<<16) // visibleDamageBits
write_coord(vorigin) // damageOrigin.x
write_coord(vorigin) // damageOrigin.y
write_coord(vorigin) // damageOrigin.z
message_end()
if(rocket_z == vorigin)
rocket_explode(svictim)
rocket_z = vorigin
//Draw Trail and effects
//TE_SPRITETRAIL - line of moving glow sprites with gravity, fadeout, and collisions
message_begin( MSG_BROADCAST, SVC_TEMPENTITY )
write_byte( 15 )
write_coord( vorigin) // coord, coord, coord (start)
write_coord( vorigin)
write_coord( vorigin)
write_coord( vorigin) // coord, coord, coord (end)
write_coord( vorigin)
write_coord( vorigin - 30)
write_short( m_blueflare2 ) // short (sprite index)
write_byte( 5 ) // byte (count)
write_byte( 1 ) // byte (life in 0.1's)
write_byte( 1 )// byte (scale in 0.1's)
write_byte( 10 ) // byte (velocity along vector in 10's)
write_byte( 5 )// byte (randomness of velocity in 10's)
message_end()
//TE_SPRITE - additive sprite, plays 1 cycle
message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
write_byte( 17 )
write_coord(vorigin)// coord, coord, coord (position)
write_coord(vorigin)
write_coord(vorigin - 30)
write_short( rmflash ) // short (sprite index)
write_byte( 15 ) // byte (scale in 0.1's)
write_byte( 255 ) // byte (brightness)
message_end()
set_task(0.2, "rocket_effects" , 0 , svictim, 2)
}
return PLUGIN_CONTINUE
}
public rocket_explode(svictim[]) {
new victim = svictim
if ( is_user_alive(victim) ) { /*If user is alive create effects and user_kill */
new vec1
get_user_origin(victim,vec1)
// blast circles
message_begin( MSG_BROADCAST,SVC_TEMPENTITY,vec1)
write_byte( 21 )
write_coord(vec1)
write_coord(vec1)
write_coord(vec1 - 10)
write_coord(vec1)
write_coord(vec1)
write_coord(vec1 + 1910)
write_short( white )
write_byte( 0 ) // startframe
write_byte( 0 ) // framerate
write_byte( 2 ) // life
write_byte( 16 ) // width
write_byte( 0 ) // noise
write_byte( 188 ) // r
write_byte( 220 ) // g
write_byte( 255 ) // b
write_byte( 255 ) //brightness
write_byte( 0 ) // speed
message_end()
//Explosion2
message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
write_byte( 12 )
write_coord(vec1)
write_coord(vec1)
write_coord(vec1)
write_byte( 188 ) // byte (scale in 0.1's)
write_byte( 10 ) // byte (framerate)
message_end()
//rsmoke
message_begin( MSG_BROADCAST,SVC_TEMPENTITY,vec1)
write_byte( 5 )
write_coord(vec1)
write_coord(vec1)
write_coord(vec1)
write_short( rsmoke )
write_byte( 2 )
write_byte( 10 )
message_end()
user_kill(victim,1)
}
//stop_sound
emit_sound(victim, CHAN_VOICE, "weapons/rocket1.wav", 0.0, 0.0, (1<<5), PITCH_NORM)
set_user_maxspeed(victim,1.0)
set_user_gravity(victim,1.00)
return PLUGIN_CONTINUE
}
public rocket_player(id,level,cid) {
if (!cmd_access(id,level,cid,2))
return PLUGIN_HANDLED
new arg,arg2
read_argv(1,arg,31)
read_argv(2,arg2,2)
if (arg=='@') {
new players, inum , name
get_players(players,inum,"ae",arg)
if (inum==0){
console_print(id," No clients in such team")
return PLUGIN_HANDLED
}
for(new a=0;a<inum;++a){
if (get_user_flags(players)&ADMIN_IMMUNITY){
get_user_name(players,name,31)
console_print(id," Skipping ^"%s^" because client has immunity",name)
continue
}
new sPlayer
sPlayer = players
emit_sound(players,CHAN_WEAPON ,"weapons/rocketfire1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
set_user_maxspeed(players,0.01)
set_task(1.2, "rocket_liftoff" , 0 , sPlayer, 2)
}
}
else {
new player = cmd_target(id,arg,7)
if (!player)
return PLUGIN_HANDLED
new sPlayer
sPlayer = player
emit_sound(player,CHAN_WEAPON ,"weapons/rocketfire1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
set_user_maxspeed(player,0.01)
set_task(1.2, "rocket_liftoff" , 0 , sPlayer, 2)
new playername
get_user_name(player,playername,31)
new name
get_user_name(id,name,31)
switch(get_cvar_num("amx_show_activity")){
case 2: client_print(0,print_chat," OP %s: let %s rocket",name,playername)
case 1: client_print(0,print_chat," OP: let %s rocket",playername)
}
console_print(id," Client ^"%s^" has been set to explode...",playername)
log_amx("ADMIN ROCKET - this command was issued by %s. Admin has created a rocket out of %s",name,playername)
}
rgmsgDamage = get_user_msgid("Damage")
return PLUGIN_HANDLED
}
public plugin_precache() {
mflash = precache_model("sprites/muzzleflash.spr")
smoke = precache_model("sprites/steam1.spr")
rmflash = precache_model("sprites/muzzleflash.spr")
m_blueflare2 = precache_model( "sprites/blueflare2.spr")
rsmoke = precache_model("sprites/steam1.spr")
white = precache_model("sprites/white.spr")
light = precache_model("sprites/lgtning.spr")
s2smoke = precache_model("sprites/steam1.spr")
s2white = precache_model("sprites/white.spr")
precache_sound( "ambience/thunder_clap.wav")
precache_sound( "weapons/headshot2.wav")
precache_sound("ambience/flameburst1.wav")
precache_sound("scientist/scream21.wav")
precache_sound("scientist/scream07.wav")
precache_sound("weapons/rocketfire1.wav")
precache_sound("weapons/rocket1.wav")
return PLUGIN_CONTINUE
} nwb13,再问一个问题。
默认为换地图之后的5秒载入指定mapconfig,请问如何修改这个默认的载入时间?我想把这个时间修改一下。
谢谢 !
页:
[1]
2