点通粉丝 发表于 2011-5-23 07:48:20

KK阿朗和龟老大有空进来看一下.代码修改

首先说一下我这个代码的功能先
这个插件.视觉效果一流..当你用小刀把人杀后
整个地图会出现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
                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
        xy = random_num(-2000,2200)
        xy = random_num(-2000,2200)
        message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
        write_byte(0)
        write_coord(xy)
        write_coord(xy)
        write_coord(4000)
        write_coord(xy)
        write_coord(xy)
        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
        xy = random_num(-2000,2200)
        xy = random_num(-2000,2200)
        message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
        write_byte(0)
        write_coord(xy)
        write_coord(xy)
        write_coord(4000)
        write_coord(xy)
        write_coord(xy)
        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
        xy = random_num(-2000,2200)
        xy = random_num(-2000,2200)
        message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
        write_byte(0)
        write_coord(xy)
        write_coord(xy)
        write_coord(4000)
        write_coord(xy)
        write_coord(xy)
        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
        xy = random_num(-2000,2200)
        xy = random_num(-2000,2200)
        message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
        write_byte(0)
        write_coord(xy)
        write_coord(xy)
        write_coord(4000)
        write_coord(xy)
        write_coord(xy)
        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
        xy = random_num(-2000,2200)
        xy = random_num(-2000,2200)
        message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
        write_byte(0)
        write_coord(xy)
        write_coord(xy)
        write_coord(4000)
        write_coord(xy)
        write_coord(xy)
        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
        xy = random_num(-2000,2200)
        xy = random_num(-2000,2200)
        message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
        write_byte(0)
        write_coord(xy)
        write_coord(xy)
        write_coord(4000)
        write_coord(xy)
        write_coord(xy)
        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")
}

点通粉丝 发表于 2011-5-23 07:52:24

你们再看一下..我在这个代码基楚改的另一个效果图.CS1.5也可以下雨下雪了..下一步希望能实现有雾

点通粉丝 发表于 2011-5-23 07:57:06

龟老大..和点通的高手们帮帮忙啊..这个是为一可实现CS1.5可下雨下雪.和闪电的代来的
还喜欢cs1.5的朋友帮手顶起

381828358 发表于 2011-5-23 08:03:35

顶一下。好东西。1.5有这个才丰富

点通粉丝 发表于 2011-5-23 08:05:06

我主要是希望可改成像
服务器每30秒自动.发动地震插件
那样的效果..

381828358 发表于 2011-5-23 08:18:42

本帖最后由 381828358 于 2011-5-23 08:34 编辑

顺便发下下雪的插件源码给高手改一下。我觉得形状不是很自然。如果能改一下形状 不要那个密集

好东西只要高手能解决了、

就牛逼了、

rsdtt 发表于 2011-5-23 15:27:44

5# 点通粉丝

地震
screen_shake(id, amplitude = 4, duration = 2, frequency = 10)
{
        message_begin(MSG_ONE_UNRELIABLE, g_msgScreenShake, _, id)
        write_short(UNIT_SECOND*amplitude) // 振幅
        write_short(UNIT_SECOND*duration) // 时间
        write_short(UNIT_SECOND*frequency) // 频率
        message_end()
}

每30秒用set_task

rsdtt 发表于 2011-5-23 15:28:20

http://www.amxmodx.org/funcwiki.php?search=set_task&go=search

wk703 发表于 2011-5-26 08:49:38

我顶,点通粉丝真不愧为1.5娱乐之王啊
页: [1]
查看完整版本: KK阿朗和龟老大有空进来看一下.代码修改