Raised This Month: $ Target: $400
 0% 

Help / Support [ZP] Help Unstuck , Reminder , GameMode menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
serjaka
Senior Member
Join Date: Oct 2011
Old 11-04-2013 , 10:43   [ZP] Help Unstuck , Reminder , GameMode menu
Reply With Quote #1

Hello Allied Modders, help me please to do some changes ! My English is bad but i will try to explain what i need!
I need to add at this plugin /unstuck command , i don't need auto unstuck and when player is not stuck print message: [ZP] You are not stucked! Something like that!!!
Code:
#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,"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")
	}
}
2.Help please to do like this plugin reminder: Nemesis Health Reminder
SCREEN:


3.And can i add Custom Game Modes to ZP 4.3 from ZPA 1.6.1??? Help me pelase !!! THX!!!

Last edited by serjaka; 11-04-2013 at 10:44.
serjaka is offline
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 11-04-2013 , 13:32   Re: [ZP] Help Unstuck , Reminder , GameMode menu
Reply With Quote #2

About 2 try this http://forums.alliedmods.net/showpos...16&postcount=2
wicho is offline
serjaka
Senior Member
Join Date: Oct 2011
Old 11-04-2013 , 15:35   Re: [ZP] Help Unstuck , Reminder , GameMode menu
Reply With Quote #3

Quote:
Originally Posted by wicho View Post
thx BRO !!!
serjaka is offline
Gasa
Senior Member
Join Date: Sep 2013
Old 11-04-2013 , 14:38   Re: [ZP] Help Unstuck , Reminder , GameMode menu
Reply With Quote #4

I just edit this version http://forums.alliedmods.net/showpos...94&postcount=2, and add stock for check and print!
PHP Code:

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

        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_LastCmdTimeMAX_CLIENTS ];
    new 
gp_UnstuckFrequency;
    
    
// --| Just for readability.
    
enum Coord_e Float:xFloat:yFloat:};
    
    
// --| 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_LastCmdTimeid ];
        
        if ( 
f_ElapsedCmdTime f_MinFrequency 
        {
            
client_print idprint_chat"[AMXX] You must wait %.1f seconds before trying to free yourself."f_MinFrequency f_ElapsedCmdTime );
            return 
PLUGIN_HANDLED;
        }
        
        if ( !
is_player_stuck(id) ) 
        {
            
client_print idprint_chat"[ZP] You are not stuck!" );
            return 
PLUGIN_HANDLED;
        }
        
        
gf_LastCmdTimeid ] = get_gametime ();
    
        new 
i_Value;
        
        if ( ( 
i_Value UTIL_UnstickPlayer idSTART_DISTANCEMAX_ATTEMPTS ) ) != )
        {
            switch ( 
i_Value )
            {
                case 
0  client_print idprint_chat"[AMXX] Couldn't find a free spot to move you too" );
                case -
client_print idprint_chat"[AMXX] You cannot free yourself as dead player" );
            }
        }
        
        return 
PLUGIN_CONTINUE;
    }
    
stock is_player_stuck(id)
{
    static 
Float:originF[3]
    
pev(idpev_originoriginF)
    
    
engfunc(EngFunc_TraceHulloriginForiginF0, (pev(idpev_flags) & FL_DUCKING) ? HULL_HEAD HULL_HUMANid0)
    
    if (
get_tr2(0TR_StartSolid) || get_tr2(0TR_AllSolid) || !get_tr2(0TR_InOpen))
        return 
true;
    
    return 
false;

    
UTIL_UnstickPlayer ( const id, const i_StartDistance, const i_MaxAttempts )
    {
        
// --| Not alive, ignore.
        
if ( !is_user_alive id ) )  return -1
        
        
static Float:vf_OriginalOriginCoord_e ], Float:vf_NewOriginCoord_e ];
        static 
i_Attemptsi_Distance;
        
        
// --| Get the current player's origin.
        
pev idpev_originvf_OriginalOrigin );
        
        
i_Distance i_StartDistance;
        
        while ( 
i_Distance 1000 )
        {
            
i_Attempts i_MaxAttempts;
            
            while ( 
i_Attempts-- )
            {
                
vf_NewOrigin] = random_float vf_OriginalOrigin] - i_Distancevf_OriginalOrigin] + i_Distance );
                
vf_NewOrigin] = random_float vf_OriginalOrigin] - i_Distancevf_OriginalOrigin] + i_Distance );
                
vf_NewOrigin] = random_float vf_OriginalOrigin] - i_Distancevf_OriginalOrigin] + i_Distance );
            
                
engfunc EngFunc_TraceHullvf_NewOriginvf_NewOriginDONT_IGNORE_MONSTERSGetPlayerHullSize id ), id);

                if ( 
get_tr2 0TR_InOpen ) && !get_tr2 0TR_AllSolid ) && !get_tr2 0TR_StartSolid ) )
                {
                    
// --| Set the new origin .
                    
engfunc EngFunc_SetOriginidvf_NewOrigin );
            
client_print idprint_chat"[ZP] You should be unstuck now!!" );
                    return 
1;
                }
            }
            
            
i_Distance += i_StartDistance;
        }
        
        
// --| Could not be found.
        
return 0;
    } 
Gasa is offline
serjaka
Senior Member
Join Date: Oct 2011
Old 11-04-2013 , 15:41   Re: [ZP] Help Unstuck , Reminder , GameMode menu
Reply With Quote #5

