[Half-Life AMXX] / climb.sma Repository:
ViewVC logotype

Diff of /climb.sma

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 36, Sun Jan 6 00:44:12 2008 UTC revision 37, Mon Jan 21 06:14:04 2008 UTC
# Line 135  Line 135 
135  -: Plugin ad on client connect.  -: Plugin ad on client connect.
136  -: WebMod support since it is a huge security vulnerability.  -: WebMod support since it is a huge security vulnerability.
137  -: Cvars: climb_webmod, climb_stats_path, climb_stats_url, ip_internal, ip_external  -: Cvars: climb_webmod, climb_stats_path, climb_stats_url, ip_internal, ip_external
138  c: Tweaked semiclip to hopefully eliminate lag problems reported by some people.  //c: Tweaked semiclip to hopefully eliminate lag problems reported by some people.
139    //c: New semiclip, should be flawless now.
140  c: Cvar climb_water_nodraw changes take effect without reloading map.  c: Cvar climb_water_nodraw changes take effect without reloading map.
141  c: Database now stores multiple records per map per player.  c: Database now stores multiple records per map per player.
142  c: Cvar climb_db_pass is now protected.  c: Cvar climb_db_pass is now protected.
# Line 268  Line 269 
269  #include <cstrike>  #include <cstrike>
270  #include <cstrike2>  #include <cstrike2>
271    
272  new const VERSION[ ] = "a3.7.4 Nov 24 15:41 MST"  new const VERSION[ ] = "a3.7.5 Jan 20 23:00 MST"
273  new const TRKCVAR[ ] = "climb_version"  new const TRKCVAR[ ] = "climb_version"
274    
275  new const DONOTHING[ ] = "donothing"  new const DONOTHING[ ] = "donothing"
# Line 343  Line 344 
344  new ST_BTNS[9], FN_BTNS[9], ST_BTN_CNT = 0, FN_BTN_CNT = 0  new ST_BTNS[9], FN_BTNS[9], ST_BTN_CNT = 0, FN_BTN_CNT = 0
345  new dyn_spawn_ids[32], dyn_spawn_count, Float:spawn_tp_orig[3], Float:start_tp_orig[3]  new dyn_spawn_ids[32], dyn_spawn_count, Float:spawn_tp_orig[3], Float:start_tp_orig[3]
346    
347  new bool:sclip[33],Float:post_think_vel[33][3],sc_fcount  new Float:post_think_vel[33][3]
348    
349  new LIMIT_TEAMS_OLD, TEAM_BALANCE_OLD  new LIMIT_TEAMS_OLD, TEAM_BALANCE_OLD
350    
# Line 386  Line 387 
387    
388  #define SILENT 1  #define SILENT 1
389    
390    //Boost Flags for climb_boost CVAR
391    #define SOLID 1
392    #define DJUMP 2
393    #define SJUMP 4
394    
395  new SVC_STATUSICON, SVC_TEAMINFO, SVC_ROUNDTIME, SVC_FLASHLIGHT, SVC_SCREENFADE  new SVC_STATUSICON, SVC_TEAMINFO, SVC_ROUNDTIME, SVC_FLASHLIGHT, SVC_SCREENFADE
396    
397  new SCORES_PATH[100], HSCORES_PATH[100]  new SCORES_PATH[100], HSCORES_PATH[100]
# Line 401  Line 407 
407    
408          p_climb = register_cvar( "climb", "0", FCVAR_SERVER )          p_climb = register_cvar( "climb", "0", FCVAR_SERVER )
409          p_auto = register_cvar( "climb_auto", "1" )          p_auto = register_cvar( "climb_auto", "1" )
410          p_boost = register_cvar( "climb_boost", "1" )          p_boost = register_cvar( "climb_boost", "7" )
411          p_cpprice = register_cvar( "climb_cpprice", "0" )          p_cpprice = register_cvar( "climb_cpprice", "0" )
412          p_startmoney = register_cvar( "climb_startmoney", "1337" )          p_startmoney = register_cvar( "climb_startmoney", "1337" )
413    
# Line 542  Line 548 
548          if( file_exists( ini ) )          if( file_exists( ini ) )
549          {          {
550                  new line = 0, text[50], len                  new line = 0, text[50], len
551                  while( read_file( ini, line++, text, sizeof(text)-1 , len ) )                  while( read_file( ini, line++, text, 49 , len ) )
552                  {                  {
553                          if( !equal( text, ";", 1 ) && !equal( text, "#", 1 ) && !equal( text, "//", 2 ) )                          if( !equal( text, ";", 1 ) && !equal( text, "#", 1 ) && !equal( text, "//", 2 ) )
554                          {                          {
# Line 668  Line 674 
674                  }                  }
675    
676                  //If Cvar set, set func_water ents to no draw, helps many peoples FPS                  //If Cvar set, set func_water ents to no draw, helps many peoples FPS
677                  if( get_pcvar_num( p_water_nodraw ) )                  /*if( get_pcvar_num( p_water_nodraw ) )
678                  {                  {
679                          ent = find_ent_by_class( -1, "func_water" )                          ent = find_ent_by_class( -1, "func_water" )
680                          while( ent > 0 )                          while( ent > 0 )
# Line 676  Line 682 
682                                  set_entity_visibility( ent, 0 )                                  set_entity_visibility( ent, 0 )
683                                  ent=find_ent_by_class( ent, "func_water" )                                  ent=find_ent_by_class( ent, "func_water" )
684                          }                          }
685                  }                  }*/
686    
687                  //Remove map built in start button sounds                  //Remove map built in start button sounds
688                  ent = find_ent_by_class( -1, "ambient_generic" )                  ent = find_ent_by_class( -1, "ambient_generic" )
# Line 1037  Line 1043 
1043                  {                  {
1044                          cflags_new += CF_START                          cflags_new += CF_START
1045                          set_entity_flags( id, FL_FROZEN, 0 )                          set_entity_flags( id, FL_FROZEN, 0 )
1046                          unsolid( id )                          //set_solid( id, 0 );
1047                          entity_set_float( id, EV_FL_gravity, origins[id][ORIG_PAUS + ORIG_GRAV] )                          entity_set_float( id, EV_FL_gravity, origins[id][ORIG_PAUS + ORIG_GRAV] )
1048                          clmsg( id, "UNPAUSED" )                          clmsg( id, "UNPAUSED" )
1049                          sfexec( id, 2 )                          sfexec( id, 2 )
# Line 1062  Line 1068 
1068  {  {
1069          if( is_climber_alive( id ) )          if( is_climber_alive( id ) )
1070          {          {
1071                  unsolid( id )                  set_solid( id, 0 );
1072                  set_rendering( id, kRenderFxGlowShell, 0, 0, 255, kRenderTransColor, 1 )                  set_rendering( id, kRenderFxGlowShell, 0, 0, 255, kRenderTransColor, 1 )
1073                    //set_pev( id, pev_flags, pev( id, pev_flags ) & FL_FROZEN )
1074                  set_entity_flags( id, FL_FROZEN, 1 )                  set_entity_flags( id, FL_FROZEN, 1 )
1075                  clmsg( id, "PAUSED - say '/unpause' to resume." )                  clmsg( id, "PAUSED - say '/unpause' to resume." )
1076          }          }
# Line 1284  Line 1291 
1291          cs_user_spawn( id )          cs_user_spawn( id )
1292    
1293          set_pev( id, pev_movetype, MOVETYPE_WALK )          set_pev( id, pev_movetype, MOVETYPE_WALK )
1294          set_pev( id, pev_solid, SOLID_BBOX )          set_pev( id, pev_solid, SOLID_SLIDEBOX )
1295          set_pev( id, pev_effects, 0 )          set_pev( id, pev_effects, 0 )
1296          set_pev( id, pev_deadflag, DEAD_NO )          set_pev( id, pev_deadflag, DEAD_NO )
1297          set_pev( id, pev_takedamage, DAMAGE_AIM )          set_pev( id, pev_takedamage, DAMAGE_AIM )
# Line 1301  Line 1308 
1308    
1309  public ResetHUD( id )  public ResetHUD( id )
1310  {//Spawned  {//Spawned
1311          if( get_pcvar_num( p_climb ) )          if( !get_pcvar_num( p_climb ) )
1312          {          {
1313                    set_msg_block( SVC_STATUSICON, 0 )
1314                    return
1315            }
1316    
1317                  if( !is_user_bot( id ) && !is_user_hltv( id ) )                  if( !is_user_bot( id ) && !is_user_hltv( id ) )
1318                  {                  return
1319    
1320                          flight_icons( id )//redraw flashlight hud icons                          flight_icons( id )//redraw flashlight hud icons
1321                          set_msg_block( SVC_STATUSICON, 2 )//Block buy menu                          set_msg_block( SVC_STATUSICON, 2 )//Block buy menu
1322    
1323                          if( is_climber_alive( id ) )                          if( is_climber_alive( id ) )
1324                          {                          {
                                 //set_pev( id, pev_movetype, MOVETYPE_WALK )  
                                 //cs_set_user_team( id, 2 )  
   
1325                                  heal( id )                                  heal( id )
                                 sfexec( id, 1 )//Execute commands from start/finish config  
                                 if( get_user_flags( id ) & VIP ) cs_set_user_scoreattrib( id, 4 )//Show admin as VIP on Scoreboard.  
1326    
1327                    //Execute commands from start/finish config
1328                    sfexec( id, 1 )
1329    
1330                    //Show admin as VIP on Scoreboard.
1331                    if( get_user_flags( id ) & VIP ) cs_set_user_scoreattrib( id, 4 )
1332    
1333                    //If they are paused tp to pause spot and freeze them again.
1334                                  if( timer[id][TMR_CFLAGS] & CF_PAUSE )                                  if( timer[id][TMR_CFLAGS] & CF_PAUSE )
1335                                  {//If they are paused tp to pause spot and freeze them again.                  {
1336                                          new Float:coords[3]                                          new Float:coords[3]
1337                                          for( new i=0; i<3; i++ ) coords[i] = origins[ id - 1 ][ ORIG_PAUS + i ]                          coords[0] = origins[ id ][ ORIG_PAUS + 0 ]
1338                            coords[1] = origins[ id ][ ORIG_PAUS + 1 ]
1339                            coords[2] = origins[ id ][ ORIG_PAUS + 2 ]
1340                                          teleport( id, coords )                                          teleport( id, coords )
1341                                          cl_pause( id )                                          cl_pause( id )
1342                                  }                                  }
1343    
1344                                  //Teleport to cp, start, or primary spawn position                                  //Teleport to cp, start, or primary spawn position
1345                                  else if( origins[ id - 1 ][ 0 ] || origins[ id - 1][ 1 ] || origins[ id - 1 ][ 2 ]) gocheck( id )                  else if( origins[ id ][ 0 ] || origins[ id ][ 1 ] || origins[ id ][ 2 ]) gocheck( id )
1346                                  else if( !teleport( id, start_tp_orig ) ) teleport( id, spawn_tp_orig )                                  else if( !teleport( id, start_tp_orig ) ) teleport( id, spawn_tp_orig )
1347                          }                          }
                 }  
1348                  sortcssb( )                  sortcssb( )
1349          }          }
         else set_msg_block( SVC_STATUSICON, 0 )  
 }  
1350    
1351  public run_tasks( )  public run_tasks( )
1352  {  {
# Line 1343  Line 1356 
1356    
1357  public updatebot( )  public updatebot( )
1358  {  {
1359          if(get_pcvar_num(p_climb))          if( !get_pcvar_num(p_climb) ) return
1360          {  
                 //new players[32], cl  
                 //get_players( players, cl, "ach" )  
1361                  new id = find_player( "i" )                  new id = find_player( "i" )
1362                  //if(0<cl<3&&!id){                  //if(0<cl<3&&!id){
1363                  new cl = get_playersnum( )                  new cl = get_playersnum( )
# Line 1385  Line 1396 
1396                                  cs_user_spawn( id )                                  cs_user_spawn( id )
1397                          }                          }
1398                  }                  }
                 //else if(cl>2&&id)server_cmd("kick #%d",get_user_userid(id))  
1399                  else if( cl == MAXPLAYERS - 1 && id )                  else if( cl == MAXPLAYERS - 1 && id )
1400                  {                  {
1401                          set_entity_visibility( id, 1 )                          set_entity_visibility( id, 1 )
1402                          server_cmd( "kick #%d", get_user_userid( id ) )                          server_cmd( "kick #%d", get_user_userid( id ) )
1403                  }                  }
1404                  else if( is_user_bot( id ) && id )          else if( id )
1405                  {                  {
1406                          set_entity_visibility( id, 0 )                          set_entity_visibility( id, 0 )
1407                          entity_set_int( id, EV_INT_solid, SOLID_NOT )                          entity_set_int( id, EV_INT_solid, SOLID_NOT )
# Line 1400  Line 1410 
1410                          call_think( id )                          call_think( id )
1411                  }                  }
1412          }          }
 }  
1413    
1414  public check_cvars( )  public check_cvars( )
1415  {  {
# Line 1451  Line 1460 
1460          return dif          return dif
1461  }  }
1462    
1463    public boost_enabled( id, boost_type, silent )
1464    {
1465            if( get_pcvar_num( p_boost ) & boost_type ) return true;
1466            if( !silent ) clmsg( id, "That boost type has been disabled by the server admin." );
1467            return false;
1468    }
1469    
1470  stock change_boost( id, newboost, silent = 0 )  stock change_boost( id, newboost, silent = 0 )
1471  {//Change Boost flags  {//Change Boost flags
1472          if( !( cvar_enabled( id, p_boost, silent ) && isalive( id ) ) && notpaused( id ) ) return PLUGIN_HANDLED          //if( !( cvar_enabled( id, p_boost, silent ) && isalive( id ) ) && notpaused( id ) ) return PLUGIN_HANDLED
1473            if( !isalive( id ) || !notpaused( id ) ) return PLUGIN_HANDLED
1474    
1475          new msg[151], rmflag, cflags = timer[ id - 1 ][ TMR_CFLAGS ]          new msg[151], rmflag, cflags = timer[ id ][ TMR_CFLAGS ]
1476          if( cflags & CF_SOLID )          if( cflags & CF_SOLID )
1477          {          {
1478                  if( task_exists( 150 + id ) ) remove_task( 150 + id )                  if( task_exists( 150 + id ) ) remove_task( 150 + id )
# Line 1472  Line 1489 
1489                  rmflag = CF_DOUBLE_JUMP                  rmflag = CF_DOUBLE_JUMP
1490                  msg = "Double Jump Disabled.^n"                  msg = "Double Jump Disabled.^n"
1491          }          }
1492          if( rmflag > 0 ) timer[ id - 1 ][ TMR_CFLAGS ] -= rmflag          if( rmflag > 0 ) timer[ id ][ TMR_CFLAGS ] -= rmflag
1493          if( !( rmflag & newboost ) && \          if( !( rmflag & newboost ) && \
1494                  !check_timeout( id, time_stamps[id][TS_BOOST], BOOST_TIMEOUT, ( cflags & CF_START ? timer[id][TMR_CNTTME] / 10 : get_systime() ) ) )                  !check_timeout( id, time_stamps[id][TS_BOOST], BOOST_TIMEOUT, ( cflags & CF_START ? timer[id][TMR_CNTTME] / 10 : get_systime() ) ) )
1495          {          {
1496                  if( newboost == CF_SOLID )                  if( newboost == CF_SOLID && boost_enabled( id, SOLID, silent ) )
1497                  {                  {
1498                          format( msg, 150, "%sSolid Boost Enabled.", msg )                          format( msg, 150, "%sSolid Boost Enabled.", msg )
1499                          new ida[1]                          new ida[1]
1500                          ida[0] = id                          ida[0] = id
1501                          set_task( 15.0, "solid_boost_timer", 150 + id, ida, 1 )                          set_task( 15.0, "solid_boost_timer", 150 + id, ida, 1 )
1502                          if( timer[ id - 1 ][ TMR_CFLAGS ] & CF_START ) timer[ id - 1 ][ TMR_CNTBST ]++                          if( timer[ id ][ TMR_CFLAGS ] & CF_START ) timer[ id ][ TMR_CNTBST ]++
1503                  }                  }
1504                  if( newboost == CF_SUPER_JUMP ) format( msg, 150, "%sSuper Jump Enabled.", msg )                  if( newboost == CF_SUPER_JUMP && boost_enabled( id, SJUMP, silent ) )
1505                  if( newboost == CF_DOUBLE_JUMP ) format( msg, 150, "%sDouble Jump Enabled.", msg )                          format( msg, 150, "%sSuper Jump Enabled.", msg )
1506                  timer[ id - 1 ][ TMR_CFLAGS ] |= newboost                  if( newboost == CF_DOUBLE_JUMP && boost_enabled( id, DJUMP, silent ) )
1507                            format( msg, 150, "%sDouble Jump Enabled.", msg )
1508                    timer[ id  ][ TMR_CFLAGS ] |= newboost
1509          }          }
1510          if(strlen(msg))clmsg(id,msg)          if(strlen(msg))clmsg(id,msg)
1511          return PLUGIN_HANDLED          return PLUGIN_HANDLED
# Line 1496  Line 1515 
1515  public solid_boost_timer( ida[] )  public solid_boost_timer( ida[] )
1516          change_boost( ida[0], CF_SOLID )          change_boost( ida[0], CF_SOLID )
1517    
1518  /*public server_frame( )  //Semi-clip
1519  {//Semi-clip  public server_frame( )
         if( get_pcvar_num( p_climb ) )  
1520          {          {
1521                  new players[32], bool:skip[32], num, i, j          if( !get_pcvar_num( p_climb ) ) return FMRES_IGNORED
1522                  new Float:orig_i[3], Float:orig_j[3]  
1523                  new Float:vel_i[3], Float:vel_iz[3]          new players[32], num, i, j, Float:c1[3], Float:c2[3];
1524                  new id_i, id_j, cflags_i, cflags_j          new Float:c1z[3], Float:c2z[3];
1525                  get_players( players, num, "ac" )          new id_i, id_j, cflags_i, cflags_j;
1526            get_players( players, num, "ach" );
1527    
1528            //new Float:c1d[3],Float:c2d[3],xyadd,zadd
1529                  for( i = 0; i < num; i++ )                  for( i = 0; i < num; i++ )
1530                  {                  {
1531                          id_i = players[i]                  id_i = players[ i ];
1532                          cflags_i = timer[id_i][TMR_CFLAGS]                  cflags_i = timer[id_i][TMR_CFLAGS];
   
1533                          if( !( cflags_i & CF_PAUSE ) )                          if( !( cflags_i & CF_PAUSE ) )
1534                          {                          {
1535                                  entity_get_vector( id_i, EV_VEC_origin, orig_i )                          //Auto Semiclip
1536                                  entity_get_vector( id_i, EV_VEC_velocity, vel_i )                          entity_get_vector( id_i, EV_VEC_origin, c1 );
   
                                 vel_iz[0] = vel_i[0] > 0 ? -70.0 : 70.0  
                                 vel_iz[1] = vel_i[1] > 0 ? -70.0 : 70.0  
                                 vel_iz[2] = vel_i[2] > 0 ? -120.0 : 120.0  
   
                                 if( !vel_i[0] ) vel_i[0] = vel_iz[0] * -1  
                                 if( !vel_i[1] ) vel_i[1] = vel_iz[1] * -1  
                                 if( !vel_i[2] ) vel_i[2] = vel_iz[2] * -1  
1537    
1538                            c1z[2] = c1[2];
1539                            c1[2] = 0.0;
1540                                  for( j=0; j<num; j++ )                                  for( j=0; j<num; j++ )
1541                                  {                                  {
1542                                          if( i != j )                                  id_j = players[j];
1543                                    cflags_j = timer[id_j][TMR_CFLAGS];
1544                                    if( !( cflags_j & CF_SOLID ) && i != j )
1545                                          {                                          {
1546                                                  id_j = players[j]                                          entity_get_vector( id_j, EV_VEC_origin, c2 );
                                                 cflags_j = timer[id_j][TMR_CFLAGS]  
1547    
1548                                                  if( ( !( cflags_i & CF_SOLID && cflags_j & CF_SOLID ) || skip[i] ) && !( cflags_j & CF_PAUSE ) )                                          c2z[2] = c2[2];
1549                                            c2[2] = 0.0;
1550                                            if( vector_distance( c1, c2 ) < 90 && vector_distance( c1z, c2z ) < 110)
1551                                                  {                                                  {
1552                                                          entity_get_vector( id_j, EV_VEC_origin, orig_j )                                                  if( !(cflags_i & CF_SOLID && cflags_j & CF_SOLID ) )
   
                                                         if( is_between_f( orig_j[0], orig_i[0] + vel_iz[0], orig_i[0] + vel_i[0] ) &&  
                                                                         is_between_f( orig_j[1], orig_i[1] + vel_iz[1], orig_i[1] + vel_i[1] ) &&  
                                                                         is_between_f( orig_j[2], orig_i[2] + vel_iz[2], orig_i[2] + vel_i[2] ) )  
1553                                                          {                                                          {
1554                                                                  unsolid( id_i )                                                          set_solid( id_i, 0 );
1555                                                                  unsolid( id_j )                                                          set_solid( id_j, 0 );
1556                                                                  skip[i] = true                                                          j = num;
                                                                 skip[j] = true  
                                                                 //maybe reset j first time i runs this, to unsolid anyone they might be boosting with  
                                                         }  
                                                 }  
                                         }  
1557                                  }                                  }
                                 if( !skip[i] ) solid( id_i )  
1558                          }                          }
1559                  }                  }
1560                                    if( j + 1 == num ) set_solid( id_i );
1561          }          }
         return PLUGIN_CONTINUE  
 }*/  
 public server_frame( )  
 {  
         if( !get_pcvar_num(p_climb) )  
                 return PLUGIN_CONTINUE  
1562    
         sc_fcount++  
         if( sc_fcount > 9 ) sc_fcount = 0  
1563    
1564          //Semi-clip                          //Semiclip touch detection
1565          new players[32],num,i,j,Float:c1[3],Float:c2[3]                          if( pev( id_i, pev_solid ) == SOLID_NOT )
1566          new Float:c1z[3],Float:c2z[3]                          {
1567          new id_i,id_j,cflags_i,cflags_j                                  new class[9], ptr, Float:v_orig[3];
1568          get_players(players,num,"ac")                                  pev( id_i, pev_origin, v_orig );
1569          //new Float:c1d[3],Float:c2d[3],xyadd,zadd                                  //v_orig[2] -= 18;
1570          for(i=0;i<num;i++){                                  v_orig[2] -= 10;
1571                  id_i=players[i]  
1572                  cflags_i=timer[id_i][TMR_CFLAGS]                                  new ent = engfunc( EngFunc_FindEntityInSphere, MAXPLAYERS, v_orig, 16.0 );
1573                  if(!(cflags_i&CF_PAUSE)){                                  while( ent > MAXPLAYERS )
1574                          //solid(players[i])                                  {
1575                          entity_get_vector(id_i,EV_VEC_origin,c1)                                          pev( ent, pev_classname, ptr, class, 8 );
1576                          //entity_get_vector(players[i],EV_VEC_velocity,c1d)                                          //trigger_teleport, trigger_once, trigger_multiple, trigger_gravity, trigger_push, trigger_hurt, func_door
1577                          c1z[2]=c1[2]                                          //if( equal( class, "trigger_", 8 ) || equal( class, "func_", 5 ) && !equal( class, "func_water" ) )
1578                          c1[2]=0.0                                          if( equal( class, "trigger_teleport" ) || equal( class, "trigger_hurt" ) ||
1579                          for(j=0;j<num;j++){                                                          equal( class, "trigger_once" ) || equal( class, "trigger_multiple" ) ||
1580                                  id_j=players[j]                                                          equal( class, "trigger_gravity" ) || equal( class, "trigger_push" ) ||
1581                                  cflags_j=timer[id_j][TMR_CFLAGS]                                                          equal( class, "func_door" ) )
1582                                  if(!(cflags_j&CF_SOLID)&&i!=j){                                                  {
1583                                          entity_get_vector(id_j,EV_VEC_origin,c2)                                                          dllfunc( DLLFunc_Touch, ent, id_i );
1584                                          //entity_get_vector(players[j],EV_VEC_velocity,c2d)                                                          //break;
                                         c2z[2]=c2[2]  
                                         c2[2]=0.0  
                                         if(vector_distance(c1,c2)<90&&vector_distance(c1z,c2z)<110){  
                                                 if(!(cflags_i&CF_SOLID&&cflags_j&CF_SOLID)){//&&vector_distance(c1,c2)>25&&vector_distance(c1z,c2z)>30)){  
                                                         unsolid(id_i)  
                                                         unsolid(id_j)  
                                                         j=num  
                                                 }  
1585                                          }                                          }
1586                                            ent = engfunc( EngFunc_FindEntityInSphere, ent, v_orig, 16.0 );
1587                                  }                                  }
1588                                  if(j+1==num)solid(id_i)  
1589                          }                          }
1590                  }                  }
1591          }          }
1592          return PLUGIN_CONTINUE  
1593            return FMRES_IGNORED
1594  }  }
1595    
1596  stock bool:is_between_f( Float:mid, Float:a, Float:b )  stock bool:is_between_f( Float:mid, Float:a, Float:b )
# Line 1621  Line 1615 
1615          if( !get_pcvar_num( p_climb ) || is_user_bot( id ) || !is_climber_alive( id ) )          if( !get_pcvar_num( p_climb ) || is_user_bot( id ) || !is_climber_alive( id ) )
1616                  return PLUGIN_CONTINUE                  return PLUGIN_CONTINUE
1617    
1618          if( sclip[id] && sc_fcount == 9 ) entity_set_int( id, EV_INT_solid, SOLID_BBOX )          /*
1619            //Auto Semiclip
1620            new Float:vOrig[3], ent, count, Float:range
1621    
1622            range = pev( id, pev_speed ) * 0.5 + 50.0
1623    
1624            pev( id, pev_origin, vOrig )
1625    
1626            //if( !( timer[ id ][ TMR_CFLAGS ] & CF_SOLID ) )
1627            //{
1628            ent = engfunc( EngFunc_FindEntityInSphere, -1, vOrig, range )
1629            while( ent <= MAXPLAYERS )
1630            {
1631                    if( ent != id )
1632                    {
1633                            set_solid( ent, 0 )
1634                            count++
1635                    }
1636                    ent = engfunc( EngFunc_FindEntityInSphere, ent, vOrig, range )
1637            }
1638            //}
1639            if( count ) set_solid( id, 0 )
1640            else set_solid( id )
1641    
1642    
1643            //Semiclip touch detection
1644            if( pev( id, pev_solid ) == SOLID_NOT )
1645            {
1646                    new class[9], ptr
1647                    //pev( id, pev_origin, vOrig )
1648    
1649                    new ent = engfunc( EngFunc_FindEntityInSphere, MAXPLAYERS, vOrig, 17.0 )
1650                    while( ent > 0 )
1651                    {
1652                            pev( ent, pev_classname, ptr, class, 8 )
1653                            if( equal( class, "trigger_", 8 ) || equal( class, "func_", 5 ) )
1654                                    dllfunc( DLLFunc_Touch, ent, id )
1655                            ent = engfunc( EngFunc_FindEntityInSphere, ent, vOrig, 17.0 )
1656                    }
1657    
1658            }
1659            */
1660    
1661          //Detect button use. Replicated from HL SDK          //Detect button use. Replicated from HL SDK
1662          if( get_user_button( id ) & IN_USE && !( get_user_oldbutton( id ) & IN_USE ) )          if( get_user_button( id ) & IN_USE && !( get_user_oldbutton( id ) & IN_USE ) )
# Line 1706  Line 1741 
1741          if( !( get_pcvar_num(p_climb) && get_pcvar_num(p_boost) && is_climber_alive( id ) ) || is_user_bot(id) )          if( !( get_pcvar_num(p_climb) && get_pcvar_num(p_boost) && is_climber_alive( id ) ) || is_user_bot(id) )
1742                  return PLUGIN_CONTINUE                  return PLUGIN_CONTINUE
1743    
         if( sclip[id] ) entity_set_int( id, EV_INT_solid, SOLID_NOT )  
   
1744          if( _:get_distance( _:post_think_vel[id], { 0, 0, 0 } ) )          if( _:get_distance( _:post_think_vel[id], { 0, 0, 0 } ) )
1745          {          {
1746                  entity_set_vector( id, EV_VEC_velocity, post_think_vel[id] )                  entity_set_vector( id, EV_VEC_velocity, post_think_vel[id] )
# Line 1725  Line 1758 
1758          {          {
1759                  new Float:coords[3]                  new Float:coords[3]
1760                  entity_get_vector( id, EV_VEC_origin, coords )                  entity_get_vector( id, EV_VEC_origin, coords )
1761                  for( new i=0; i<3; i++ ) origins[id][ORIG_PAUS+i] = coords[i]  
1762                  origins[id][ORIG_PAUS+3] = entity_get_float( id, EV_FL_gravity )                  origins[id][ORIG_PAUS] = coords[0]
1763                    origins[id][ORIG_PAUS+1] = coords[1]
1764                    origins[id][ORIG_PAUS+2] = coords[2]
1765                    origins[id][ORIG_PAUS+ORIG_GRAV] = entity_get_float( id, EV_FL_gravity )
1766          }          }
1767          return PLUGIN_CONTINUE          return PLUGIN_CONTINUE
1768  }  }
# Line 1882  Line 1918 
1918  }  }
1919    
1920  //Execute commands from start/finish config  //Execute commands from start/finish config
1921  public sfexec(id,clevent){  public sfexec( id, clevent )
1922    {
1923          new clstat[3],cflags=timer[id][TMR_CFLAGS]          new clstat[3],cflags=timer[id][TMR_CFLAGS]
1924          /*switch(timer[id][TMR_CFLAGS]){  
                 case TMR_CFLAGS_STOP: clstat="ns"  
                 case TMR_CFLAGS_STRT: clstat="st"  
                 case TMR_CFLAGS_FNSH: clstat="fn"  
         }*/  
1925          if(is_finished(id))clstat="fn"          if(is_finished(id))clstat="fn"
1926          else if(cflags&CF_STOP)clstat="ns"          else if(cflags&CF_STOP)clstat="ns"
1927          else if(cflags&CF_START)clstat="st"          else if(cflags&CF_START)clstat="st"
         //else if(timer[id][TMR_CFLAGS]&CF_FINISH)clstat="fn"  
         //if(equal(clstat,"ns")&&(get_user_flags(id)&VIP||timer[id][TMR_SESFIN]>0))clstat="fn"  
1928    
1929          for(new i=0;i<sfcount;i++){          new cmdstat[3], cmdevent[2], cmdtype[3], cmd[60], idtype[5], name[24]
1930                  new cmdstat[3],cmdevent[2],cmdtype[3],cmd[60],idtype[5]          for( new i = 0; i < sfcount; i++ )
1931                  parse(sfactions[i],cmdstat,2,cmdevent,1,cmdtype,2,cmd,sizeof(cmd)-1,idtype,4)          {
1932                  if((equali(cmdstat,clstat)||equali(cmdstat,"ay"))&&str_to_num(cmdevent)&clevent){                  parse( sfactions[i], cmdstat, 2, cmdevent, 1, cmdtype, 2, cmd, 59, idtype, 4 )
1933                          if(equali(cmdtype,"sc")){                  if( ( equali( cmdstat, clstat ) || equali( cmdstat, "ay" ) ) && str_to_num( cmdevent ) & clevent )
1934                                  if(equali(idtype,"uid"))format(cmd,sizeof(cmd)-1,cmd,get_user_userid(id))                  {
1935                                  else{                          if( equali( cmdtype, "sc" ) )
1936                                          new name[24]                          {
1937                                          get_user_name(id,name,sizeof(name)-1)                                  if( equali( idtype, "uid" ) )
1938                                          format(name,sizeof(name),"^"%s^"",name)                                          format( cmd, 59, cmd, get_user_userid( id ) )
1939                                          format(cmd,sizeof(cmd)-1,cmd,name)                                  else
1940                                    {
1941                                            get_user_name( id, name, 23 )
1942                                            format( name, 23, "^"%s^"", name )
1943                                            format( cmd, 59, cmd, name )
1944                                          client_print(id,print_chat,cmd)                                          client_print(id,print_chat,cmd)
1945                                  }                                  }
1946                                  server_cmd(cmd)                                  server_cmd(cmd)
1947                          }                          }
1948                          else{                          else
1949                            {
1950                                  client_cmd(id,cmd)                                  client_cmd(id,cmd)
1951                          }                          }
1952                  }                  }
1953          }          }
         return PLUGIN_HANDLED  
1954  }  }
1955    
1956  //Update frags to reorder scoreboard  //Update frags to reorder scoreboard
# Line 1977  Line 2012 
2012                  players[i] = pdata[i][2]                  players[i] = pdata[i][2]
2013  }  }
2014    
 /*public get_limit(){  
         //if(get_pcvar_num(p_webmod))  
                 //return 0  
         new url[100]  
         get_pcvar_string(p_stats_url,url,99)  
         if(strlen(url))  
                 return false  
         return true  
 }*/  
   
 /*public get_url( id, file[] )  
 {  
         new url[100]  
         get_pcvar_string( p_stats_url, url, 99 )  
         //if(get_pcvar_num(p_webmod)){  
         //      new ip[10],iip[33],eip[33],port[10]  
         //      get_user_ip(id,ip,9)  
         //      get_pcvar_string(p_ip_internal,iip,32)  
         //      get_pcvar_string(p_ip_external,eip,32)  
         //      get_pcvar_string(p_port,port,9)  
         //      if(equal(ip,"192.168.",8))format(url,99,"http://%s:%s/%s",iip,port,file)  
         //      else format(url,99,"http://%s:%s/%s",eip,port,file)  
         //}  
         if( strlen( url ) ) format( url, 99, "%sclimb_scores.html", url )  
         return url  
 }*/  
   
