Solved Unstuck Plugin

Unpaid Requests, Public Plugins
User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

Unstuck Plugin

#1

Post by Spir0x » 6 years ago

hello i find this bug on all ze servers, on some bugged maps there's not a lot respawn places so player respawn on both places.

Image

johnnysins2000
Veteran Member
Veteran Member
Paraguay
Posts: 678
Joined: 7 years ago
Location: Paraguay
Contact:

#2

Post by johnnysins2000 » 6 years ago

Already discussed in this forum

Search the topic
Nobody Is That Busy If They Make Time :roll:

User avatar
Night Fury
Mod Developer
Mod Developer
Posts: 677
Joined: 7 years ago
Contact:

#3

Post by Night Fury » 6 years ago

Use semipclip.
Solved.
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#4

Post by Raheem » 6 years ago

Jack GamePlay wrote: 6 years ago Use semipclip.
Solved.
Best solution i can see. I'll try write unstuck plugin soon for people who still afraid to use semiclip.
He who fails to plan is planning to fail

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#5

Post by Spir0x » 6 years ago

Yes Raheem i can't put semiclip off cuz some players block teammates! so he can use /unstuck and next update add it on ze main menu :)

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#6

Post by Raheem » 6 years ago

Spir0x wrote: 6 years ago Yes Raheem i can't put semiclip off cuz some players block teammates! so he can use /unstuck and next update add it on ze main menu :)
So why you need unstuck and you already have SemiClip?????
He who fails to plan is planning to fail

ArMaGeDDoN
Member
Member
Bosnia & Herzegovina
Posts: 4
Joined: 6 years ago
Contact:

#7

Post by ArMaGeDDoN » 6 years ago

