Raised This Month: $ Target: $400
 0% 

[REQ] Pause


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 04-10-2013 , 11:49   [REQ] Pause
Reply With Quote #1

Hi
Can someone make when say /pause it makes:
- Player go spectator
- Save currently place of Player

Then say /unpause and:
- Go to the team he was
- Go to the place he was
__________________

Last edited by Jhob94; 04-11-2013 at 14:03. Reason: Change Description of plugin request
Jhob94 is offline
ANTICHRISTUS
kingdom of weird stuff
Join Date: Jun 2010
Location: My kingdom is not in thi
Old 04-11-2013 , 13:43   Re: [REQ] Pause
Reply With Quote #2

off-topic. do you love playing dice ? 1, 2, ..
__________________

Last edited by ANTICHRISTUS; 04-11-2013 at 14:20. Reason: odd idea bis.
ANTICHRISTUS is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 04-11-2013 , 14:22   Re: [REQ] Pause
Reply With Quote #3

Quote:
Originally Posted by ANTICHRISTUS View Post
off-topic. do you love playing dice ? 1, 2, ..
Call the police and tell them that i gonna kill you and for they dont search me ok?
(Iam talking serious, come in my server and i kill you with an FlashBang )
__________________
Jhob94 is offline
ANTICHRISTUS
kingdom of weird stuff
Join Date: Jun 2010
Location: My kingdom is not in thi
Old 04-11-2013 , 17:27   Re: [REQ] Pause
Reply With Quote #4

Quote:
Originally Posted by Jhob94 View Post
Call the police
are you kidding me ??? me calling the cops ????
Quote:
Originally Posted by Jhob94 View Post
(Iam talking serious, come in my server and i kill you with an FlashBang )


no more spam please .
__________________
ANTICHRISTUS is offline
pokemonmaster
princess milk
Join Date: Nov 2010
Location: Somewhere in this world
Old 04-13-2013 , 14:51   Re: [REQ] Pause
Reply With Quote #5

Untested
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#include <fakemeta>
#include <fun>

//#define GIVE_OLD_WEAPONS

enum _:PAUSE
{
#if defined GIVE_OLD_WEAPONS
    
WEAPONS_BIT_SUM,
#endif
    
PAUSE_STATUS,
    
TEAM,
}

new 
g_iPaused[33][PAUSE], g_iOldOrigin[33][3]

public 
plugin_init()
{
    
register_plugin("Pause unpause""1.0""Khalid :)")
    
register_clcmd("say /pause""ClcmdPause")
    
register_clcmd("say /unpause""ClcmdUnPause")
}

public 
ClcmdPause(id)
{
    if(
g_iPaused[id][PAUSE_STATUS])
    {
        
client_print(idprint_chat"You are already paused")
        return 
PLUGIN_HANDLED
    
}
    
    
get_user_origin(idg_iOldOrigin[id])
    
    
#if defined GIVE_OLD_WEAPONS
    
g_iPaused[id][WEAPONS] = pev(idpev_weapons)
    
#endif
    
    
if(is_user_alive(id))
    {
        
user_silentkill(id)
    }
    
    
g_iPaused[id][PAUSE_STATUS] = 1
    g_iPaused
[id][TEAM] = _:cs_get_user_team(id)
    
cs_set_user_team(idCS_TEAM_SPECTATOR)
    
    
client_print(idprint_chat"You have been paused")
    return 
PLUGIN_HANDLED
}

public 
ClcmdUnPause(id)
{
    if(!
g_iPaused[id][PAUSE_STATUS])
    {
        
client_print(idprint_chat"You are already unpaused")
        return 
PLUGIN_HANDLED
    
}
    
    
g_iPaused[id][PAUSE_STATUS] = 0
    cs_set_user_team
(idCsTeams:g_iPaused[id][TEAM])
    
ExecuteHamB(Ham_CS_RoundRespawnid)
    
    
set_user_origin(idg_iOldOrigin[id])
    
    
#if defined GIVE_OLD_WEAPONS
    
GiveOldWeapons(id)
    
#endif
    
    
client_print(idprint_chat"You have been paused")
    return 
PLUGIN_HANDLED
}