2015  stock sb_add_tabs( str[], size)  stock sb_add_tabs( str[], size)
2016  {  {
2017          new len = strlen( str )// > 7 ? 1 : 2          new len = strlen( str )// > 7 ? 1 : 2
# Line 2186  Line 2194 
2194    
2195          return PLUGIN_HANDLED          return PLUGIN_HANDLED
2196  }  }
2197    
2198  //Fill spectator data array used for msg replication  //Fill spectator data array used for msg replication
2199  public spec_update(){  public spec_update()
2200          if(get_pcvar_num(p_climb)){  {
2201                  new players[32],num,id,id2,i          if( !get_pcvar_num( p_climb ) ) return;
2202                  for(i=1;i<33;i++)spec_ids[i][0]=0  
2203                  get_players(players,num,"bch")          new players[32], num, id, id2, i;
2204                  for(i=0;i<num;i++){          for( i = 1; i < 33; i++ ) spec_ids[i][0] = 0;
2205                          id=players[i]          get_players( players, num, "bch" );
2206                          id2=pev(id,pev_iuser2)          for( i = 0; i < num; i++ )
2207                          if(id2){          {
2208                                  spec_ids[id2][0]++                  id = players[i];
2209                                  spec_ids[id2][spec_ids[id2][0]]=id                  id2 = pev( id, pev_iuser2 );
2210                    if( id2 )
2211                    {
2212                            spec_ids[id2][0]++;
2213                            spec_ids[id2][ spec_ids[id2][0] ] = id;
2214                          }                          }
2215                  }                  }
2216          }          }
2217          return PLUGIN_HANDLED  
2218    //Make client solid or unsolid
2219    stock set_solid( id, solid = 1 )
2220    {
2221            static old_fx[33], Float:old_col[33][3], old_render[33], old_amt[33];
2222            if( solid && pev( id, pev_solid ) == SOLID_NOT )
2223            {
2224                    set_pev( id, pev_renderfx, old_fx[id] );
2225                    set_pev( id, pev_rendermode, old_render[id] );
2226                    set_pev( id, pev_rendercolor, old_col[id] );
2227                    set_pev( id, pev_renderamt, old_amt[id] );
2228    
2229                    set_pev( id, pev_solid, SOLID_SLIDEBOX );
2230  }  }
2231  //Make client solid          else if( !solid && pev( id, pev_solid ) == SOLID_SLIDEBOX )
 public solid(id)  
2232  {  {
2233          set_user_rendering(id,kRenderFxNone,0,0,0,kRenderNormal,255)                  old_fx[id] = pev( id, pev_renderfx );
2234          entity_set_int(id,EV_INT_solid,SOLID_BBOX)                  old_render[id] = pev( id, pev_rendermode );
2235          sclip[id]=false                  pev( id, pev_rendercolor, old_col[id] );
2236          return PLUGIN_CONTINUE                  old_amt[id] = pev( id, pev_renderamt );
2237    
2238                    set_pev( id, pev_rendercolor, Float:{ 0.0, 0.0, 0.0 } );
2239                    if( get_pcvar_num(p_render) )
2240                    {
2241                            set_pev( id, pev_renderfx, kRenderFxHologram );
2242                            set_pev( id, pev_rendermode, kRenderTransAdd );
2243                            set_pev( id, pev_renderamt, float( 0 ) );
2244  }  }
2245  //Make client unsolid                  else
 public unsolid(id)  
2246  {  {
2247          if(get_pcvar_num(p_render))set_user_rendering(id,kRenderFxHologram,0,0,0,kRenderTransAdd,0)                          set_pev( id, pev_renderfx, kRenderFxPulseSlow );
2248          else set_user_rendering(id,kRenderFxPulseSlow,0,0,0,kRenderTransTexture,50)                          set_pev( id, pev_rendermode, kRenderTransTexture );
2249          entity_set_int(id,EV_INT_solid,SOLID_NOT)                          set_pev( id, pev_renderamt, float( 50 ) );
         sclip[id]=true  
         return PLUGIN_CONTINUE  
2250  }  }
2251    
2252                    set_pev( id, pev_solid, SOLID_NOT );
2253            }
2254    }
2255    
2256  ////////////////////////////////////////////////////////////////////////////////  ////////////////////////////////////////////////////////////////////////////////
2257  //      Start: Functions for use in if statements  //      Start: Functions for use in if statements
2258  ////////////////////////////////////////////////////////////////////////////////  ////////////////////////////////////////////////////////////////////////////////
# Line 2233  Line 2266 
2266    
2267  public playersolid( id )  public playersolid( id )
2268  {  {
2269          if(entity_get_int(id,EV_INT_solid)==SOLID_BBOX)return 1          if( pev( id, pev_solid ) == SOLID_SLIDEBOX ) return 1
2270          return 0          return 0
2271  }  }
2272    
# Line 2355  Line 2388 
2388          return PLUGIN_CONTINUE          return PLUGIN_CONTINUE
2389  }  }
2390    
 /*public spawn_distance_sort(elem1[],elem2[]){  
         if(elem1[1]<elem2[1])return -1  
         if(elem1[1]>elem2[1])return 1  
         return 0  
 }*/  
   
