Code: Select all
#include <amxmodx>#include <fun>#include <fakemeta> new stuck[33] new cvar[3] 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("Automatic Unstuck","1.5","NL)Ramon(NL") cvar[0] = register_cvar("amx_autounstuck","1") cvar[1] = register_cvar("amx_autounstuckeffects","1") cvar[2] = register_cvar("amx_autounstuckwait","7") set_task(0.1,"checkstuck",0,"",0,"b")} public checkstuck() { if(get_pcvar_num(cvar[0]) >= 1) { 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] if(stuck[player] >= get_pcvar_num(cvar[2])) { 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) effects(player) 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} public effects(id) { if(get_pcvar_num(cvar[1])) { set_hudmessage(255,150,50, -1.0, 0.65, 0, 6.0, 1.5,0.1,0.7) // HUDMESSAGE show_hudmessage(id,"Fuiste destrabado.") // HUDMESSAGE message_begin(MSG_ONE_UNRELIABLE,105,{0,0,0},id ) write_short(1<<10) // fade lasts this long duration write_short(1<<10) // fade lasts this long hold time write_short(1<<1) // fade type (in / out) write_byte(20) // fade red write_byte(255) // fade green write_byte(255) // fade blue write_byte(255) // fade alpha message_end() client_cmd(id,"spk fvox/blip.wav") }}
Va tas semistuck.
Code: Select all
#include <amxmodx>#include <amxmisc>#include <fakemeta>#include <fakemeta_util>#include <fun> #define PLUGIN "SemiClip/Unstuck"#define VERSION "1.0"#define AUTHOR "Quick-Gun" new bool:plrSolid[33]new bool:plrRestore[33]new bool:g_colliding[33] new Float:g_lasttimetouched[33] new plrTeam[33]new maxplayersnew stuck[33]new cvar[3] 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(PLUGIN, VERSION, AUTHOR) register_forward(FM_PlayerPreThink, "preThink") register_forward(FM_PlayerPostThink, "postThink") register_forward(FM_AddToFullPack, "addToFullPack", 1) cvar[0] = register_cvar("amx_autounstuck","1") cvar[1] = register_cvar("amx_autounstuckeffects","1") cvar[2] = register_cvar("amx_autounstuckwait","7") maxplayers = get_maxplayers() set_task(0.1,"checkstuck",0,"",0,"b")} public checkstuck() { if(get_pcvar_num(cvar[0]) >= 1) { 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) && !g_colliding[player]) { ++stuck[player] if(stuck[player] >= get_pcvar_num(cvar[2])) { 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) effects(player) 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} public effects(id) { if(get_pcvar_num(cvar[1])) { set_hudmessage(255,150,50, -1.0, 0.65, 0, 6.0, 1.5,0.1,0.7) // HUDMESSAGE show_hudmessage(id,"You should be unstucked now!") // HUDMESSAGE message_begin(MSG_ONE_UNRELIABLE,105,{0,0,0},id ) write_short(1<<10) // fade lasts this long duration write_short(1<<10) // fade lasts this long hold time write_short(1<<1) // fade type (in / out) write_byte(20) // fade red write_byte(255) // fade green write_byte(255) // fade blue write_byte(255) // fade alpha message_end() client_cmd(id,"spk fvox/blip.wav") }} public addToFullPack(es, e, ent, host, hostflags, player, pSet){ if(player) { if(plrSolid[host] && plrSolid[ent] && plrTeam[host] == plrTeam[ent]) { set_es(es, ES_Solid, SOLID_NOT) set_es(es, ES_RenderMode, kRenderTransAdd) set_es(es, ES_RenderAmt, 85) } }} FirstThink(){ for(new i = 1; i <= maxplayers; i++) { if(!is_user_alive(i)) { plrSolid[i] = false continue } plrTeam[i] = get_user_team(i) plrSolid[i] = pev(i, pev_solid) == SOLID_SLIDEBOX ? true : false }} public preThink(id){ static i, LastThink if(LastThink > id) { FirstThink() } LastThink = id if(!plrSolid[id]) return for(i = 1; i <= maxplayers; i++) { if(!plrSolid[i] || id == i) continue if(plrTeam[i] == plrTeam[id]) { set_pev(i, pev_solid, SOLID_NOT) static Float:gametime; gametime = get_gametime() g_lasttimetouched[id] = gametime g_lasttimetouched[i] = gametime plrRestore[i] = true g_colliding[i] = true } } static solid; solid = pev(id, pev_solid) if(solid == SOLID_SLIDEBOX && (get_gametime() - g_lasttimetouched[id]) > 0.34) { g_colliding[i] = false }} public postThink(id){ static i for(i = 1; i <= maxplayers; i++) { if(plrRestore[i]) { set_pev(i, pev_solid, SOLID_SLIDEBOX) plrRestore[i] = false } }}