public 
client_disconnect(id)
{
    if(
g_iPaused[id][PAUSE_STATUS])
    {
        
g_iPaused[id][PAUSE_STATUS] = 0
    
}
}

#if defined GIVE_OLD_WEAPONS
stock GiveOldWeapons(id)
{
    
strip_user_weapons(id)
    
    new 
iWeapons g_iPaused[id][WEAPONS]
    new 
szWeapon[32]
    
    for(new 
CSW_P228CSW_VESTi++)
    {
        if(
iWeapons & (1<<i))
        {
            
get_weaponname(iszWeaponcharsmax(szWeapon))
            
            
give_item(idszWeapon)
            
cs_set_user_bpammo(idiMAXBPAMMO[i])
        }
    }
}
#endif 
__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه
No longer active in AMXX. Sorry.
pokemonmaster is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 04-13-2013 , 18:32   Re: [REQ] Pause
Reply With Quote #6

It works fine, thanks.
But can you make new version?
On this version i kill myself with the gun i have. Can you change it? I have point system, and i receive point any time i go pause. The other thing i would like you add is just let go pause if 100hp(that i can do xD) and if player is moving doesnt let him go pause. Is for surf server, isnt good if player pause in air with bind for pause
__________________

Last edited by Jhob94; 04-13-2013 at 21:30.
Jhob94 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-14-2013 , 08:40   Re: [REQ] Pause
Reply With Quote #7

Try this :

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <fun>

#tryinclude <cstrike_pdatas>

#if !defined _cbaseentity_included
        #assert Cstrike Pdatas and Offsets library required! Read the below instructions:   \
                
1. Download it at forums.alliedmods.net/showpost.php?p=1712101#post1712101   \
                
2. Put it into amxmodx/scripting/include/ folder   \
                
3. Compile this plugin locallydetailswiki.amxmodx.org/index.php/Compiling_Plugins_%28AMX_Mod_X%29   \
                
4. Install compiled plugindetailswiki.amxmodx.org/index.php/Configuring_AMX_Mod_X#Installing
#endif

#define PLUGIN "Pause"
#define VERSION "0.1.0"

new const Float:VEC_DUCK_HULL_MIN[3]    = {-16.0, -16.0, -18.0 }
new const 
Float:VEC_DUCK_HULL_MAX[3]    = { 16.0,  16.0,  32.0 }
new const 
Float:VEC_DUCK_VIEW[3]        = {  0.0,   0.0,  12.0 }
new const 
Float:VEC_NULL[3]    = { 0.00.00.0 }

new 
m_usResetDecals
new Float:g_flNewRoundTime

new Float:g_flPlayersOrigin[33][3]
new 
Float:g_flPlayersAngles[33][3]
new 
Float:g_flPlayersGravity[33]
new 
g_pPlayerItems[33][6]

enum {
    
PAUSED_NOT,
    
PAUSED_ONLY_RESPAWN,
    
PAUSED_RESTORE
}

enum _:hudHide ( <<= )
{
    
HUD_HIDE_CAL 1,
    
HUD_HIDE_FLASH,
    
HUD_HIDE_ALL,
    
HUD_HIDE_RHA,
    
HUD_HIDE_TIMER,
    
HUD_HIDE_MONEY,
    
HUD_HIDE_CROSS,
    
HUD_DRAW_CROSS
}

enum _:physicFlags ( <<= )
{
    
PFLAG_ONLADDER_ONSWING 1,
    
PFLAG_ONTRAIN,
    
PFLAG_ONBARNACLE,
    
PFLAG_DUCKING,    // In the process of ducking, but totally squatted yet
    
PFLAG_USING,    // Using a continuous entity
    
PFLAG_OBSERVER    // player is locked in stationary cam mode. Spectators can move, observers can't.
}

enum _USE_TYPE
{
    
USE_OFF 0,
    
USE_ON 1,
    
USE_SET 2,
    
USE_TOGGLE 3
}

enum _BOOL
{
    
FALSE,
    
TRUE
}

enum _:observerModes
{
    
OBS_NONE,
    
OBS_CHASE_LOCKED,
    
OBS_CHASE_FREE,
    
OBS_ROAMING,
    
OBS_IN_EYE,
    
OBS_MAP_FREE,
    
OBS_MAP_CHASE
}

