Помощь по плагину grab_new

Статус
В этой теме нельзя размещать новые ответы.

Molodoi

Команда форума
Модератор
Регистрация
14 Июн 2017
Сообщения
606
Симпатии
126
Каким то образом игроки имеющие лицуху STEAM могут тоже юзать граб но им выдаются всего 2 флага t и r. как не пытался менять флаг доступа в исходнике у них он снова работает. Подскажите как исправить.
PHP:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
 
new const VERSION[ ] = "2.5"
new const TRKCVAR[ ] = "grab"
new const AVTOR[ ] = "Support123"
#define ADMIN ADMIN_LEVEL_A
 
#define TSK_CHKE 50
 
#define SF_FADEOUT 0
 
new client_data[33][4]
#define GRABBED  0
#define GRABBER  1
#define GRAB_LEN 2
#define FLAGS    3
 
new p_enabled, p_player
new p_throw_force, p_grab_force
new p_glow_r, p_glow_b, p_glow_g, p_glow_a
new p_glow
 
new MAXPLAYERS
 
public plugin_init( )
{
   register_plugin( "Grab", VERSION, "Support123" )
   register_cvar( TRKCVAR, VERSION, FCVAR_SERVER )
   set_cvar_string( TRKCVAR, VERSION )
    
 
   p_glow = register_cvar( "grab_glow", "1" )
   p_enabled = register_cvar( "grab_enabled", "1" )
        p_player = register_cvar( "grab_only_player", "0" )
 
   p_throw_force = register_cvar( "grab_throw_force", "1500" )
   p_grab_force = register_cvar( "grab_force", "10" )
    
   p_glow_r = register_cvar( "grab_glow_r", "255" )
   p_glow_g = register_cvar( "grab_glow_g", "255" )
   p_glow_b = register_cvar( "grab_glow_b", "255" )
   p_glow_a = register_cvar( "grab_glow_a", "111" )
 
   register_clcmd( "+grab", "grab", ADMIN, "Забиндить Кнопку" )
   register_clcmd( "-grab", "unset_grabbed" )
 
   register_clcmd( "drop" ,"throw" )
    
   register_event( "DeathMsg", "DeathMsg", "a" )
    
   register_forward( FM_PlayerPreThink, "fm_player_prethink" )
 
   MAXPLAYERS = get_maxplayers()
}
 
public plugin_precache( )
{
   precache_sound( "player/PL_PAIN2.WAV" )
}
 
public fm_player_prethink( id )
{
   new target
   if ( client_data[id][GRABBED] == -1 )
   {
      new Float:orig[3], Float:ret[3]
      get_view_pos( id, orig )
      ret = vel_by_aim( id, 9999 )
      
      ret[0] += orig[0]
      ret[1] += orig[1]
      ret[2] += orig[2]
      
      target = traceline( orig, ret, id, ret )
      
      if( 0 < target <= MAXPLAYERS )
      {
         if( is_grabbed( target, id ) ) return FMRES_IGNORED
         set_grabbed( id, target )
      }
      else if( !get_pcvar_num( p_player ) )
      {
         new movetype
         if( target && pev_valid( target ) )
         {
            movetype = pev( target, pev_movetype )
            if( !( movetype == MOVETYPE_WALK || movetype == MOVETYPE_STEP || movetype == MOVETYPE_TOSS ) )
               return FMRES_IGNORED
         }
         else
         {
            target = 0
            new ent = engfunc( EngFunc_FindEntityInSphere, -1, ret, 12.0 )
            while( !target && ent > 0 )
            {
               movetype = pev( ent, pev_movetype )
               if( ( movetype == MOVETYPE_WALK || movetype == MOVETYPE_STEP || movetype == MOVETYPE_TOSS )
                     && ent != id  )
                  target = ent
               ent = engfunc( EngFunc_FindEntityInSphere, ent, ret, 12.0 )
            }
         }
         if( target )
         {
            if( is_grabbed( target, id ) ) return FMRES_IGNORED
            set_grabbed( id, target )
         }
      }
   }
    
   target = client_data[id][GRABBED]
   if( target > 0 )
   {
      if( !pev_valid( target ) || ( pev( target, pev_health ) < 1 && pev( target, pev_max_health ) ) )
      {
         unset_grabbed( id )
         return FMRES_IGNORED
      }
 
      if( target > MAXPLAYERS ) grab_think( id )
   }
    
   target = client_data[id][GRABBER]
   if( target > 0 ) grab_think( target )
    
   return FMRES_IGNORED
}
 
public grab_think( id )
{
   new target = client_data[id][GRABBED]
 
   if( pev( target, pev_movetype ) == MOVETYPE_FLY && !(pev( target, pev_button ) & IN_JUMP ) ) client_cmd( target, "+jump;wait;-jump" )
 
   new Float:tmpvec[3], Float:tmpvec2[3], Float:torig[3], Float:tvel[3]
    
   get_view_pos( id, tmpvec )
    
   tmpvec2 = vel_by_aim( id, client_data[id][GRAB_LEN] )
    
   torig = get_target_origin_f( target )
    
   new force = get_pcvar_num( p_grab_force )
    
   tvel[0] = ( ( tmpvec[0] + tmpvec2[0] ) - torig[0] ) * force
   tvel[1] = ( ( tmpvec[1] + tmpvec2[1] ) - torig[1] ) * force
   tvel[2] = ( ( tmpvec[2] + tmpvec2[2] ) - torig[2] ) * force
    
   set_pev( target, pev_velocity, tvel )
}
 
