AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Zombie Plague Mod (https://forums.alliedmods.net/forumdisplay.php?f=126)
-   -   Help / Support [ZP] Help Unstuck , Reminder , GameMode menu (https://forums.alliedmods.net/showthread.php?t=229270)

serjaka 11-04-2013 10:43

[ZP] Help Unstuck , Reminder , GameMode menu
 
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:
http://s002.radikal.ru/i197/1311/74/5d5169a1b1b8.jpg

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

wicho 11-04-2013 13:32

Re: [ZP] Help Unstuck , Reminder , GameMode menu
 
About 2 try this http://forums.alliedmods.net/showpos...16&postcount=2

Gasa 11-04-2013 14:38

Re: [ZP] Help Unstuck , Reminder , GameMode menu
 
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;
    } 


serjaka 11-04-2013 15:35

Re: [ZP] Help Unstuck , Reminder , GameMode menu
 
Quote:

Originally Posted by wicho (Post 2056854)

thx BRO !!!

serjaka 11-04-2013 15:41

Re: [ZP] Help Unstuck , Reminder , GameMode menu
 
Quote:

Originally Posted by Gasa (Post 2056885)
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

wicho 11-04-2013 15:45

Re: [ZP] Help Unstuck , Reminder , GameMode menu
 
work fine?

serjaka 11-04-2013 15:51

Re: [ZP] Help Unstuck , Reminder , GameMode menu
 
Quote:

Originally Posted by wicho (Post 2056906)
work fine?

hmmm don't work... i do something wrong?

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

serjaka 11-04-2013 16:26

Re: [ZP] Help Unstuck , Reminder , GameMode menu
 
Quote:

Originally Posted by gasa (Post 2056885)
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 :* :3

alan_el_more 11-04-2013 17:05

Re: [ZP] Help Unstuck , Reminder , GameMode menu
 
No steam = no support

serjaka 11-04-2013 17:10

Re: [ZP] Help Unstuck , Reminder , GameMode menu
 
Quote:

Originally Posted by alan_el_more (Post 2056934)
No steam = no support

i have steam :3


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

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