new 
g_iPausedStatus[33 char]

new 
HamHook:g_iHhCBasePlayerRoundRespawn

public plugin_init()
{
    
register_event("HLTV""Event_HLTV_New_Round""a""1=0""2=0")
    
m_usResetDecals engfunc(EngFunc_PrecacheEvent1"events/decal_reset.sc")
    
register_forward(FM_PlaybackEvent"OnPlaybackEvent")

    
DisableHamForward
    
(
        
g_iHhCBasePlayerRoundRespawn RegisterHam(Ham_CS_RoundRespawn"player""OnCBasePlayer_RoundRespawn"false)
    )

    
register_clcmd("say /pause""ClCmd_Pause")
    
register_clcmd("say_team /pause""ClCmd_Pause")

    
register_message(get_user_msgid("ClCorpse"), "Message_ClCorpse")
}

public 
Message_ClCorpse()
{
    if( 
g_iPausedStatusget_msg_arg_int(12) } )
    {
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE
}

public 
client_putinserver(id)
{
    
g_iPausedStatus{id} = PAUSED_NOT
}

public 
Event_HLTV_New_Round()
{
    
g_flNewRoundTime get_gametime()
    
EnableHamForwardg_iHhCBasePlayerRoundRespawn )
}

public 
OnCBasePlayer_RoundRespawnid )
{
    switch( 
g_iPausedStatus{id} )
    {
        case 
PAUSED_RESTORE:
        {
            
g_iPausedStatus{id} = PAUSED_ONLY_RESPAWN
            
for(new i=1i<=5i++)
            {
                
set_pdata_cbase(idm_rgpPlayerItems_CBasePlayer[i], g_pPlayerItems[id][i])
            }
            
strip_user_weapons(id)
            
set_pdata_int(idm_fHasPrimaryFALSE)
            return 
HAM_SUPERCEDE
        
}
        case 
PAUSED_ONLY_RESPAWN:
        {
            return 
HAM_SUPERCEDE
        
}
    }
    return 
HAM_IGNORED
}

public 
OnPlaybackEvent(flagsentideventid /* , Float:delay, Float:Origin[3], Float:Angles[3], Float:fparam1, Float:fparam2, iparam1, iparam2, bparam1, bparam2 */ )
{
    if( 
eventid == m_usResetDecals && !floatcmp(get_gametime(), g_flNewRoundTime) )
    {
        
DisableHamForwardg_iHhCBasePlayerRoundRespawn )
    }
}