Quote:
Originally Posted by Gasa View Post
I just edit this version http://forums.alliedmods.net/showpos...94&postcount=2, and add stock for check and print!
PHP Code:

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

        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_LastCmdTimeMAX_CLIENTS ];
    new 
gp_UnstuckFrequency;
    
    
// --| Just for readability.
    
enum Coord_e Float:xFloat:yFloat:};
    
    
// --| 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_LastCmdTimeid ];
        
        if ( 
f_ElapsedCmdTime f_MinFrequency 
        {
            
client_print idprint_chat"[AMXX] You must wait %.1f seconds before trying to free yourself."f_MinFrequency f_ElapsedCmdTime );
            return 
PLUGIN_HANDLED;
        }
        
        if ( !
is_player_stuck(id) ) 
        {
            
client_print idprint_chat"[ZP] You are not stuck!" );
            return 
PLUGIN_HANDLED;
        }
        
        
gf_LastCmdTimeid ] = get_gametime ();
    
        new 
i_Value;
        
        if ( ( 
i_Value UTIL_UnstickPlayer idSTART_DISTANCEMAX_ATTEMPTS ) ) != )
        {
            switch ( 
i_Value )
            {
                case 
0  client_print idprint_chat"[AMXX] Couldn't find a free spot to move you too" );
                case -
client_print idprint_chat"[AMXX] You cannot free yourself as dead player" );
            }
        }
        
        return 
PLUGIN_CONTINUE;
    }
    
stock is_player_stuck(id)
{
    static 
Float:originF[3]
    
pev(idpev_originoriginF)
    
    
engfunc(EngFunc_TraceHulloriginForiginF0, (pev(idpev_flags) & FL_DUCKING) ? HULL_HEAD HULL_HUMANid0)
    
    if (
get_tr2(0TR_StartSolid) || get_tr2(0TR_AllSolid) || !get_tr2(0TR_InOpen))
        return 
true;
    
    return 
false;

    
UTIL_UnstickPlayer ( const id, const i_StartDistance, const i_MaxAttempts )
    {
        
// --| Not alive, ignore.
        
if ( !is_user_alive id ) )  return -1
        
        
static Float:vf_OriginalOriginCoord_e ], Float:vf_NewOriginCoord_e ];
        static 
i_Attemptsi_Distance;
        
        
// --| Get the current player's origin.
        
pev idpev_originvf_OriginalOrigin );
        
        
i_Distance i_StartDistance;
        
        while ( 
i_Distance 1000 )
        {
            
i_Attempts i_MaxAttempts;
            
            while ( 
i_Attempts-- )
            {
                
vf_NewOrigin] = random_float vf_OriginalOrigin] - i_Distancevf_OriginalOrigin] + i_Distance );
                
vf_NewOrigin] = random_float vf_OriginalOrigin] - i_Distancevf_OriginalOrigin] + i_Distance );
                
vf_NewOrigin] = random_float vf_OriginalOrigin] - i_Distancevf_OriginalOrigin] + i_Distance );
            
                
engfunc EngFunc_TraceHullvf_NewOriginvf_NewOriginDONT_IGNORE_MONSTERSGetPlayerHullSize id ), id);

                if ( 
get_tr2 0TR_InOpen ) && !get_tr2 0TR_AllSolid ) && !get_tr2 0TR_StartSolid ) )
                {
                    
// --| Set the new origin .
                    
engfunc EngFunc_SetOriginidvf_NewOrigin );
            
client_print idprint_chat"[ZP] You should be unstuck now!!" );
                    return 
1;
                }
            }
            
            
i_Distance += i_StartDistance;
        }
        
        
// --| Could not be found.
        
return 0;
    } 
i will try this! Thx Bro
serjaka is offline
serjaka
Senior Member
Join Date: Oct 2011
Old 11-04-2013 , 16:26   Re: [ZP] Help Unstuck , Reminder , GameMode menu
Reply With Quote #6

Quote:
Originally Posted by gasa View Post
i just edit this version http://forums.alliedmods.net/showpos...94&postcount=2, and add stock for check and print!
edit: Work fine!!! Thx bro :*

Last edited by serjaka; 11-04-2013 at 17:17.
serjaka is offline
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 11-04-2013 , 15:45   Re: [ZP] Help Unstuck , Reminder , GameMode menu
Reply With Quote #7

work fine?
wicho is offline
serjaka
Senior Member
Join Date: Oct 2011
Old 11-04-2013 , 15:51   Re: [ZP] Help Unstuck , Reminder , GameMode menu
Reply With Quote #8

Quote:
Originally Posted by wicho View Post
work fine?
hmmm don't work... i do something wrong?

EDIT: I found problem , now is working fine! Thx :*

Last edited by serjaka; 11-04-2013 at 16:04.
serjaka is offline
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 11-04-2013 , 17:05   Re: [ZP] Help Unstuck , Reminder , GameMode menu
Reply With Quote #9

No steam = no support
__________________
alan_el_more is offline
serjaka
Senior Member
Join Date: Oct 2011
Old 11-04-2013 , 17:10   Re: [ZP] Help Unstuck , Reminder , GameMode menu
Reply With Quote #10

Quote:
Originally Posted by alan_el_more View Post
No steam = no support
i have steam
serjaka 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:34.


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