|
请帮忙修改【人类力场】适合4.3以前版本使用,谢谢!- #include <amxmodx>
- #include <zombieplague>
- #include <fakemeta_util>
- #include <fun>
- new campoforze
- new bool:campodefuerza[33] = false
- new stuck[33]
- new const Float:size[][3] = {
- {0.0, 0.0, 1.0}, {0.0, 0.0, -1.0}, {0.0, 1.0, 0.0}, {0.0, -1.0, 0.0}, {1.0, 0.0, 0.0}, {-1.0, 0.0, 0.0}, {-1.0, 1.0, 1.0}, {1.0, 1.0, 1.0}, {1.0, -1.0, 1.0}, {1.0, 1.0, -1.0}, {-1.0, -1.0, 1.0}, {1.0, -1.0, -1.0}, {-1.0, 1.0, -1.0}, {-1.0, -1.0, -1.0},
- {0.0, 0.0, 2.0}, {0.0, 0.0, -2.0}, {0.0, 2.0, 0.0}, {0.0, -2.0, 0.0}, {2.0, 0.0, 0.0}, {-2.0, 0.0, 0.0}, {-2.0, 2.0, 2.0}, {2.0, 2.0, 2.0}, {2.0, -2.0, 2.0}, {2.0, 2.0, -2.0}, {-2.0, -2.0, 2.0}, {2.0, -2.0, -2.0}, {-2.0, 2.0, -2.0}, {-2.0, -2.0, -2.0},
- {0.0, 0.0, 3.0}, {0.0, 0.0, -3.0}, {0.0, 3.0, 0.0}, {0.0, -3.0, 0.0}, {3.0, 0.0, 0.0}, {-3.0, 0.0, 0.0}, {-3.0, 3.0, 3.0}, {3.0, 3.0, 3.0}, {3.0, -3.0, 3.0}, {3.0, 3.0, -3.0}, {-3.0, -3.0, 3.0}, {3.0, -3.0, -3.0}, {-3.0, 3.0, -3.0}, {-3.0, -3.0, -3.0},
- {0.0, 0.0, 4.0}, {0.0, 0.0, -4.0}, {0.0, 4.0, 0.0}, {0.0, -4.0, 0.0}, {4.0, 0.0, 0.0}, {-4.0, 0.0, 0.0}, {-4.0, 4.0, 4.0}, {4.0, 4.0, 4.0}, {4.0, -4.0, 4.0}, {4.0, 4.0, -4.0}, {-4.0, -4.0, 4.0}, {4.0, -4.0, -4.0}, {-4.0, 4.0, -4.0}, {-4.0, -4.0, -4.0},
- {0.0, 0.0, 5.0}, {0.0, 0.0, -5.0}, {0.0, 5.0, 0.0}, {0.0, -5.0, 0.0}, {5.0, 0.0, 0.0}, {-5.0, 0.0, 0.0}, {-5.0, 5.0, 5.0}, {5.0, 5.0, 5.0}, {5.0, -5.0, 5.0}, {5.0, 5.0, -5.0}, {-5.0, -5.0, 5.0}, {5.0, -5.0, -5.0}, {-5.0, 5.0, -5.0}, {-5.0, -5.0, -5.0}
- }
- public plugin_init()
- {
- register_plugin("Campo de fuerza", "1.0", "[C]apo[S]trike")
- campoforze = zp_register_extra_item("Campo de Fuerza", 20, ZP_TEAM_HUMAN)
- register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
- }
- public zp_extra_item_selected(player, itemid)
- {
- // Not alive
- if (!is_user_alive(player))
- return;
- if (itemid == campoforze) {
- new name[32]
- get_user_name(player, name, 31)
- set_hudmessage(0, 255, 0, 0.05, 0.45, 1, 0.0, 5.0, 1.0, 1.0, -1)
- show_hudmessage(0, "%s tiene un CAMPO DE FUERZA!!", name)
- fm_set_rendering(player, kRenderFxGlowShell, 200, 200, 250, kRenderNormal, 300)
- campodefuerza[player] = true
- efects(player)
- campofuerza(player)
- set_task(30.0, "timeout", player)
- }
- }
- public campofuerza(id1)
- {
- // Not alive
- if (!is_user_alive(id1))
- return;
- if(!campodefuerza[id1])
- return;
- for (new id2; id2 <= 32; id2++)
- {
- if (zp_get_user_zombie(id2))
- {
- campofuntion(id1, id2)
- }
- }
- set_task(0.1, "campofuerza", id1)
- }
- public campofuntion(id1, id2)
- {
- // Not alive
- if (!is_user_alive(id1))
- return;
- if (!is_user_alive(id2))
- return;
- if(!campodefuerza[id1])
- return;
- static Float:vOrigin[3], Float:vOrigin2[3]
- pev(id1, pev_origin, vOrigin)
- pev(id2, pev_origin, vOrigin2)
- if(vector_distance(vOrigin, vOrigin2) < 180)
- {
- set_task(0.5,"checkstuck",0,"",0,"b")
- vOrigin2[1] -= 30.0
- set_pev(id2, pev_origin, vOrigin2)
- }
- }
- public efects(id)
- {
- // Not alive
- if (!is_user_alive(id))
- return;
- if(!campodefuerza[id])
- return;
-
- // Get player origin
- static Float:originF[3]
- pev(id, pev_origin, originF)
-
- // Colored Aura
- engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
- write_byte(TE_DLIGHT) // TE id
- engfunc(EngFunc_WriteCoord, originF[0]) // x
- engfunc(EngFunc_WriteCoord, originF[1]) // y
- engfunc(EngFunc_WriteCoord, originF[2]) // z
- write_byte(30) // radius
- write_byte(80) // r
- write_byte(80) // g
- write_byte(250) // b
- write_byte(2) // life
- write_byte(0) // decay rate
- message_end()
-
- set_task(0.1, "efects", id)
- return;
- }
- public client_putinserver(id) {
- campodefuerza [id] = false
- }
- public client_disconnect(id) {
- campodefuerza[id] = false
- }
- public event_round_start()
- {
- for (new id; id <= 32; id++)
- {
- campodefuerza[id] = false
- }
- }
- public zp_user_infected_post(player, infector)
- {
- if (campodefuerza[player])
- {
- campodefuerza[player] = false
- }
- return PLUGIN_CONTINUE
- }
- public timeout(id)
- {
- // Not alive
- if (!is_user_alive(id))
- return;
- if(!campodefuerza[id])
- return;
- campodefuerza[id] = false
- fm_set_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 20)
- }
- public checkstuck() {
- static players[32], pnum, player
- get_players(players, pnum)
- static Float:origin[3]
- static Float:mins[3], hull
- static Float:vec[3]
- static o,i
- for(i=0; i<pnum; i++){
- player = players[i]
- if (is_user_connected(player) && is_user_alive(player)) {
- pev(player, pev_origin, origin)
- hull = pev(player, pev_flags) & FL_DUCKING ? HULL_HEAD : HULL_HUMAN
- if (!is_hull_vacant(origin, hull,player) && !get_user_noclip(player) && !(pev(player,pev_solid) & SOLID_NOT)) {
- ++stuck[player]
- pev(player, pev_mins, mins)
- vec[2] = origin[2]
- for (o=0; o < sizeof size; ++o) {
- vec[0] = origin[0] - mins[0] * size[o][0]
- vec[1] = origin[1] - mins[1] * size[o][1]
- vec[2] = origin[2] - mins[2] * size[o][2]
- if (is_hull_vacant(vec, hull,player)) {
- engfunc(EngFunc_SetOrigin, player, vec)
- set_pev(player,pev_velocity,{0.0,0.0,0.0})
- o = sizeof size
- }
- }
- }
- else
- {
- stuck[player] = 0
- }
- }
- }
- }
- stock bool:is_hull_vacant(const Float:origin[3], hull,id) {
- static tr
- engfunc(EngFunc_TraceHull, origin, origin, 0, hull, id, tr)
- if (!get_tr2(tr, TR_StartSolid) || !get_tr2(tr, TR_AllSolid)) //get_tr2(tr, TR_InOpen))
- return true
-
- return false
- }
复制代码 |
|