public 
ClCmd_Pauseid )
{
    switch( 
g_iPausedStatus{id} )
    {
        case 
PAUSED_NOT :
        {
            if( 
is_user_alive(id) )
            {
                if( 
get_user_health(id) < 100 )
                {
                    
client_print(idprint_chat" ** [PAUSE] You must have 100HP !!")
                    return
                }
                if( ~
pev(idpev_flags) & FL_ONGROUND )
                {
                    
client_print(idprint_chat" ** [PAUSE] You must be on the ground !!")
                    return
                }
                new 
Float:velocity[3]
                
pev(idpev_velocityvelocity)
                if( 
vector_length(velocity) > 0.0 )
                {
                    
client_print(idprint_chat" ** [PAUSE] You mustn't move !!")
                    return
                }

                
pev(idpev_origing_flPlayersOrigin[id])
                
pev(idpev_v_angleg_flPlayersAngles[id])
                
pev(idpev_gravityg_flPlayersGravity[id])

                if( 
user_has_weapon(idCSW_C4) )
                {
                    
engclient_cmd(id"drop""weapon_c4")
                }

                for(new 
i=1i<=5i++)
                {
                    
g_pPlayerItems[id][i] = get_pdata_cbase(idm_rgpPlayerItems_CBasePlayer[i])
                    
set_pdata_cbase(idm_rgpPlayerItems_CBasePlayer[i], FM_NULLENT// so CBasePlayer::HasWeapon return 0 and weapons are not stripped
                
}

                
set_pev(idpev_deadflagDEAD_DEAD)

                
StartObserver(idg_flPlayersOrigin[id], g_flPlayersAngles[id])

                
g_iPausedStatus{id} = PAUSED_RESTORE
            
}
            else
            {
                
g_iPausedStatus{id} = PAUSED_ONLY_RESPAWN
            
}
        }
        case 
PAUSED_ONLY_RESPAWN:
        {
            
g_iPausedStatus{id} = PAUSED_NOT
            ExecuteHamB
(Ham_CS_RoundRespawnid)
        }
        case 
PAUSED_RESTORE:
        {
            
g_iPausedStatus{id} = PAUSED_NOT

            set_pdata_int
(idm_iClientHideHUD, -1)
            
set_pdata_cbase(idm_pClientActiveItemFM_NULLENT)

            for(new 
i=1i<=5i++)
            {
                
set_pdata_cbase(idm_rgpPlayerItems_CBasePlayer[i], g_pPlayerItems[id][i])
            }
            
            
ExecuteHam(Ham_Spawnid// reset values
            
Util_SetOrigin(idg_flPlayersOrigin[id], g_flPlayersAngles[id], g_flPlayersGravity[id])

            new 
iActiveItem get_pdata_cbase(idm_pActiveItem)
            if( 
iActiveItem )
            {
                
ExecuteHamB(Ham_Item_DeployiActiveItem)
            }
        }
    }
}

StartObserver(idFloat:origin[3], Float:angles[3])
{
    
Util_TE_KILLPLAYERATTACHMENTSid )

    new 
iTank get_pdata_ent(idm_pTank_pent)
    if( 
iTank && pev_valid(iTank) )
    {
        
ExecuteHamB(Ham_UseiTankididUSE_OFF0.0)
        
// m_pTank = NULL;
    
}

    
// in cs routine this is before m_pTank check but m_pTank->StopControl can make player deploy m_pActiveItem
    
new iActiveItem get_pdata_cbase(idm_pActiveItem)
    if( 
iActiveItem )
    {
        
ExecuteHam(Ham_Item_HolsteriActiveItem0)
    }
    
    
Util_CurWeapon(id00xFF0xFF)

    
set_pev(idpev_fov0.0)
    
set_pdata_int(idm_iFOV0)
    
set_pdata_int(idm_iClientFOV0)
    
Util_SetFov(id0)
    
    
set_pdata_int(idm_iHideHUDHUD_HIDE_RHA HUD_HIDE_CAL)
    
// set_pdata_int(id, m_afPhysicsFlags, get_pdata_int(id, m_afPhysicsFlags) | PFLAG_OBSERVER) // this would prevent player from moving
    
set_pev(idpev_solidSOLID_NOT)
    
set_pev(idpev_effects/* pev(id, pev_effects) | */ EF_NODRAW)
    
    
set_pev(idpev_view_ofsVEC_NULL)

    
set_pev(idpev_v_angleangles)
    
set_pev(idpev_anglesangles)
    
set_pev(idpev_fixangle1)
    
    
set_pev(idpev_solidSOLID_NOT)
    
    
set_pev(idpev_takedamageDAMAGE_NO)
    
    
set_pev(idpev_movetypeMOVETYPE_NONE)
    
    
engfunc(EngFunc_SetOriginidorigin)
    
    
set_pdata_int(idm_afPhysicsFlagsget_pdata_int(idm_afPhysicsFlags) & ~PFLAG_DUCKING)
    
set_pev(idpev_flagspev(idpev_flags) & ~FL_DUCKING)
    
    
set_pev(idpev_health0.0)
    
    
set_pdata_int(idm_iSpectatedPlayerWeaponId0)
    
set_pdata_int(idm_fHasSpectatedPlayerC4FALSE)
    
set_pdata_int(idm_fHasSpectatedPlayerDefuseKitFALSE)

    
set_pdata_float(idm_flNextSpecButtonTime0.0)

    
// set_pev(id, pev_iuser1, 0)

    // since we don't want to make Observer_SetMode yet, try to set free look.
    
set_pev(idpev_iuser1OBS_ROAMING)
    
set_pev(idpev_iuser20)
    
set_pev(idpev_iuser30)
    
set_pdata_int(idm_iObserverModeOBS_ROAMING)
    
set_pdata_int(idm_fObserverHasTargetFALSE)
    
set_pdata_float(idm_flFindNextPlayerTime0.0)

    
Util_Crosshair(id1)

    
// if ( g_pGameRules
    // && CBasePlayer::StartObserver_Vector_Vector_::iFirstTime
    // && CHalfLifeMultiplay::IsCareer(g_pGameRules)
    // && !is_user_bot(id) )
    // {
        // CBasePlayer::Observer_SetMode(this, 1);
        // (g_engfuncs.pfnClientCommand)(this->pev->pContainingEntity, "spec_autodirector_internal 1\n");
        // CBasePlayer::StartObserver_Vector_Vector_::iFirstTime = 0;
    // }
    // else
    // {
        // CBasePlayer::Observer_SetMode(this, this->m_iObserverMode);
    // }
    
ExecuteHamB(Ham_CS_Player_ResetMaxSpeedid)
    
Util_Spectator(0id1)
}

Util_SetOrigin(idFloat:origin[3], Float:angles[3], Float:gravity)
{    
    
set_pev(idpev_flagspev(idpev_flags) | FL_DUCKING)
    
engfunc(EngFunc_SetSizeidVEC_DUCK_HULL_MINVEC_DUCK_HULL_MAX)
    
engfunc(EngFunc_SetOriginidorigin)
    
set_pev(idpev_view_ofsVEC_DUCK_VIEW)

    
set_pev(idpev_v_angleVEC_NULL)
    
set_pev(idpev_velocityVEC_NULL)
    
set_pev(idpev_anglesangles)
    
set_pev(idpev_punchangleVEC_NULL)
    
set_pev(idpev_fixangle1)

    
set_pev(idpev_gravitygravity)

    
set_pev(idpev_fuser20.0)
}

Util_TE_KILLPLAYERATTACHMENTS(id)
{
    new 
origin[3];
    
get_user_origin(idorigin);

    
message_begin(MSG_PASSVC_TEMPENTITYorigin);
    
write_byte(TE_KILLPLAYERATTACHMENTS);
    
write_byte(id);
    
message_end();
}

Util_CurWeapon(idIsActiveWeaponIDClipAmmo)
{
    static 
_msgCurWeapon 0;
    if( !
_msgCurWeapon )
    {
        
_msgCurWeapon get_user_msgid("CurWeapon");
    }
    
message_begin(id MSG_ONE MSG_ALL_msgCurWeapon, .player=id);
    
write_byte(IsActive);
    
write_byte(WeaponID);
    
write_byte(ClipAmmo);
    
message_end();
}

Util_SetFov(idDegrees)
{
    static 
_msgSetFOV 0;
    if( !
_msgSetFOV )
    {
        
_msgSetFOV get_user_msgid("SetFOV");
    }
    
message_begin(id MSG_ONE MSG_ALL_msgSetFOV, .player=id);
    
write_byte(Degrees);
    
message_end();
}

Util_Spectatorid playerIndexflag )
{
    static 
_msgSpectator 0;
    if( !
_msgSpectator )
    {
        
_msgSpectator get_user_msgid("Spectator");
    }
    
message_begin(id MSG_ONE MSG_ALL_msgSpectator, .player id);
    
write_byte(playerIndex);
    
write_byte(flag);
    
message_end();
}

Util_Crosshair(idiStatus)
{
    static 
_msgCrosshair 0
    
if( !_msgCrosshair )
    {
        
_msgCrosshair get_user_msgid("Crosshair")
    }
    
message_begin(id MSG_ONE MSG_ALL_msgCrosshair, .player=id)
    
write_byte(iStatus)
    
message_end()

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 04-14-2013 at 08:42.
ConnorMcLeod is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 04-14-2013 , 08:58   Re: [REQ] Pause
Reply With Quote #8

Error: Undefined symbol "Ham_CS_Player_ResetMaxSpeed" on line 318
Warning: Expression has no effect on line 318
Error: Expected token: ";", but found ")" on line 318
Error: Invalid expression, assumed zero on line 318
Error: Too many error messages on one line on line 318

Compilation aborted.
4 Errors.
__________________
Jhob94 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-14-2013 , 09:09   Re: [REQ] Pause
Reply With Quote #9

Works fine for me.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 04-14-2013 , 09:21   Re: [REQ] Pause
Reply With Quote #10

If you are allowed to post amxx, can you post it? Cant compile...
__________________
Jhob94 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 22:16.


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