请谁能帮忙在这原码上加个功能........(解决问题了谢谢).
同队闪光无效插件想加个功能:被敌人或自己闪到屏幕为蓝色,观察者屏幕也是蓝色更好.....#include <amxmodx>
#include <fakemeta>
#include <cstrike>
#include <csx>
// 被队友闪后的颜色(R, G, B)
new const COLOR={0, 0, 0}
enum FLASH{
Float:GameTime,
Duration,
HoldTime,
FadeType,
Alpha
}
new PLAYER
new pTeamFlashed
new gMsgScreenFade
new gMaxPlayers
new const FLASHSOUND[]={
"weapons/flashbang-1.wav",
"weapons/flashbang-2.wav"
}
public plugin_init()
{
register_plugin("poop", "1.0", "A.MI")
register_forward(FM_EmitSound, "fw_FM_EmitSound")
register_event("ScreenFade", "event_ScreenFade", "be", "4=255", "5=255", "6=255", "7>199")
pTeamFlashed = register_cvar("team_flashed", "1")
gMsgScreenFade = get_user_msgid("ScreenFade")
gMaxPlayers = get_maxplayers()
}
public fw_FM_EmitSound(entity, channel, const sample[], Float:volume, Float:attenuation, fFlags, pitch)
{
if(!get_pcvar_num(pTeamFlashed))
return FMRES_IGNORED
// 闪光?
if(!equali(sample, FLASHSOUND) && !equali(sample, FLASHSOUND))
return FMRES_IGNORED
static flashed, Float:time, name, flasher, team
flashed = 0
flasher = pev(entity, pev_iuser3)
team = pev(entity, pev_iuser4)
time = get_gametime()
get_user_name(flasher, name, 31)
if (is_user_connected(flasher)){
for(new id=1; id<=gMaxPlayers; id++){
if (is_user_connected(id)&& PLAYER==time&& team==get_user_team(id)&& flasher!=id){
FlashedEvent(id, PLAYER, PLAYER, PLAYER, COLOR, COLOR, COLOR, PLAYER)
flashed = 1
}
}
if (flashed){
client_print(flasher, print_chat, "* 警 告: 你 已 闪 中 队 友");
}
}
return FMRES_IGNORED
}
// 记录被闪的人的闪光信息
public event_ScreenFade(id)
{
PLAYER = _:get_gametime()
PLAYER = read_data(1)
PLAYER = read_data(2)
PLAYER = read_data(3)
PLAYER = 0
}
// 记录仍雷人的信息
public grenade_throw(id, entity, WpnID)
{
if (WpnID == CSW_FLASHBANG)
{
set_pev(entity, pev_iuser3, id) // 这个雷是谁的
set_pev(entity, pev_iuser4, get_user_team(id)) // 他的队伍是?
}
}
// 发送闪光效果
stock FlashedEvent(id, iDuration, iHoldTime, iFadeType, iRed, iGreen, iBlue, iAlpha)
{
message_begin(MSG_ONE, gMsgScreenFade, {0,0,0}, id)
write_short(iDuration) // Duration
write_short(iHoldTime) // Hold time
write_short(iFadeType) // Fade type
write_byte (iRed) // Red
write_byte (iGreen) // Green
write_byte (iBlue) // Blue
write_byte (iAlpha) // Alpha
message_end()
}
回复: 请谁能帮忙在这原码上加个功能.........
没试过,你自己试吧,思路大概是这样了#include <amxmodx>
#include <fakemeta>
#include <cstrike>
#include <csx>
// 被队友闪后的颜色(R, G, B)
new const COLOR={0, 0, 0}
//闪到自己或观察者或是被敌人闪中颜色
new const COLOR2={20, 120, 255}
enum FLASH{
Float:GameTime,
Duration,
HoldTime,
FadeType,
Alpha
}
new PLAYER
new pTeamFlashed
new gMsgScreenFade
new gMaxPlayers
new const FLASHSOUND[]={
"weapons/flashbang-1.wav",
"weapons/flashbang-2.wav"
}
public plugin_init()
{
register_plugin("poop", "1.0", "A.MI")
register_forward(FM_EmitSound, "fw_FM_EmitSound")
register_event("ScreenFade", "event_ScreenFade", "be", "4=255", "5=255", "6=255", "7>199")
pTeamFlashed = register_cvar("team_flashed", "1")
gMsgScreenFade = get_user_msgid("ScreenFade")
gMaxPlayers = get_maxplayers()
}
public fw_FM_EmitSound(entity, channel, const sample[], Float:volume, Float:attenuation, fFlags, pitch)
{
if(!get_pcvar_num(pTeamFlashed))
return FMRES_IGNORED
// 闪光?
if(!equali(sample, FLASHSOUND) && !equali(sample, FLASHSOUND))
return FMRES_IGNORED
static flashed, Float:time, name, flasher, team
flashed = 0
flasher = pev(entity, pev_iuser3)
team = pev(entity, pev_iuser4)
time = get_gametime()
get_user_name(flasher, name, 31)
if (is_user_connected(flasher))
{
for(new id=1; id<=gMaxPlayers; id++)
{
if(!is_user_connected(id)) continue;
if (PLAYER==time&& team==get_user_team(id)&& flasher!=id)
{
FlashedEvent(id, PLAYER, PLAYER, PLAYER, COLOR, COLOR, COLOR, PLAYER)
flashed = 1
}else if(flasher==id||(get_user_team(flasher)!=get_user_team(id))||get_user_team(id)==3)
FlashedEvent(id, PLAYER, PLAYER, PLAYER, COLOR2, COLOR2, COLOR2, PLAYER);
}
if (flashed)
{
client_print(flasher, print_chat, "* 警 告: 你 已 闪 中 队 友");
}
}
return FMRES_IGNORED
}
// 记录被闪的人的闪光信息
public event_ScreenFade(id)
{
PLAYER = _:get_gametime()
PLAYER = read_data(1)
PLAYER = read_data(2)
PLAYER = read_data(3)
PLAYER = 0
}
// 记录仍雷人的信息
public grenade_throw(id, entity, WpnID)
{
if (WpnID == CSW_FLASHBANG)
{
set_pev(entity, pev_iuser3, id) // 这个雷是谁的
set_pev(entity, pev_iuser4, get_user_team(id)) // 他的队伍是?
}
}
// 发送闪光效果
stock FlashedEvent(id, iDuration, iHoldTime, iFadeType, iRed, iGreen, iBlue, iAlpha)
{
message_begin(MSG_ONE, gMsgScreenFade, {0,0,0}, id)
write_short(iDuration) // Duration
write_short(iHoldTime) // Hold time
write_short(iFadeType) // Fade type
write_byte (iRed) // Red
write_byte (iGreen) // Green
write_byte (iBlue) // Blue
write_byte (iAlpha) // Alpha
message_end()
}
回复: 请谁能帮忙在这原码上加个功能.........
请不要随便的把原来作者的名字换成自己的!毕竟是别人的原创作品!
又不是自己源码全部是自己写的,把自己的名字改上去,怎么看着那么别扭!!
大家还是注意这一点的好,毕竟别人写的源码也不容易!
请保留对原创作者的最起码尊重!!!!!!
回复: 请谁能帮忙在这原码上加个功能.........
Post by baili1258请不要随便的把原来作者的名字换成自己的!
毕竟是别人的原创作品!
又不是自己源码全部是自己写的,把自己的名字改上去,怎么看着那么别扭!!
大家还是注意这一点的好,毕竟别人写的源码也不容易!
请保留对原创作者的最起码尊重!!!!!!
俺知道...但得到的原码已是非原码.......
何况我也没该成自己的名字啊....
感谢zwfgdlc版主.....测试出来有个问题.....就是你闪中敌方自己屏幕也是蓝色.....问题出现在哪里呢?请帮忙仔细看一下...
回复: 请谁能帮忙在这原码上加个功能.........
public fw_FM_EmitSound(entity, channel, const sample[], Float:volume, Float:attenuation, fFlags, pitch){
if(!get_pcvar_num(pTeamFlashed))
return FMRES_IGNORED
// 闪光?
if(!equali(sample, FLASHSOUND) && !equali(sample, FLASHSOUND))
return FMRES_IGNORED
static flashed, Float:time, name, flasher, team
flashed = 0
flasher = pev(entity, pev_iuser3)
team = pev(entity, pev_iuser4)
time = get_gametime()
get_user_name(flasher, name, 31)
if (is_user_connected(flasher))
{
for(new id=1; id<=gMaxPlayers; id++)
{
if(!is_user_connected(id)) continue;
if (PLAYER==time&& team==get_user_team(id)&& flasher!=id)
{
FlashedEvent(id, PLAYER, PLAYER, PLAYER, COLOR, COLOR, COLOR, PLAYER)
flashed = 1
}else if((get_user_team(flasher)!=get_user_team(id))||get_user_team(id)==3)
FlashedEvent(id, PLAYER, PLAYER, PLAYER, COLOR2, COLOR2, COLOR2, PLAYER);
}
if (flashed)
{
client_print(flasher, print_chat, "* 警 告: 你 已 闪 中 队 友");
}
}
return FMRES_IGNORED
}
这样试下!!
希望你说的是真的...
回复: 请谁能帮忙在这原码上加个功能.........
#include <amxmodx>
#include <fakemeta>
#include <cstrike>
#include <csx>
// 被队友闪后的颜色(R, G, B)
new const COLOR={0, 0, 0}
//闪到自己或观察者或是被敌人闪中颜色
new const COLOR2={20, 120, 255}
enum FLASH{
Float:GameTime,
Duration,
HoldTime,
FadeType,
Alpha
}
new PLAYER
new pTeamFlashed
new gMsgScreenFade
new gMaxPlayers
new const FLASHSOUND[]={
"weapons/flashbang-1.wav",
"weapons/flashbang-2.wav"
}
public plugin_init()
{
register_plugin("poop", "1.0", "A.MI")
register_forward(FM_EmitSound, "fw_FM_EmitSound")
register_event("ScreenFade", "event_ScreenFade", "be", "4=255", "5=255", "6=255", "7>199")
pTeamFlashed = register_cvar("team_flashed", "1")
gMsgScreenFade = get_user_msgid("ScreenFade")
gMaxPlayers = get_maxplayers()
}
public fw_FM_EmitSound(entity, channel, const sample[], Float:volume, Float:attenuation, fFlags, pitch)
{
if(!get_pcvar_num(pTeamFlashed))
return FMRES_IGNORED
// 闪光?
if(!equali(sample, FLASHSOUND) && !equali(sample, FLASHSOUND))
return FMRES_IGNORED
static flashed, Float:time, name, flasher, team
flashed = 0
flasher = pev(entity, pev_iuser3)
team = pev(entity, pev_iuser4)
time = get_gametime()
get_user_name(flasher, name, 31)
if (is_user_connected(flasher))
{
for(new id=1; id<=gMaxPlayers; id++)
{
if(!is_user_connected(id)) continue;
if (PLAYER==time&& team==get_user_team(id)&& flasher!=id)
{
FlashedEvent(id, PLAYER, PLAYER, PLAYER, COLOR, COLOR, COLOR, PLAYER)
flashed = 1
}else if(PLAYER==time&&(flasher==id||get_user_team(id)==3||(get_user_team(flasher)!=get_user_team(id))))
FlashedEvent(id, PLAYER, PLAYER, PLAYER, COLOR2, COLOR2, COLOR2, PLAYER);
}
if (flashed)
{
client_print(flasher, print_chat, "* 警 告: 你 已 闪 中 队 友");
}
}
return FMRES_IGNORED
}
// 记录被闪的人的闪光信息
public event_ScreenFade(id)
{
PLAYER = _:get_gametime()
PLAYER = read_data(1)
PLAYER = read_data(2)
PLAYER = read_data(3)
PLAYER = 0
}
// 记录仍雷人的信息
public grenade_throw(id, entity, WpnID)
{
if (WpnID == CSW_FLASHBANG)
{
set_pev(entity, pev_iuser3, id) // 这个雷是谁的
set_pev(entity, pev_iuser4, get_user_team(id)) // 他的队伍是?
}
}
// 发送闪光效果
stock FlashedEvent(id, iDuration, iHoldTime, iFadeType, iRed, iGreen, iBlue, iAlpha)
{
message_begin(MSG_ONE, gMsgScreenFade, {0,0,0}, id)
write_short(iDuration) // Duration
write_short(iHoldTime) // Hold time
write_short(iFadeType) // Fade type
write_byte (iRed) // Red
write_byte (iGreen) // Green
write_byte (iBlue) // Blue
write_byte (iAlpha) // Alpha
message_end()
}
回复: 请谁能帮忙在这原码上加个功能.........
观察员还是白茫茫.....这个较难点...回复: 请谁能帮忙在这原码上加个功能.........
试下这样#include <amxmodx>
#include <fakemeta>
#include <cstrike>
#include <csx>
// 被队友闪后的颜色(R, G, B)
new const COLOR={0, 0, 0}
//闪到自己或观察者或是被敌人闪中颜色
new const COLOR2={20, 120, 255}
enum FLASH{
Float:GameTime,
Duration,
HoldTime,
FadeType,
Alpha
}
new PLAYER
new pTeamFlashed
new gMsgScreenFade
new gMaxPlayers
new const FLASHSOUND[]={
"weapons/flashbang-1.wav",
"weapons/flashbang-2.wav"
}
public plugin_init()
{
register_plugin("poop", "1.0", "A.MI")
register_forward(FM_EmitSound, "fw_FM_EmitSound")
register_event("ScreenFade", "event_ScreenFade", "be", "4=255", "5=255", "6=255", "7>199")
pTeamFlashed = register_cvar("team_flashed", "1")
gMsgScreenFade = get_user_msgid("ScreenFade")
gMaxPlayers = get_maxplayers()
}
public fw_FM_EmitSound(entity, channel, const sample[], Float:volume, Float:attenuation, fFlags, pitch)
{
if(!get_pcvar_num(pTeamFlashed))
return FMRES_IGNORED
// 闪光?
if(!equali(sample, FLASHSOUND) && !equali(sample, FLASHSOUND))
return FMRES_IGNORED
static flashed, Float:time, name, flasher, team
flashed = 0
flasher = pev(entity, pev_iuser3)
team = pev(entity, pev_iuser4)
time = get_gametime()
get_user_name(flasher, name, 31)
if (is_user_connected(flasher))
{
for(new id=1; id<=gMaxPlayers; id++)
{
if(!is_user_connected(id)) continue;
if(get_user_team(id)==3) continue;
if (PLAYER==time&& team==get_user_team(id)&& flasher!=id)
{
FlashedEvent(id, PLAYER, PLAYER, PLAYER, COLOR, COLOR, COLOR, PLAYER)
flashed = 1
}else if(PLAYER==time&&(flasher==id||(team!=get_user_team(id))))
FlashedEvent(id, PLAYER, PLAYER, PLAYER, COLOR2, COLOR2, COLOR2, PLAYER);
}
if (flashed)
{
client_print(flasher, print_chat, "* 警 告: 你 已 闪 中 队 友");
}
}
return FMRES_IGNORED
}
// 记录被闪的人的闪光信息
public event_ScreenFade(id)
{
if(get_user_team(id)==3)
{
FlashedEvent(id, read_data(1), read_data(2), read_data(3), COLOR2, COLOR2, COLOR2, read_data(7));
return PLUGIN_HANDLED;
}
PLAYER = _:get_gametime()
PLAYER = read_data(1)
PLAYER = read_data(2)
PLAYER = read_data(3)
PLAYER = 0
return PLUGIN_HANDLED;
}
// 记录仍雷人的信息
public grenade_throw(id, entity, WpnID)
{
if (WpnID == CSW_FLASHBANG)
{
set_pev(entity, pev_iuser3, id) // 这个雷是谁的
set_pev(entity, pev_iuser4, get_user_team(id)) // 他的队伍是?
}
}
// 发送闪光效果
stock FlashedEvent(id, iDuration, iHoldTime, iFadeType, iRed, iGreen, iBlue, iAlpha)
{
message_begin(MSG_ONE, gMsgScreenFade, {0,0,0}, id)
write_short(iDuration) // Duration
write_short(iHoldTime) // Hold time
write_short(iFadeType) // Fade type
write_byte (iRed) // Red
write_byte (iGreen) // Green
write_byte (iBlue) // Blue
write_byte (iAlpha) // Alpha
message_end()
}
回复: 请谁能帮忙在这原码上加个功能.........
多次麻烦....很感谢......但问题依旧.....看来它是个大难题....(解决这个问题主要是保护玩家的眼睛,要不然俺也不那么强烈为难大家的....
俺问过医生,白屏幕刺眼容易得白内障.............希望大家支持解决)
下面的版主:测试成功,谢谢.
回复: 请谁能帮忙在这原码上加个功能.........
register_event("ScreenFade", "event_ScreenFade", "b", "4=255", "5=255", "6=255", "7>199")
把上面的改下试试!
页:
[1]
2