Code: Select all

   /* - - - - - - - - - - -

        AMX Mod X script.

          | Author  : Arkshine
          | Plugin  : Unstick Player
          | Version : v1.0.2

        (!) Support : http://forums.alliedmods.net/showthread.php?p=717994#post717994 .
        (!) Requested by Rirre.

        This program is free software; you can redistribute it and/or modify it
        under the terms of the GNU General Public License as published by the
        Free Software Foundation; either version 2 of the License, or (at
        your option) any later version.

        This program is distributed in the hope that it will be useful, but
        WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
        General Public License for more details.

        You should have received a copy of the GNU General Public License
        along with this program; if not, write to the Free Software Foundation,
        Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

        ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~


        Description :
        - - - - - - -
            Unstick player via a client command.


        Requirement :
        - - - - - - -
            * All mods, except NS.
            * AMX Mod X 1.7x or higher.


        Modules :
        - - - - -
            * Fakemeta

            
        Credits :
        - - - - - 
            * AMX Mod X Team. ( original plugin )

            
        Changelog :
        - - - - - -
            v1.0.2 : [ 25 nov 2008 ]

                (+) Initial release.

    - - - - - - - - - - - */
    
    #include <amxmodx>
    #include <fakemeta>
    
    
    #define START_DISTANCE  32   // --| The first search distance for finding a free location in the map.
    #define MAX_ATTEMPTS    128  // --| How many times to search in an area for a free space.
    
    
    #define MAX_CLIENTS     32
    
    new Float:gf_LastCmdTime[ MAX_CLIENTS + 1 ];
    new gp_UnstuckFrequency;
    
    // --| Just for readability.
    enum Coord_e { Float:x, Float:y, Float:z };
    
    // --| Macro.
    #define GetPlayerHullSize(%1)  ( ( pev ( %1, pev_flags ) & FL_DUCKING ) ? HULL_HEAD : HULL_HUMAN )
    
    
    public plugin_init ()
    {
        register_plugin ( "Unstick Player", "1.0.2", "Arkshine" );
        
        // --| Cvars.
        gp_UnstuckFrequency = register_cvar ( "amx_unstuck_frequency", "4.0" );
        
        // --| Client command.
        register_clcmd ( "say_team /stuck"  , "ClientCommand_UnStick" );
        register_clcmd ( "say /stuck"       , "ClientCommand_UnStick" );
        register_clcmd ( "say_team /unstuck", "ClientCommand_UnStick" );
        register_clcmd ( "say /unstuck"     , "ClientCommand_UnStick" );
    }
    
    
    public ClientCommand_UnStick ( const id )
    {
        new Float:f_MinFrequency = get_pcvar_float ( gp_UnstuckFrequency );
        new Float:f_ElapsedCmdTime = get_gametime () - gf_LastCmdTime[ id ];
        
        if ( f_ElapsedCmdTime < f_MinFrequency ) 
        {
            client_print ( id, print_chat, "[AMXX] You must wait %.1f seconds before trying to free yourself.", f_MinFrequency - f_ElapsedCmdTime );
            return PLUGIN_HANDLED;
        }
        
        gf_LastCmdTime[ id ] = get_gametime ();
    
        new i_Value;
        
        if ( ( i_Value = UTIL_UnstickPlayer ( id, START_DISTANCE, MAX_ATTEMPTS ) ) != 1 )
        {
            switch ( i_Value )
            {
                case 0  : client_print ( id, print_chat, "[AMXX] Couldn't find a free spot to move you too" );
                case -1 : client_print ( id, print_chat, "[AMXX] You cannot free yourself as dead player" );
            }
        }
        
        return PLUGIN_CONTINUE;
    }
    
    
    UTIL_UnstickPlayer ( const id, const i_StartDistance, const i_MaxAttempts )
    {
        // --| Not alive, ignore.
        if ( !is_user_alive ( id ) )  return -1
        
        static Float:vf_OriginalOrigin[ Coord_e ], Float:vf_NewOrigin[ Coord_e ];
        static i_Attempts, i_Distance;
        
        // --| Get the current player's origin.
        pev ( id, pev_origin, vf_OriginalOrigin );
        
        i_Distance = i_StartDistance;
        
        while ( i_Distance < 1000 )
        {
            i_Attempts = i_MaxAttempts;
            
            while ( i_Attempts-- )
            {
                vf_NewOrigin[ x ] = random_float ( vf_OriginalOrigin[ x ] - i_Distance, vf_OriginalOrigin[ x ] + i_Distance );
                vf_NewOrigin[ y ] = random_float ( vf_OriginalOrigin[ y ] - i_Distance, vf_OriginalOrigin[ y ] + i_Distance );
                vf_NewOrigin[ z ] = random_float ( vf_OriginalOrigin[ z ] - i_Distance, vf_OriginalOrigin[ z ] + i_Distance );
            
                engfunc ( EngFunc_TraceHull, vf_NewOrigin, vf_NewOrigin, DONT_IGNORE_MONSTERS, GetPlayerHullSize ( id ), id, 0 );
            
                // --| Free space found.
                if ( get_tr2 ( 0, TR_InOpen ) && !get_tr2 ( 0, TR_AllSolid ) && !get_tr2 ( 0, TR_StartSolid ) )
                {
                    // --| Set the new origin .
                    engfunc ( EngFunc_SetOrigin, id, vf_NewOrigin );
                    return 1;
                }
            }
            
            i_Distance += i_StartDistance;
        }
        
        // --| Could not be found.
        return 0;
    }    
   
Use this if u need.
BrotherHood | Zombie Escape |
IP: 178.33.132.102:27015


Image

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#8

Post by Spir0x » 6 years ago

Thanks Arma :) go post it in new topic in Public plugins if you are the author of it and raheem will release it next update he can add support to main menu
Raheem yes i use semi clip and they cant move!

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#9

Post by Raheem » 6 years ago

This won't be official because we assume all our memebrs using ReSemiClip and if you are using ReSemiClip you will never face something like that.
He who fails to plan is planning to fail

johnnysins2000
Veteran Member
Veteran Member
Paraguay
Posts: 678
Joined: 7 years ago
Location: Paraguay
Contact:

#10

Post by johnnysins2000 » 6 years ago

https://forums.alliedmods.net/showthrea ... 915&page=2

Here For You :p works Completely Fine for me
Nobody Is That Busy If They Make Time :roll:

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#11

Post by Raheem » 6 years ago

johnnysins2000 wrote: 6 years ago https://forums.alliedmods.net/showthrea ... 915&page=2

Here For You :p works Completely Fine for me
This what ArMaGeDDoN already suggest.
He who fails to plan is planning to fail

johnnysins2000
Veteran Member
Veteran Member
Paraguay
Posts: 678
Joined: 7 years ago
Location: Paraguay
Contact:

#12

Post by johnnysins2000 » 6 years ago

