Raised This Month: $51 Target: $400
 12% 

Automatic Unstucking


Post New Thread Reply   
 
Thread Tools Display Modes
pizzahut
Senior Member
Join Date: Oct 2004
Old 03-11-2007 , 11:42   Re: Automatic Unstucking
Reply With Quote #31

Does this also work for the infamous door/lift bug, e.g. in TFC "badlands" front door and "well" flag room lifts?
__________________
My AMXX plugins (content date 2007-03-29, link check 2017-04-26)

Plugins for the Royston Vasey TFC server - These are UNSUPPORTED, except those which have been published at AMX Mod X.
pizzahut is offline
Ramono
Veteran Member
Join Date: Nov 2005
Location: Netherlands
Old 03-11-2007 , 12:31   Re: Automatic Unstucking
Reply With Quote #32

Yes does
__________________
Um, hi.
Ramono is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 03-11-2007 , 15:20   Re: Automatic Unstucking
Reply With Quote #33

Quote:
Originally Posted by Ramono View Post
I never used get_players before, can you give me an example how to do it?
Code:
new players[32], pnum, player
get_players(players, pnum)

for( new i=0; i<pnum; i++){
     player = players[i]
     //do stuff to player
}
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Old 03-11-2007, 15:48
teame06
This message has been deleted by teame06. Reason: I didn't see last page
Ramono
Veteran Member
Join Date: Nov 2005
Location: Netherlands
Old 03-12-2007 , 12:19   Re: Automatic Unstucking
Reply With Quote #34

Does it needs a is_user_connected() check or anything more?
__________________
Um, hi.
Ramono is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 03-12-2007 , 19:44   Re: Automatic Unstucking
Reply With Quote #35

you should just add the alive flag [get_players(players, pnum, "a")]
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Ramono
Veteran Member
Join Date: Nov 2005
Location: Netherlands
Old 03-13-2007 , 15:47   Re: Automatic Unstucking
Reply With Quote #36

Code:
public checkstuck() {     if(get_pcvar_num(cvar[0]) >= 1) {         new players[32], pnum         get_players(players, pnum)         new Float:origin[3]         new Float:mins[3], hull         new Float:vec[3]         new o         for( new i=0; i<pnum; i++){             if (is_user_connected(players[i]) && is_user_alive(players[i])) {                 pev(players[i], pev_origin, origin)                 hull = pev(players[i], pev_flags) & FL_DUCKING ? HULL_HEAD : HULL_HUMAN                 if (!is_hull_vacant(origin, hull,players[i]) && !get_user_noclip(players[i]) && !(pev(players[i],pev_solid) & SOLID_NOT)) {                     ++stuck[players[i]]                     if(stuck[players[i]] >= get_pcvar_num(cvar[2])) {                         pev(players[i], 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,players[i])) {                                 engfunc(EngFunc_SetOrigin, players[i], vec)                                 effects(players[i])                                 set_pev(players[i],pev_velocity,{0.0,0.0,0.0})                                 o = sizeof size                             }                         }                     }                 }                 else                 {                     stuck[i] = 0                 }             }         }     } }

I dont have anything to test it on (fastly), if it is right ill ask a friend to test it for me.

Thanks,
Ramon
__________________
Um, hi.
Ramono is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 03-13-2007 , 16:25   Re: Automatic Unstucking
Reply With Quote #37

Yes it's working ;) & i realize i like it! Gj...
__________________
Still...lovin' . Connor noob! Hello

Last edited by Alka; 03-13-2007 at 16:35.
Alka is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 03-14-2007 , 00:59   Re: Automatic Unstucking
Reply With Quote #38

save players[i] into a variable. Don't Reindex Arrays

also use statics because of how often the function is being called.

Last edited by Emp`; 08-10-2012 at 18:05.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Ramono
Veteran Member
Join Date: Nov 2005
Location: Netherlands
Old 03-14-2007 , 14:29   Re: Automatic Unstucking
Reply With Quote #39

Why that, its not used in any other function than that.
Creating another static for it would create more slowdown...
Do you realy think thats a NEED for the plugin?
__________________
Um, hi.

Last edited by Ramono; 03-14-2007 at 14:38.
Ramono is offline
Ramono
Veteran Member
Join Date: Nov 2005
Location: Netherlands
Old 09-29-2007 , 18:24   Re: Automatic Unstucking
Reply With Quote #40

1.5, another optimision, should make it lots faster now for those with older machines.
__________________
Um, hi.
Ramono is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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