hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2025.08.10. 23:08



Jelenlévő felhasználók

Jelenleg 314 felhasználó van jelen :: 2 regisztrált, 0 rejtett és 312 vendég

A legtöbb felhasználó (2883 fő) 2025.07.30. 16:00-kor tartózkodott itt.

Regisztrált felhasználók: Google [Bot], Majestic-12 [Bot]az elmúlt 5 percben aktív felhasználók alapján

Utoljára aktív
Ahhoz hogy lásd ki volt utoljára aktív, be kell jelentkezned.



Az oldal teljeskörű
használatához regisztrálj.

Regisztráció

Kereső


Új téma nyitása Hozzászólás a témához  [3 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: surf_ski_2_ruleswatcher
HozzászólásElküldve:2012.02.28. 22:23 
Offline
Őskövület
Avatar

Csatlakozott:2011.12.28. 00:35
Hozzászólások:2736
Megköszönt másnak: 56 alkalommal
Megköszönték neki: 275 alkalommal
Kód:
#include < amxmodx >
#include < engine >
#include < hamsandwich >

#define IsPlayer(%1) ( 1 <= %1 <= g_iMaxPlayers )

new const g_szClassname[ ] = "trigger_rules_watch";

enum _:RoomTypes {
   JAIL,
   GUNROOM,
   MARIOROOM
};

enum _:CVARS {
   CV_JAIL_NOKILL,
   CV_JAIL_TIME,
   
   CV_GUNROOM_NOKILL,
   CV_GUNROOM_TIME,
   
   CV_MARIOROOM_NOKILL,
   CV_MARIOROOM_TIME
};

new const g_szZones[ RoomTypes ][ ] = {
   "Jail",
   "Gun room",
   "Mario room"
};

new const Float:g_flOrigins[ ][ 3 ] = {
   { -405.0, 2900.0, 720.0 },
   { -486.0, -1000.0, -275.0 },
   { -405.0, 2949.0, 2422.0 }
};

new const Float:g_flAngles[ ][ 3 ] = {
   { 0.0, 270.0, 0.0 },
   { 0.0, 270.0, 0.0 },
   { 0.0, 270.0, 0.0 }
};

new g_iMaxPlayers;
new g_iCounter[ 33 ];
new bool:g_bNoKill[ 33 ];
new Float:g_flLastTouch[ 33 ];
new g_pCvars[ CVARS ], g_iCvars[ CVARS ];

public plugin_init( ) {
   register_plugin( "surf_ski_2: Rules Watcher", "1.1", "xPaw" );
   
   register_cvar( "ss2_rules_watcher", "1.1", FCVAR_SERVER | FCVAR_SPONLY );
   
   g_iMaxPlayers = get_maxplayers( );
   
   g_pCvars[ CV_JAIL_NOKILL ]      = register_cvar( "rw_ss2_jail_nokill",      "0" );
   g_pCvars[ CV_JAIL_TIME ]        = register_cvar( "rw_ss2_jail_time",        "1" );
   
   g_pCvars[ CV_GUNROOM_NOKILL ]   = register_cvar( "rw_ss2_gunroom_nokill",   "1" );
   g_pCvars[ CV_GUNROOM_TIME ]     = register_cvar( "rw_ss2_gunroom_time",     "15" );
   
   g_pCvars[ CV_MARIOROOM_NOKILL ] = register_cvar( "rw_ss2_marioroom_nokill", "1" );
   g_pCvars[ CV_MARIOROOM_TIME ]   = register_cvar( "rw_ss2_marioroom_time",   "30" );
   
   new szMap[ 12 ];
   get_mapname( szMap, 11 );
   
   if( equali( szMap, "surf_ski_2" ) ) {
      CreateTrigger( JAIL, Float:{ -579.0, 2983.0, 586.0 }, Float:{ -309.0, 3288.0, 796.0 } );
      CreateTrigger( GUNROOM, Float:{ -713.0, -990.0, -157.0 }, Float:{ -295.0, -651.0, 26.0 } );
      CreateTrigger( MARIOROOM, Float:{ 2735.0, 193.0, -2361.0 }, Float:{ 3654.0, 1118.0, -2083.0 } );
      
      register_touch( g_szClassname, "player", "FwdTriggerTouch" );
      RegisterHam( Ham_Spawn,        "player", "FwdHamPlayerSpawn", 1 );
      RegisterHam( Ham_TakeDamage,   "player", "FwdHamTakeDamage" );
      RegisterHam( Ham_TraceAttack,  "player", "FwdHamTraceAttack" );
      
      register_event( "HLTV", "EventNewRound", "a", "1=0", "2=0" );
      
      CacheCvars( );
   }
}

public EventNewRound( )
   CacheCvars( );

public FwdHamPlayerSpawn( const id ) {
   if( is_user_alive( id ) ) {
      g_bNoKill[ id ]     = false;
      g_flLastTouch[ id ] = 0.0;
      g_iCounter[ id ]    = 0;
   }
}

public FwdHamTraceAttack( const id, const iAttacker ) {
   if( IsPlayer( iAttacker ) && g_bNoKill[ id ] && id != iAttacker ) {
      if( ( g_flLastTouch[ id ] + 0.1 ) >= get_gametime( ) )
         return HAM_SUPERCEDE;
      else
         g_bNoKill[ id ] = false;
   }
   
   return HAM_IGNORED;
}

public FwdHamTakeDamage( const id, const iInflictor, const iAttacker ) {
   if( IsPlayer( iAttacker ) && g_bNoKill[ id ] && id != iAttacker ) {
      if( ( g_flLastTouch[ id ] + 0.1 ) >= get_gametime( ) )
         return HAM_SUPERCEDE;
      else
         g_bNoKill[ id ] = false;
   }
   
   return HAM_IGNORED;
}

public FwdTriggerTouch( const iEntity, const id ) {
   static Float:flGametime;
   flGametime = get_gametime( );
   
   if( flGametime > ( g_flLastTouch[ id ] + 1.2 ) ) {
      g_iCounter[ id ] = 0;
      g_flLastTouch[ id ] = flGametime;
   }
   else if( g_flLastTouch[ id ] < flGametime ) {
      g_iCounter[ id ]++;
      
      static iType, bool:bNoKill, iTime;
      iType = entity_get_int( iEntity, EV_INT_iuser1 );
      
      GetCvars( iType, bNoKill, iTime );
      
      g_bNoKill[ id ] = bNoKill;
      
      if( iTime > 0 ) {
         if( g_iCounter[ id ] >= iTime ) {
            if( iTime >= 5 ) {
               engclient_print( id, engprint_center, "^nYou stood more than %i seconds in%s%s.^nYou have been thrown out.", iTime, iType == MARIOROOM ? "^n" : " ", g_szZones[ iType ] );
               
               client_cmd( id, "spk buttons/blip1" );
            }
            
            entity_set_vector( id, EV_VEC_angles, g_flAngles[ iType ] );
            entity_set_int( id, EV_INT_fixangle, 1 );
            entity_set_origin( id, g_flOrigins[ iType ] );
         }
         
         if( g_iCounter[ id ] < 5 ) {
            if( iTime >= 5 )
               engclient_print( id, engprint_center, "%sYou are in %s.%s^n^nYou have %i seconds to leave it!", bNoKill ? "" : "^n", g_szZones[ iType ], bNoKill ? "^nYou can't kill anyone here." : "", iTime );
            else
               engclient_print( id, engprint_center, "%sYou are in %s.%s", bNoKill ? "" : "^n", g_szZones[ iType ], bNoKill ? "^nYou can't kill anyone here." : "" );
         }
      }
      
      g_flLastTouch[ id ] = flGametime + 1.0;
   }
}

GetCvars( const iType, &bool:bNoKill, &iTime ) {
   static CvarNoKill, CvarTime;
   
   switch( iType ) {
      case JAIL: {
         CvarNoKill = CV_JAIL_NOKILL;
         CvarTime = CV_JAIL_TIME;
      }
      case GUNROOM: {
         CvarNoKill = CV_GUNROOM_NOKILL;
         CvarTime = CV_GUNROOM_TIME;
      }
      case MARIOROOM: {
         CvarNoKill = CV_MARIOROOM_NOKILL;
         CvarTime = CV_MARIOROOM_TIME;
      }
   }
   
   bNoKill = bool:( g_iCvars[ CvarNoKill ] );
   iTime = g_iCvars[ CvarTime ];
}

CacheCvars( ) {
   g_iCvars[ CV_JAIL_NOKILL ]      = get_pcvar_num( g_pCvars[ CV_JAIL_NOKILL ] );
   g_iCvars[ CV_JAIL_TIME ]        = get_pcvar_num( g_pCvars[ CV_JAIL_TIME ] );
   
   g_iCvars[ CV_GUNROOM_NOKILL ]   = get_pcvar_num( g_pCvars[ CV_GUNROOM_NOKILL ] );
   g_iCvars[ CV_GUNROOM_TIME ]     = get_pcvar_num( g_pCvars[ CV_GUNROOM_TIME ] );
   
   g_iCvars[ CV_MARIOROOM_NOKILL ] = get_pcvar_num( g_pCvars[ CV_MARIOROOM_NOKILL ] );
   g_iCvars[ CV_MARIOROOM_TIME ]   = get_pcvar_num( g_pCvars[ CV_MARIOROOM_TIME ] );
}

CreateTrigger( const iType, const Float:flMins[ 3 ], const Float:flMaxs[ 3 ] ) {
   new iEntity = create_entity( "info_target" );
   
   if( !is_valid_ent( iEntity ) ) {
      log_amx( "There was an error with creating ^"%s^"", g_szZones[ iType ] );
      
      return 0;
   }
   
   entity_set_string( iEntity, EV_SZ_classname, g_szClassname );
   entity_set_int( iEntity, EV_INT_iuser1, iType );
   entity_set_int( iEntity, EV_INT_movetype, MOVETYPE_NONE );
   entity_set_int( iEntity, EV_INT_solid, SOLID_TRIGGER );
   entity_set_size( iEntity, flMins, flMaxs );
   
   return iEntity;
}


ezt valaki meg tudná úgy csinálni h a surf ketrecbe belehesen esni??
Mert amikor leesek a surf pályáról kidobb a ketrceböl.
Kérlek segitsegetel *.*

_________________
****


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: surf_ski_2_ruleswatcher
HozzászólásElküldve:2012.02.29. 14:23 
Offline
Őskövület
Avatar

Csatlakozott:2011.09.17. 17:54
Hozzászólások:2350
Megköszönt másnak: 40 alkalommal
Megköszönték neki: 57 alkalommal
Csak jailból ne vagy Márió/Gunroom-ból se?
Ittvan,átírtam a cvarokat,mostmár nem dob ki sehonnan,csak nagyon hosszú idő elteltével + lemagyarosítottam.

Kód:
#include < amxmodx >
#include < engine >
#include < hamsandwich >

#define IsPlayer(%1) ( 1 <= %1 <= g_iMaxPlayers )

new const g_szClassname[ ] = "trigger_rules_watch";

enum _:RoomTypes {
   JAIL,
   GUNROOM,
   MARIOROOM
};

enum _:CVARS {
   CV_JAIL_NOKILL,
   CV_JAIL_TIME,
   
   CV_GUNROOM_NOKILL,
   CV_GUNROOM_TIME,
   
   CV_MARIOROOM_NOKILL,
   CV_MARIOROOM_TIME
};

new const g_szZones[ RoomTypes ][ ] = {
   "Jail",
   "Gun room",
   "Mario room"
};

new const Float:g_flOrigins[ ][ 3 ] = {
   { -405.0, 2900.0, 720.0 },
   { -486.0, -1000.0, -275.0 },
   { -405.0, 2949.0, 2422.0 }
};

new const Float:g_flAngles[ ][ 3 ] = {
   { 0.0, 270.0, 0.0 },
   { 0.0, 270.0, 0.0 },
   { 0.0, 270.0, 0.0 }
};

new g_iMaxPlayers;
new g_iCounter[ 33 ];
new bool:g_bNoKill[ 33 ];
new Float:g_flLastTouch[ 33 ];
new g_pCvars[ CVARS ], g_iCvars[ CVARS ];

public plugin_init( ) {
   register_plugin( "surf_ski_2: Rules Watcher", "1.1", "xPaw" );
   
   register_cvar( "ss2_rules_watcher", "1.1", FCVAR_SERVER | FCVAR_SPONLY );
   
   g_iMaxPlayers = get_maxplayers( );
   
   g_pCvars[ CV_JAIL_NOKILL ]      = register_cvar( "rw_ss2_jail_nokill",      "0" );
   g_pCvars[ CV_JAIL_TIME ]        = register_cvar( "rw_ss2_jail_time",        "999999" );
   
   g_pCvars[ CV_GUNROOM_NOKILL ]   = register_cvar( "rw_ss2_gunroom_nokill",   "1" );
   g_pCvars[ CV_GUNROOM_TIME ]     = register_cvar( "rw_ss2_gunroom_time",     "999999" );
   
   g_pCvars[ CV_MARIOROOM_NOKILL ] = register_cvar( "rw_ss2_marioroom_nokill", "1" );
   g_pCvars[ CV_MARIOROOM_TIME ]   = register_cvar( "rw_ss2_marioroom_time",   "999999" );
   
   new szMap[ 12 ];
   get_mapname( szMap, 11 );
   
   if( equali( szMap, "surf_ski_2" ) ) {
      CreateTrigger( JAIL, Float:{ -579.0, 2983.0, 586.0 }, Float:{ -309.0, 3288.0, 796.0 } );
      CreateTrigger( GUNROOM, Float:{ -713.0, -990.0, -157.0 }, Float:{ -295.0, -651.0, 26.0 } );
      CreateTrigger( MARIOROOM, Float:{ 2735.0, 193.0, -2361.0 }, Float:{ 3654.0, 1118.0, -2083.0 } );
     
      register_touch( g_szClassname, "player", "FwdTriggerTouch" );
      RegisterHam( Ham_Spawn,        "player", "FwdHamPlayerSpawn", 1 );
      RegisterHam( Ham_TakeDamage,   "player", "FwdHamTakeDamage" );
      RegisterHam( Ham_TraceAttack,  "player", "FwdHamTraceAttack" );
     
      register_event( "HLTV", "EventNewRound", "a", "1=0", "2=0" );
     
      CacheCvars( );
   }
}

public EventNewRound( )
   CacheCvars( );

public FwdHamPlayerSpawn( const id ) {
   if( is_user_alive( id ) ) {
      g_bNoKill[ id ]     = false;
      g_flLastTouch[ id ] = 0.0;
      g_iCounter[ id ]    = 0;
   }
}

public FwdHamTraceAttack( const id, const iAttacker ) {
   if( IsPlayer( iAttacker ) && g_bNoKill[ id ] && id != iAttacker ) {
      if( ( g_flLastTouch[ id ] + 0.1 ) >= get_gametime( ) )
         return HAM_SUPERCEDE;
      else
         g_bNoKill[ id ] = false;
   }
   
   return HAM_IGNORED;
}

public FwdHamTakeDamage( const id, const iInflictor, const iAttacker ) {
   if( IsPlayer( iAttacker ) && g_bNoKill[ id ] && id != iAttacker ) {
      if( ( g_flLastTouch[ id ] + 0.1 ) >= get_gametime( ) )
         return HAM_SUPERCEDE;
      else
         g_bNoKill[ id ] = false;
   }
   
   return HAM_IGNORED;
}

public FwdTriggerTouch( const iEntity, const id ) {
   static Float:flGametime;
   flGametime = get_gametime( );
   
   if( flGametime > ( g_flLastTouch[ id ] + 1.2 ) ) {
      g_iCounter[ id ] = 0;
      g_flLastTouch[ id ] = flGametime;
   }
   else if( g_flLastTouch[ id ] < flGametime ) {
      g_iCounter[ id ]++;
     
      static iType, bool:bNoKill, iTime;
      iType = entity_get_int( iEntity, EV_INT_iuser1 );
     
      GetCvars( iType, bNoKill, iTime );
     
      g_bNoKill[ id ] = bNoKill;
     
      if( iTime > 0 ) {
         if( g_iCounter[ id ] >= iTime ) {
            if( iTime >= 5 ) {
               engclient_print( id, engprint_center, "^nTobb idot toltottel el mint %i masodperc %s%s-ban.^nKi lettel dobva.", iTime, iType == MARIOROOM ? "^n" : " ", g_szZones[ iType ] );
               
               client_cmd( id, "spk buttons/blip1" );
            }
           
            entity_set_vector( id, EV_VEC_angles, g_flAngles[ iType ] );
            entity_set_int( id, EV_INT_fixangle, 1 );
            entity_set_origin( id, g_flOrigins[ iType ] );
         }
         
         if( g_iCounter[ id ] < 5 ) {
            if( iTime >= 5 )
               engclient_print( id, engprint_center, "%sTe %s-ban vagy.%s^n^nEnnyi idod van hogy kimenj: %i!", bNoKill ? "" : "^n", g_szZones[ iType ], bNoKill ? "^nYou can't kill anyone here." : "", iTime );
            else
               engclient_print( id, engprint_center, "%sTe %s.%s-ban vagy", bNoKill ? "" : "^n", g_szZones[ iType ], bNoKill ? "^nItt nem tudsz megolni senkit." : "" );
         }
      }
     
      g_flLastTouch[ id ] = flGametime + 1.0;
   }
}

GetCvars( const iType, &bool:bNoKill, &iTime ) {
   static CvarNoKill, CvarTime;
   
   switch( iType ) {
      case JAIL: {
         CvarNoKill = CV_JAIL_NOKILL;
         CvarTime = CV_JAIL_TIME;
      }
      case GUNROOM: {
         CvarNoKill = CV_GUNROOM_NOKILL;
         CvarTime = CV_GUNROOM_TIME;
      }
      case MARIOROOM: {
         CvarNoKill = CV_MARIOROOM_NOKILL;
         CvarTime = CV_MARIOROOM_TIME;
      }
   }
   
   bNoKill = bool:( g_iCvars[ CvarNoKill ] );
   iTime = g_iCvars[ CvarTime ];
}

CacheCvars( ) {
   g_iCvars[ CV_JAIL_NOKILL ]      = get_pcvar_num( g_pCvars[ CV_JAIL_NOKILL ] );
   g_iCvars[ CV_JAIL_TIME ]        = get_pcvar_num( g_pCvars[ CV_JAIL_TIME ] );
   
   g_iCvars[ CV_GUNROOM_NOKILL ]   = get_pcvar_num( g_pCvars[ CV_GUNROOM_NOKILL ] );
   g_iCvars[ CV_GUNROOM_TIME ]     = get_pcvar_num( g_pCvars[ CV_GUNROOM_TIME ] );
   
   g_iCvars[ CV_MARIOROOM_NOKILL ] = get_pcvar_num( g_pCvars[ CV_MARIOROOM_NOKILL ] );
   g_iCvars[ CV_MARIOROOM_TIME ]   = get_pcvar_num( g_pCvars[ CV_MARIOROOM_TIME ] );
}

CreateTrigger( const iType, const Float:flMins[ 3 ], const Float:flMaxs[ 3 ] ) {
   new iEntity = create_entity( "info_target" );
   
   if( !is_valid_ent( iEntity ) ) {
      log_amx( "Nem sikerult letrehozni ezt: ^"%s^"", g_szZones[ iType ] );
     
      return 0;
   }
   
   entity_set_string( iEntity, EV_SZ_classname, g_szClassname );
   entity_set_int( iEntity, EV_INT_iuser1, iType );
   entity_set_int( iEntity, EV_INT_movetype, MOVETYPE_NONE );
   entity_set_int( iEntity, EV_INT_solid, SOLID_TRIGGER );
   entity_set_size( iEntity, flMins, flMaxs );
   
   return iEntity;
}


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: surf_ski_2_ruleswatcher
HozzászólásElküldve:2012.02.29. 19:06 
Offline
Őskövület
Avatar

Csatlakozott:2011.12.28. 00:35
Hozzászólások:2736
Megköszönt másnak: 56 alkalommal
Megköszönték neki: 275 alkalommal
Köszönöm :D *.*

_________________
****


Hozzászólás jelentése
Vissza a tetejére
   
Hozzászólások megjelenítése: Rendezés 
Új téma nyitása Hozzászólás a témához  [3 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 4 vendég


Nyithatsz új témákat ebben a fórumban.
Válaszolhatsz egy témára ebben a fórumban.
Nem szerkesztheted a hozzászólásaidat ebben a fórumban.
Nem törölheted a hozzászólásaidat ebben a fórumban.
Nem küldhetsz csatolmányokat ebben a fórumban.

Keresés:
Ugrás:  
Powered by phpBB® Forum Software © phpBB Limited
Magyar fordítás © Magyar phpBB Közösség
Portal: Kiss Portal Extension © Michael O'Toole