Raheem wrote: 6 years ago
johnnysins2000 wrote: 6 years ago https://forums.alliedmods.net/showthrea ... 915&page=2

Here For You :p works Completely Fine for me
This what ArMaGeDDoN already suggest.
then what is the problem ? simply add the plugin :P
Nobody Is That Busy If They Make Time :roll:

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#13

Post by Raheem » 6 years ago

Add it where?
He who fails to plan is planning to fail

johnnysins2000
Veteran Member
Veteran Member
Paraguay
Posts: 678
Joined: 7 years ago
Location: Paraguay
Contact:

#14

Post by johnnysins2000 » 6 years ago

Raheem wrote: 6 years agoAdd it where?
In plugins folder :P

and plugins.ini

Unstuck is useful even if we use re semiclip

1- If we respawn on base in freeze time the otherp layer is also repsawn on us so when that other players turn zombie we are stuck in him.Simply we say unstuck and we are unstuck at base spawn

2- Other use of it is the auto unstuck not this one .... The one who are blocking the helicopter and trains get unstuck so helicopter and trains starts to move after some time .... not block forever and not much waste of time !
Nobody Is That Busy If They Make Time :roll:

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#15

Post by Raheem » 6 years ago

1-Just if it happens and you use ReSemiClip just jump and you will be unstuck.

2-Auto unstuck that exist anywhere will unstuck humans only if it can detect but if another entitiy like train, heli ... it won't work. Jack try to solve this but it not solved also i give more tries but seems not working.
He who fails to plan is planning to fail

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#16

Post by Spir0x » 6 years ago

Raheem , we prefet unstuck plugin cuz some times semiclip wont work when zm spawn and for me i use resemiclip only for one reason for players block teammates so zm kill.

johnnysins2000
Veteran Member
Veteran Member
Paraguay
Posts: 678
Joined: 7 years ago
Location: Paraguay
Contact:

#17

Post by johnnysins2000 » 6 years ago

What I mean was that it unblocks helicopter and trains after Some 15-20 sec When Players are blocking ... So Atleast It does not block forever

So Just for Now it is on u can bear it :v

But not yet good I will Also Try to search any useful code

One thing I am Sure

Everything Will be In entity
Nobody Is That Busy If They Make Time :roll:

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#18

Post by Raheem » 6 years ago

Spir0x wrote: 6 years ago Raheem , we prefet unstuck plugin cuz some times semiclip wont work when zm spawn and for me i use resemiclip only for one reason for players block teammates so zm kill.
I still can't see any reason for using plugins like unstuck... It can be useful in one thing if player stuck with vehicle and it's rarly happens.
johnnysins2000 wrote: 6 years ago What I mean was that it unblocks helicopter and trains after Some 15-20 sec When Players are blocking ... So Atleast It does not block forever

So Just for Now it is on u can bear it :v

But not yet good I will Also Try to search any useful code

One thing I am Sure

Everything Will be In entity
Just to understand the problem, I can detect that player touch the train for example but how can i know that he blocks it? In automatic stuck it works if two entities the two is in each others not player just blocked the vehicle.

So if after i detect the train touch i can do nothing... Simply because player inside the vehicle have velocity of {0.0, 0.0, 0.0} and the train have velocity of {X, Y, Z] if player blocks the train and it's blocked if i try to know that the train stops by getting entity speed see if it's zero or not it will return it's moving {X, Y, Z} ... So no way..
He who fails to plan is planning to fail

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 641
Joined: 7 years ago
Location: Tunisia
Contact:

#19

Post by Spir0x » 6 years ago

{X, Y, Z} ... So no way..
are you speaking about escapers-zone.X,Y,Z? xD some fun :3

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#20

Post by Raheem » 6 years ago

Spir0x wrote: 6 years ago {X, Y, Z} ... So no way..
are you speaking about escapers-zone.X,Y,Z? xD some fun :3
:lol: :lol:

Try: Try to block the train or helicopter and see the message will appear to you. It will appear to you as it's moving although it's static and not moving so i don't find way to detect that this entity stopped so i see no ways.

I was think to do something like: (If player is Duck & Entity not Moving) it means this player blocks the Entity then i'll automatic unstuck him but this not works as i can't detect that entity stopped.
He who fails to plan is planning to fail

Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Who is online

Users browsing this forum: No registered users and 1 guest