stock Float:get_target_origin_f( id )
{
   new Float:orig[3]
   pev( id, pev_origin, orig )
 
   if( id > MAXPLAYERS )
   {
      new Float:mins[3], Float:maxs[3]
      pev( id, pev_mins, mins )
      pev( id, pev_maxs, maxs )
      
      if( !mins[2] ) orig[2] += maxs[2] / 2
   }
    
   return orig
}
 
public grab( id, level, cid )
{
   if( !cmd_access( id, level, cid, 1 ) || !get_pcvar_num( p_enabled ) ) return PLUGIN_HANDLED
    
   if ( !client_data[id][GRABBED] ) client_data[id][GRABBED] = -1 
    
   return PLUGIN_HANDLED
}
 
public throw( id )
{
   new target = client_data[id][GRABBED]
   if( target > 0 )
   {
      set_pev( target, pev_velocity, vel_by_aim( id, get_pcvar_num(p_throw_force) ) )
      unset_grabbed( id )
      return PLUGIN_HANDLED
   }
 
   return PLUGIN_CONTINUE
}
 
public unset_grabbed( id )
{
   new target = client_data[id][GRABBED]
   if( target > 0 && pev_valid( target ) )
   {
      set_pev( target, pev_renderfx, kRenderFxNone )
      set_pev( target, pev_rendercolor, {255.0, 255.0, 255.0} )
      set_pev( target, pev_rendermode, kRenderNormal )
      set_pev( target, pev_renderamt, 16.0 )
      
      if( 0 < target <= MAXPLAYERS )
         client_data[target][GRABBER] = 0
   }
   client_data[id][GRABBED] = 0
}
 
public set_grabbed( id, target )
{
   if( get_pcvar_num( p_glow ) )
   {
      new Float:color[3]
      color[0] = get_pcvar_float( p_glow_r )
      color[1] = get_pcvar_float( p_glow_g )
      color[2] = get_pcvar_float( p_glow_b )
      set_pev( target, pev_renderfx, kRenderFxGlowShell )
      set_pev( target, pev_rendercolor, color )
      set_pev( target, pev_rendermode, kRenderTransColor )
      set_pev( target, pev_renderamt, get_pcvar_float( p_glow_a ) )
   }
    
   if( 0 < target <= MAXPLAYERS )
      client_data[target][GRABBER] = id
   client_data[id][FLAGS] = 0
   client_data[id][GRABBED] = target
   new Float:torig[3], Float:orig[3]
   pev( target, pev_origin, torig )
   pev( id, pev_origin, orig )
   client_data[id][GRAB_LEN] = floatround( get_distance_f( torig, orig ) )
}
 
public is_grabbed( target, grabber )
{
   for( new i = 1; i <= MAXPLAYERS; i++ )
      if( client_data[i][GRABBED] == target )
      {
         client_print( grabber, print_chat, "[AMXX] %L", grabber, "ALREADY" )
         unset_grabbed( grabber )
         return true
      }
   return false
}
 
public DeathMsg( )
   kill_grab( read_data( 2 ) )
 
public client_disconnect( id )
{
   kill_grab( id )
   return PLUGIN_CONTINUE
}
 
public kill_grab( id )
{
   if( client_data[id][GRABBED] )
      unset_grabbed( id )
   else if( client_data[id][GRABBER] )
      unset_grabbed( client_data[id][GRABBER] )
}
 
stock traceline( const Float:vStart[3], const Float:vEnd[3], const pIgnore, Float:vHitPos[3] )
{
   engfunc( EngFunc_TraceLine, vStart, vEnd, 0, pIgnore, 0 )
   get_tr2( 0, TR_vecEndPos, vHitPos )
   return get_tr2( 0, TR_pHit )
}
 
stock get_view_pos( const id, Float:vViewPos[3] )
{
   new Float:vOfs[3]
   pev( id, pev_origin, vViewPos )
   pev( id, pev_view_ofs, vOfs )     
    
   vViewPos[0] += vOfs[0]
   vViewPos[1] += vOfs[1]
   vViewPos[2] += vOfs[2]
}
 
stock Float:vel_by_aim( id, speed = 1 )
{
   new Float:v1[3], Float:vBlah[3]
   pev( id, pev_v_angle, v1 )
   engfunc( EngFunc_AngleVectors, v1, v1, vBlah, vBlah )
    
   v1[0] *= speed
   v1[1] *= speed
   v1[2] *= speed
    
   return v1
}
 

HoBu4oK

Пользователь
Регистрация
8 Июн 2017
Сообщения
139
Симпатии
56
Проверь через amx_who какие флаги у них и какой флаг плагина указан в cmdaccess.ini
 

Molodoi

Команда форума
Модератор
Регистрация
14 Июн 2017
Сообщения
606
Симпатии
126
HoBu4oK, спасибо посмотрю отпишу.
 

Molodoi

Команда форума
Модератор
Регистрация
14 Июн 2017
Сообщения
606
Симпатии
126
HoBu4oK, спасибо исправил.
 
Статус
В этой теме нельзя размещать новые ответы.
Сверху Снизу