|
首先说一下我这个代码的功能先
这个插件.视觉效果一流..当你用小刀把人杀后
整个地图会出现20秒闪电打雷效果
.就想你们在这插件的基楚上修改一下..改为每20秒服务器自动出现这效果一次
而不是用刀杀人后才出现这功能谢谢....因为我觉得这代码的好处在于不用创建坐标.也可以在整个地图都看见有闪电..
来几张截图比你们看一下- #include <amxmodx>
- #include <engine>
- #define IsPlayer(%1) ( 1 <= %1 <= g_iMaxPlayers )
- new light, g_iMaxPlayers
- public plugin_init()
- {
- register_plugin("Knife Lightning", "1.0", "AMXX Community")
- register_event("DeathMsg", "evDeath", "a", "1>0")
-
- g_iMaxPlayers = get_maxplayers()
- }
- public plugin_precache()
- {
- light = precache_model("sprites/lgtning.spr")
- precache_sound("ambience/thunder_clap.wav")
- }
- public evDeath()
- {
- new iKiller = read_data(1)
- new iVictim = read_data(2)
- if(IsPlayer(iKiller) && is_user_connected(iKiller) && iKiller != iVictim)
- {
- new szWeapon[32]
- read_data(4, szWeapon, 31)
-
- if(equal(szWeapon, "knife"))
- {
- set_lights("b")
- set_task(20.0, "light_off")
-
- set_task(0.5,"lightning0",0,"",0,"a",5)
- set_task(1.0,"lightning1",0,"",0,"a",5)
- set_task(1.5,"lightning2",0,"",0,"a",5)
- set_task(2.0,"lightning3",0,"",0,"a",5)
- set_task(2.5,"lightning4",0,"",0,"a",5)
- set_task(3.0,"lightning5",0,"",0,"a",5)
- }
- }
- }
- public light_off()
- {
- set_lights("#OFF")
- }
- public lightning0()
- {
- new xy[2]
- xy[0] = random_num(-2000,2200)
- xy[1] = random_num(-2000,2200)
- message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
- write_byte(0)
- write_coord(xy[0])
- write_coord(xy[1])
- write_coord(4000)
- write_coord(xy[0])
- write_coord(xy[1])
- write_coord(-2000)
- write_short(light)
- write_byte(1) // framestart
- write_byte(5) // framerate
- write_byte(50) // life
- write_byte(200) // width
- write_byte(100) // noise
- write_byte(0) // r, g, b
- write_byte(0) // r, g, b
- write_byte(255) // r, g, b
- write_byte(200) // brightness
- write_byte(200) //
- message_end()
- }
- public lightning1()
- {
- new xy[2]
- xy[0] = random_num(-2000,2200)
- xy[1] = random_num(-2000,2200)
- message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
- write_byte(0)
- write_coord(xy[0])
- write_coord(xy[1])
- write_coord(4000)
- write_coord(xy[0])
- write_coord(xy[1])
- write_coord(-2000)
- write_short(light)
- write_byte(1) // framestart
- write_byte(5) // framerate
- write_byte(50) // life
- write_byte(200) // width
- write_byte(100) // noise
- write_byte(248) // r, g, b
- write_byte(248) // r, g, b
- write_byte(255) // r, g, b
- write_byte(200) // brightness
- write_byte(200) //
- message_end()
- }
- public lightning2()
- {
- new xy[2]
- xy[0] = random_num(-2000,2200)
- xy[1] = random_num(-2000,2200)
- message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
- write_byte(0)
- write_coord(xy[0])
- write_coord(xy[1])
- write_coord(4000)
- write_coord(xy[0])
- write_coord(xy[1])
- write_coord(-2000)
- write_short(light)
- write_byte(1) // framestart
- write_byte(5) // framerate
- write_byte(50) // life
- write_byte(200) // width
- write_byte(100) // noise
- write_byte(248) // r, g, b
- write_byte(248) // r, g, b
- write_byte(255) // r, g, b
- write_byte(200) // brightness
- write_byte(200) //
- message_end()
- }
- public lightning3()
- {
- new xy[2]
- xy[0] = random_num(-2000,2200)
- xy[1] = random_num(-2000,2200)
- message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
- write_byte(0)
- write_coord(xy[0])
- write_coord(xy[1])
- write_coord(4000)
- write_coord(xy[0])
- write_coord(xy[1])
- write_coord(-2000)
- write_short(light)
- write_byte(1) // framestart
- write_byte(5) // framerate
- write_byte(50) // life
- write_byte(200) // width
- write_byte(100) // noise
- write_byte(248) // r, g, b
- write_byte(248) // r, g, b
- write_byte(255) // r, g, b
- write_byte(200) // brightness
- write_byte(200) //
- message_end()
- }
- public lightning4()
- {
- new xy[2]
- xy[0] = random_num(-2000,2200)
- xy[1] = random_num(-2000,2200)
- message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
- write_byte(0)
- write_coord(xy[0])
- write_coord(xy[1])
- write_coord(4000)
- write_coord(xy[0])
- write_coord(xy[1])
- write_coord(-2000)
- write_short(light)
- write_byte(1) // framestart
- write_byte(5) // framerate
- write_byte(50) // life
- write_byte(200) // width
- write_byte(100) // noise
- write_byte(248) // r, g, b
- write_byte(248) // r, g, b
- write_byte(255) // r, g, b
- write_byte(200) // brightness
- write_byte(200) //
- message_end()
- }
- public lightning5()
- {
- new xy[2]
- xy[0] = random_num(-2000,2200)
- xy[1] = random_num(-2000,2200)
- message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
- write_byte(0)
- write_coord(xy[0])
- write_coord(xy[1])
- write_coord(4000)
- write_coord(xy[0])
- write_coord(xy[1])
- write_coord(-2000)
- write_short(light)
- write_byte(1) // framestart
- write_byte(5) // framerate
- write_byte(50) // life
- write_byte(200) // width
- write_byte(100) // noise
- write_byte(248) // r, g, b
- write_byte(248) // r, g, b
- write_byte(255) // r, g, b
- write_byte(200) // brightness
- write_byte(200) //
- message_end()
-
- client_cmd(0, "spk ambience/thunder_clap.wav")
- }
复制代码 |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注个册吧
×
|