2391  //Future use, to block hook, or detect hook cheaters a.k.a. hookers  //Future use, to block hook, or detect hook cheaters a.k.a. hookers
2392  public phook( id )  public phook( id )
2393  {  {
# Line 2451  Line 2478 
2478    
2479          new Float:c2[3], player, players[32], num          new Float:c2[3], player, players[32], num
2480          get_players( players, num, "ac" )          get_players( players, num, "ac" )
2481          unsolid( id )          set_solid( id, 0 );
2482          for( new i = 0; i < num; i++ )          for( new i = 0; i < num; i++ )
2483          {          {
2484                  player = players[i]                  player = players[i]
2485                  if( id != player )                  if( id != player )
2486                  {                  {
2487                          entity_get_vector( player, EV_VEC_origin, c2 )                          entity_get_vector( player, EV_VEC_origin, c2 )
2488                          if( vector_distance( orig, c2 ) < 90 ) unsolid( player )                          if( vector_distance( orig, c2 ) < 90 ) set_solid( player, 0 );
2489                  }                  }
2490          }          }
2491          entity_set_vector( id, EV_VEC_velocity, Float:{0.0, 0.0, 0.0} )          entity_set_vector( id, EV_VEC_velocity, Float:{0.0, 0.0, 0.0} )
# Line 2562  Line 2589 
2589          if( get_pcvar_num( p_climb ) )          if( get_pcvar_num( p_climb ) )
2590                  show_motd( id, "http://ian.cammarata.us/projects/climb/help/2a3/en/boosts?agent=hl", "Climb Plugin Help" )                  show_motd( id, "http://ian.cammarata.us/projects/climb/help/2a3/en/boosts?agent=hl", "Climb Plugin Help" )
2591    
2592    //Admin command, teleport to client
2593  public goto_player( id )  public goto_player( id )
 {//Admin command, teleport to client  
         if( is_finished( id ) && get_pcvar_num( p_climb ) )  
2594          {          {
2595            if( !is_finished( id ) || !get_pcvar_num( p_climb ) )
2596                    return
2597    
2598                  new tid, arg[24]                  new tid, arg[24]
2599                  read_argv( 1, arg, sizeof( arg ) - 1 )          read_argv( 1, arg, 23 )
2600                  tid = cmd_target( tid, arg, 4 )                  tid = cmd_target( tid, arg, 4 )
2601                  if( tid )                  if( tid )
2602                  {                  {
# Line 2576  Line 2605 
2605                          teleport( id, orig )                          teleport( id, orig )
2606                  }                  }
2607          }          }
         return PLUGIN_HANDLED  
 }  
2608    
2609  public spectate( id )  public spectate( id )
2610  {//Client switch to spectator  {//Client switch to spectator
# Line 2585  Line 2612 
2612          {          {
2613                  if( !is_climber_alive( id ) )                  if( !is_climber_alive( id ) )
2614                  {                  {
                         /*  
                         cs_set_user_team(id,3)//fixes respawn bug?  
                         frespawn( id )  
                         */  
   
2615                          climb_user_spawn( id )                          climb_user_spawn( id )
2616    
2617                          if( timer[id][TMR_CFLAGS] & CF_PAUSE )                          //already does this in the resethud function
2618                            /*if( timer[id][TMR_CFLAGS] & CF_PAUSE )
2619                          {//If they are paused tp to pause spot and freeze them again.                          {//If they are paused tp to pause spot and freeze them again.
2620                                  new Float:coords[3]                                  new Float:coords[3]
2621                                  for( new i=0; i<3; i++ ) coords[i] = origins[ id - 1 ][ ORIG_PAUS + i ]  
2622                                    coords[0] = origins[ id ][ ORIG_PAUS + 0 ]
2623                                    coords[1] = origins[ id ][ ORIG_PAUS + 1 ]
2624                                    coords[2] = origins[ id ][ ORIG_PAUS + 2 ]
2625    
2626                                  teleport( id, coords )                                  teleport( id, coords )
2627                                  cl_pause( id )                                  cl_pause( id )
2628                          }                          }*/
2629    
2630                  }                  }
2631                  else if( get_user_flags( id ) & VIP ? 1 : ( cvar_enabled( id, p_allow_spectators ) ) )                  else if( get_user_flags( id ) & VIP ? 1 : ( cvar_enabled( id, p_allow_spectators ) ) )
# Line 3795  Line 3822 
3822  ////////////////////////////////////////////////////////////////////////////////  ////////////////////////////////////////////////////////////////////////////////
3823  //      End: Database functions  //      End: Database functions
3824  ////////////////////////////////////////////////////////////////////////////////  ////////////////////////////////////////////////////////////////////////////////
3825  public rotwtf( string[], out_len )  //Simple Password Encryption
3826  {//Simple Password Encryption  public rotwtf( string[], out_len )//I should replace this with md5 since it's available now
3827    {
3828          new len=strlen( string ),str[99],cnt=0,tok=len-1          new len=strlen( string ),str[99],cnt=0,tok=len-1
3829          copy( str, out_len, string )          copy( str, out_len, string )
3830          for( new index=0; index<11; index++ )          for( new index=0; index<11; index++ )

Legend:
Removed from v.36  
changed lines
  Added in v.37

Contact
ViewVC Help
Powered by ViewVC 1.0.4