|
对了,就是waterworld.amxx这个插件插件,开启插件之后进入游戏发现,玩家附近的区域范围是看得见的,但向远处看去则看不见任何东西,一片漆黑,只有不断向前移动才能看得见更远的地方。不知哪个高手能帮忙修改一下,让水世界不再黑暗,不仅能看到近处的,也可以看到远处的地方,即修改一下waterworld.sma的亮度。
下面是水世界的源代码:
#include <amxmodx>
#include <engine>
#include <csx>
new bubbleSprite
new lastwpn[33]
new lastammo[33]
new GrenOldOrigin[3]
new bool:canswim[33]
new bool:Swim[33]
public plugin_init()
{
register_plugin("Water World", "1.60", "C.H.M")
register_event("CurWeapon", "BulletEffect", "be", "3>0")
register_cvar("amx_water_world", "1")
register_cvar("amx_water_gravity", "300")
register_cvar("amx_water_swimspeed", "280")
set_task(1.0, "check_cvars",_,_,_, "b")
}
public plugin_precache()
{
bubbleSprite = precache_model("sprites/bubble.spr")
}
public client_connect(id)
{
canswim[id] = false
Swim[id] = false
}
public check_cvars()
{
if(get_cvar_num("amx_water_world") <= 0)
server_cmd("sv_gravity 800")
else if(get_cvar_num("amx_water_world") >= 1)
server_cmd("sv_gravity %d", get_cvar_num("amx_water_gravity"))
return PLUGIN_CONTINUE
}
public client_PreThink(id)
{
if(get_cvar_num("amx_water_world") <= 0)
return PLUGIN_CONTINUE
if(!is_user_connected(id) || !is_user_alive(id))
return PLUGIN_CONTINUE
if(get_user_button(id) & IN_FORWARD && !(get_user_oldbutton(id) & IN_FORWARD))
{
if(canswim[id] == false)
{
new pstr[2]
pstr[0] = id
set_task(0.5, "can_switch", 0, pstr, 1)
canswim[id] = true
return PLUGIN_CONTINUE
}
if(canswim[id] == true)
{
Swim[id] = true
canswim[id] = false
return PLUGIN_CONTINUE
}
else
{
canswim[id] = false
new pstr[2]
pstr[0] = id
set_task(0.5, "can_switch", 0, pstr, 1)
canswim[id] = true
return PLUGIN_CONTINUE
}
}
return PLUGIN_CONTINUE
}
public client_PostThink(id)
{
if(get_cvar_num("amx_water_world") <= 0)
return PLUGIN_CONTINUE
if(!is_user_connected(id) || !is_user_alive(id))
return PLUGIN_CONTINUE
entity_set_int(id, EV_INT_waterlevel, 5)
entity_set_float(id, EV_FL_air_finished, entity_get_float(id, EV_FL_air_finished ) + 2.0)
if(Swim[id] == true)
{
new Float:Velocity[3]
VelocityByAim(id, get_cvar_num("amx_water_swimspeed"), Velocity)
entity_set_vector(id, EV_VEC_velocity, Velocity)
Swim[id] = false
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}
public can_switch(pstr[])
{
new id = pstr[0]
canswim[id] = false
}
public grenade_throw(index, greindex, wId)
{
if(get_cvar_num("amx_water_world") <= 0)
return PLUGIN_CONTINUE
new iPlayerOrigin[3]
get_user_origin(index, iPlayerOrigin, 1)
make_bubbles(greindex, iPlayerOrigin)
return PLUGIN_CONTINUE
}
public make_bubbles(entity, iOldOrigin[3])
{
if(!is_valid_ent(entity))
return PLUGIN_CONTINUE
new iGrenadeOrigin[3], Float:fGrenadeOrigin[3]
entity_get_vector(entity, EV_VEC_origin, fGrenadeOrigin)
FVecIVec(fGrenadeOrigin, iGrenadeOrigin)
Bubbles(iOldOrigin, iGrenadeOrigin)
new param[1]
param[0] = entity
GrenOldOrigin = iGrenadeOrigin
set_task(0.1, "loop_bubbles", 0, param, 1)
return PLUGIN_CONTINUE
}
public loop_bubbles(param[])
{
new entity = param[0]
if(!is_valid_ent(entity))
return PLUGIN_CONTINUE
new iGrenadeOrigin[3], Float:fGrenadeOrigin[3]
entity_get_vector(entity, EV_VEC_origin, fGrenadeOrigin)
FVecIVec(fGrenadeOrigin, iGrenadeOrigin)
Bubbles(GrenOldOrigin, iGrenadeOrigin)
GrenOldOrigin = iGrenadeOrigin
set_task(0.1, "loop_bubbles", 0, param, 1)
return PLUGIN_CONTINUE
}
public BulletEffect(id)
{
if(get_cvar_num("amx_water_world") <= 0)
return PLUGIN_CONTINUE
new wpn = read_data(2)
new ammo = read_data(3)
if(lastwpn[id] == wpn && lastammo[id] > ammo)
{
new PlayerOrigin[3], BulletOrigin[3]
get_user_origin(id, PlayerOrigin, 1)
get_user_origin(id, BulletOrigin, 4)
Bubbles(PlayerOrigin, BulletOrigin)
}
lastwpn[id] = wpn
lastammo[id] = ammo
return PLUGIN_CONTINUE
}
stock Bubbles(StartOrigin[3], EndOrigin[3])
{
message_begin(MSG_BROADCAST, SVC_TEMPENTITY, EndOrigin)
write_byte(114)
write_coord(StartOrigin[0])
write_coord(StartOrigin[1])
write_coord(StartOrigin[2])
write_coord(EndOrigin[0])
write_coord(EndOrigin[1])
write_coord(EndOrigin[2])
write_coord(40)
write_short(bubbleSprite)
write_byte(10)
write_coord(40)
message_end()
} |
|