AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Autounstuck (https://forums.alliedmods.net/showthread.php?t=144068)

futu 11-28-2010 12:41

Autounstuck
 
I tried this plugin to get autounstuck when a player stuck in a block (hidenseek) But The player also automatic unstuck in a player. So i need the help so the player just get autounstuck when the player stuck in the block and not when 2 players are in each other

PHP Code:

#include <amxmodx>
#include <fun>
#include <fakemeta>

new stuck[33]

new 
cvar[3]

new const 
Float:size[][3] = {
{
0.00.01.0}, {0.00.0, -1.0}, {0.01.00.0}, {0.0, -1.00.0}, {1.00.00.0}, {-1.00.00.0}, {-1.01.01.0}, {1.01.01.0}, {1.0, -1.01.0}, {1.01.0, -1.0}, {-1.0, -1.01.0}, {1.0, -1.0, -1.0}, {-1.01.0, -1.0}, {-1.0, -1.0, -1.0},
{
0.00.02.0}, {0.00.0, -2.0}, {0.02.00.0}, {0.0, -2.00.0}, {2.00.00.0}, {-2.00.00.0}, {-2.02.02.0}, {2.02.02.0}, {2.0, -2.02.0}, {2.02.0, -2.0}, {-2.0, -2.02.0}, {2.0, -2.0, -2.0}, {-2.02.0, -2.0}, {-2.0, -2.0, -2.0},
{
0.00.03.0}, {0.00.0, -3.0}, {0.03.00.0}, {0.0, -3.00.0}, {3.00.00.0}, {-3.00.00.0}, {-3.03.03.0}, {3.03.03.0}, {3.0, -3.03.0}, {3.03.0, -3.0}, {-3.0, -3.03.0}, {3.0, -3.0, -3.0}, {-3.03.0, -3.0}, {-3.0, -3.0, -3.0},
{
0.00.04.0}, {0.00.0, -4.0}, {0.04.00.0}, {0.0, -4.00.0}, {4.00.00.0}, {-4.00.00.0}, {-4.04.04.0}, {4.04.04.0}, {4.0, -4.04.0}, {4.04.0, -4.0}, {-4.0, -4.04.0}, {4.0, -4.0, -4.0}, {-4.04.0, -4.0}, {-4.0, -4.0, -4.0},
{
0.00.05.0}, {0.00.0, -5.0}, {0.05.00.0}, {0.0, -5.00.0}, {5.00.00.0}, {-5.00.00.0}, {-5.05.05.0}, {5.05.05.0}, {5.0, -5.05.0}, {5.05.0, -5.0}, {-5.0, -5.05.0}, {5.0, -5.0, -5.0}, {-5.05.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], pnumplayer
get_players
(playerspnum)
static 
Float:origin[3]
static 
Float:mins[3], hull
static Float:vec[3]
static 
o,i
for(i=0i<pnumi++){
player players[i]
if (
is_user_connected(player) && is_user_alive(player)) {
pev(playerpev_originorigin)
hull pev(playerpev_flags) & FL_DUCKING HULL_HEAD HULL_HUMAN
if (!is_hull_vacant(originhull,player) && !get_user_noclip(player) && !(pev(player,pev_solid) & SOLID_NOT)) {
++
stuck[player]
if(
stuck[player] >= get_pcvar_num(cvar[2])) {
pev(playerpev_minsmins)
vec[2] = origin[2]
for (
o=0sizeof 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(vechull,player)) {
engfunc(EngFunc_SetOriginplayervec)
effects(player)
set_pev(player,pev_velocity,{0.0,0.0,0.0})
sizeof size
}
}
}
}
else
{
stuck[player] = 0
}
}
}
}
}

stock bool:is_hull_vacant(const Float:origin[3], hull,id) {
static 
tr
engfunc
(EngFunc_TraceHulloriginorigin0hullidtr)
if (!
get_tr2(trTR_StartSolid) || !get_tr2(trTR_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.00.6506.01.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")
}



GXLZPGX 11-28-2010 12:46

Re: Autounstuck
 
Quote:

Originally Posted by futu (Post 1358905)
I tried this plugin to get autounstuck when a player stuck in a block (hidenseek) But The player also automatic unstuck in a player. So i need the help so the player just get autounstuck when the player stuck in the block and not when 2 players are in each other

Use [php] tags instead of quote tags.

futu 11-28-2010 12:49

Re: Autounstuck
 
So. Im sorry for that im new that why.


All times are GMT -4. The time now is 11:25.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.