Hello Everyone,
i want to make this plugins but i can't solved it i don't know how can i do it please help me
this is normal manual unstuck plugin for cs 1.6 but it's manual i mean
it's an like this : say /unstuck
but i want to change it in to Press R To Unstuck ........
there is plugins code which i was used: register_clcmd("+Reload", "FunC_Checkstuck", -1);
but it's not work fine.
when i use this code: register_clcmd("Nightvision", "FunC_CheckStuck", -1);
its work fine means player Press N he will unstuck but i want to change it to "R"
please help me
plugin code here >> plugin by crywolf >> Change it To Press R To Unstuck
my personal facebook acc: fb.com/harisrazaofficial
#include < amxmodx >
#include < fakemeta >
// Defines should be first
#define MAX_CLIENTS 32
#define START_DISTANCE 32
#define MAX_ATTEMPTS 128
#define GetPlayerHullSize(%1) ( ( pev ( %1, pev_flags ) & FL_DUCKING ) ? HULL_HEAD : HULL_HUMAN )
// Globals needed
new
g_MsgSync;
// pCvars begins
new
pCvar_Function,
pCvar_UnstEff,
pCvar_UnstWait,
pCvar_Announce [ 5 ];
new Float:gf_LastCmdTime [ MAX_CLIENTS + 1 ];
enum Coord_e
{
Float
,
Float:y,
Float:z
};
/********************************************* ***************************************/
// If you use a Zombie Mod and don't want zombies to cheat using untuck command
// Uncomment the Mod you Use
// Default NO Mod
#define USE_DEFAULT
// Zombie Plague 4.3 and 5.0
// #define USE_ZPMOD
// Biohazard [ALL Version]
// #define USE_BIOMOD
// Don't touch
#if defined USE_ZPMOD
#tryinclude < zombieplague >
#endif
#if defined USE_BIOMOD
#tryinclude < biohazard >
#endif
/********************************************* ***************************************/
// Plugins begins
public plugin_init ( )
{
register_plugin ( "AMXX Unstuck", "1.7.2", "AMXX Dev Builder" ); // & CryWolf
// Main plugin
pCvar_Function = register_cvar ( "amx_unstuck", "1" );
pCvar_UnstEff = register_cvar ( "amx_autounstuckeffects", "1" );
pCvar_UnstWait = register_cvar ( "amx_autounstuckwait", "7.0" );
// Message pCvars
pCvar_Announce [ 0 ] = register_cvar ( "amx_unst_announce", "1" );
pCvar_Announce [ 1 ] = register_cvar ( "amx_ann_time", "120" );
pCvar_Announce [ 2 ] = register_cvar ( "amx_ann_type", "1" );
pCvar_Announce [ 3 ] = register_cvar ( "amx_ann_hold", "15.0" );
pCvar_Announce [ 4 ] = register_cvar ( "amx_ann_effects", "0" );
// Chat commands
register_clcmd ( "say /unstuck", "FunC_CheckStuck", -1 );
register_clcmd ( "say /stuck", "FunC_CheckStuck", -1 );
register_clcmd ( "say /unblock", "FunC_CheckStuck", -1 );
if ( get_pcvar_num ( pCvar_Announce [ 0 ] ) )
{
g_MsgSync = CreateHudSyncObj ( );
set_task ( get_pcvar_float ( pCvar_Announce [ 1 ] ), "ShowMessage", 0, _, _, "b", _ );
}
}
public ShowMessage ( )
{
switch ( get_pcvar_num ( pCvar_Announce [ 2 ] ) )
{
case 1:
{
client_print ( 0, print_chat, "[Unstuck] If you are stucked type /unstuck in chat to unstuck" );
}
case 2:
{
set_hudmessage ( 170, 255, 127, 0.02, 0.17, get_pcvar_num ( pCvar_Announce [ 4 ] ), 6.0, get_pcvar_float ( pCvar_Announce [ 3 ] ) );
ShowSyncHudMsg ( 0, g_MsgSync, "If you are stucked type /unstuck in chat to unstuck" );
}
default: return;
}
}
public FunC_CheckStuck ( const iPlayer)
{
if ( !get_pcvar_num ( pCvar_Function ) )
return 1;
new Float:f_MinFrequency = get_pcvar_float ( pCvar_UnstWait );
new Float:f_ElapsedCmdTime = get_gametime ( ) - gf_LastCmdTime [ iPlayer ];
if ( f_ElapsedCmdTime < f_MinFrequency )
{
client_print ( iPlayer, print_chat, "[AMXX] You must wait %.1f seconds before trying to free yourself.", f_MinFrequency - f_ElapsedCmdTime );
return 1;
}
gf_LastCmdTime [ iPlayer ] = get_gametime ( );
new i_Value;
if ( ( i_Value = UnstuckPlayer ( iPlayer, START_DISTANCE, MAX_ATTEMPTS ) ) != 1 )
{
switch ( i_Value )
{
case 0 : {
client_print ( iPlayer, print_chat, "[Unstuck] Couldn't find a free spot to move you too" );
}
case -1 : {
client_print ( iPlayer, print_chat, "[Unstuck] You cannot free yourself as dead player" );
}
}
}
return 1;
}
public UnstuckPlayer ( const id, const i_StartDistance, const i_MaxAttempts )
{
#if defined USE_DEFAULT
if ( is_user_alive ( id ) )
{
#endif
#if defined USE_ZPMOD
if ( is_user_alive ( id ) && !zp_get_user_zombie ( id ) )
{
#endif
#if defined USE_BIOMOD
if ( is_user_alive ( id ) && !is_user_zombie ( id ) )
{
#endif
static Float:vf_OriginalOrigin [ Coord_e ], Float:vf_NewOrigin [ Coord_e ];
static i_Attempts, i_Distance;
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 );
if ( get_tr2 ( 0, TR_InOpen ) && !get_tr2 ( 0, TR_AllSolid ) && !get_tr2 ( 0, TR_StartSolid ) )
{
engfunc ( EngFunc_SetOrigin, id, vf_NewOrigin );
effects ( id );
client_print ( id, print_chat, "[Unstuck] You have been teleported to a new location." );
return 1;
}
}
i_Distance += i_StartDistance;
}
}
return 0;
}
public effects ( id )
{
if ( get_pcvar_num ( pCvar_UnstEff ) )
{
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" );
}
}