hlmod.hu
https://hlmod.hu/

Sapka plugin
https://hlmod.hu/viewtopic.php?f=29&t=6376
Oldal: 1 / 1

Szerző:  paintballer [ 2012.10.21. 12:41 ]
Hozzászólás témája:  Sapka plugin

Hello! :D
Valaki át tudja nekem ezt a plugint írni, hogy CSAK A CT k fejére tegyen sapit? :D
Kód:
X.TRY.HU Forrás Megtekintés - www.amxx.try.hu - Plugin Megtekintése
#include < amxmodx >
#include < engine >
#include < cstrike >
#include < hamsandwich >
 
new const g_szHatModel[ CsTeams ][ ] = {
    "",
    "models/santahat.mdl",
    "models/santahat_blue.mdl",
    ""
};
 
new g_iHats[ 33 ];
 
public plugin_init( ) {
    register_plugin( "Team Santa Hat", "1.3", "xPaw" );
 
    register_cvar( "santa_hat", "1.3", FCVAR_SERVER );
 
    register_event( "TeamInfo", "EventTeamInfo", "a" );
 
    RegisterHam( Ham_Spawn, "player", "FwdHamPlayerSpawn", 1 );
}
 
public plugin_precache( ) {
 
    precache_model( g_szHatModel[ CS_TEAM_T ] );
    precache_model( g_szHatModel[ CS_TEAM_CT ] );
}
 
public client_disconnect( id )
    if( is_valid_ent( g_iHats[ id ] ) )
        remove_entity( g_iHats[ id ] );
 
public FwdHamPlayerSpawn( const id ) {
    if( is_user_alive( id ) ) {
        new iEntity = g_iHats[ id ];
 
        if( !is_valid_ent( iEntity ) ) {
            if( !( iEntity = g_iHats[ id ] = create_entity( "info_target" ) ) )
                return;
 
            new CsTeams:iTeam = cs_get_user_team( id );
 
            if( iTeam != CS_TEAM_T && iTeam != CS_TEAM_CT )
                iTeam = CS_TEAM_T;
 
            entity_set_model( iEntity, g_szHatModel[ iTeam ] );
            entity_set_int( iEntity, EV_INT_movetype, MOVETYPE_FOLLOW );
            entity_set_edict( iEntity, EV_ENT_aiment, id );
        }
    }
}
 
public EventTeamInfo( ) {
    new id = read_data( 1 ), iEntity = g_iHats[ id ];
 
    if( !is_valid_ent( iEntity ) ) {
        if( iEntity > 0 )
            g_iHats[ id ] = 0;
 
        return;
    }
 
    new szTeam[ 2 ];
    read_data( 2, szTeam, 1 );
 
    if( szTeam[ 0 ] == 'C' )
        entity_set_model( iEntity, g_szHatModel[ CS_TEAM_CT ] );
    else
        entity_set_model( iEntity, g_szHatModel[ CS_TEAM_T ] );
}

Szerző:  Maxi [ 2012.10.29. 10:53 ]
Hozzászólás témája:  Re: Sapka plugin

SMA Forráskód: [ Mindet kijelol ]
  1. #include < amxmodx >
  2. #include < engine >
  3. #include < cstrike >
  4. #include < hamsandwich >
  5.  
  6. new const g_szHatModel[ CsTeams ][ ] = {
  7. "",
  8. "models/santahat.mdl",
  9. "models/santahat_blue.mdl",
  10. ""
  11. };
  12.  
  13. new g_iHats[ 33 ];
  14.  
  15. public plugin_init( ) {
  16. register_plugin( "Team Santa Hat", "1.3", "xPaw" );
  17.  
  18. register_cvar( "santa_hat", "1.3", FCVAR_SERVER );
  19.  
  20. register_event( "TeamInfo", "EventTeamInfo", "a" );
  21.  
  22. RegisterHam( Ham_Spawn, "player", "FwdHamPlayerSpawn", 1 );
  23. }
  24.  
  25. public plugin_precache( ) {
  26.  
  27. precache_model( g_szHatModel[ CS_TEAM_T ] );
  28. precache_model( g_szHatModel[ CS_TEAM_CT ] );
  29. }
  30.  
  31. public client_disconnect( id )
  32. if( is_valid_ent( g_iHats[ id ] ) )
  33. remove_entity( g_iHats[ id ] );
  34.  
  35. public FwdHamPlayerSpawn( const id ) {
  36. if( is_user_alive( id ) && cs_get_user_team( id ) == CS_TEAM_CT) {
  37. new iEntity = g_iHats[ id ];
  38.  
  39. if( !is_valid_ent( iEntity ) ) {
  40. if( !( iEntity = g_iHats[ id ] = create_entity( "info_target" ) ) )
  41. return;
  42.  
  43. new CsTeams:iTeam = cs_get_user_team( id );
  44.  
  45. entity_set_model( iEntity, g_szHatModel[ iTeam ] );
  46. entity_set_int( iEntity, EV_INT_movetype, MOVETYPE_FOLLOW );
  47. entity_set_edict( iEntity, EV_ENT_aiment, id );
  48. }
  49. }
  50. }
  51.  
  52. public EventTeamInfo( ) {
  53. new id = read_data( 1 ), iEntity = g_iHats[ id ];
  54.  
  55. if( !is_valid_ent( iEntity ) ) {
  56. if( iEntity > 0 )
  57. g_iHats[ id ] = 0;
  58.  
  59. return;
  60. }
  61.  
  62. new szTeam[ 2 ];
  63. read_data( 2, szTeam, 1 );
  64.  
  65. if( szTeam[ 0 ] == 'C' )
  66. entity_set_model( iEntity, g_szHatModel[ CS_TEAM_CT ] );
  67. else
  68. entity_set_model( iEntity, g_szHatModel[ CS_TEAM_T ] );
  69. }

Szerző:  paintballer [ 2012.10.31. 16:16 ]
Hozzászólás témája:  Re: Sapka plugin

Ha működne akkor megköszönném, de hibát ír konvertálásnál :)

Szerző:  Bence98007 [ 2012.10.31. 16:25 ]
Hozzászólás témája:  Re: Sapka plugin

Mert ez a maxi gyerek bot.

1 sort töröld.

Szerző:  HunGamer [ 2012.10.31. 16:57 ]
Hozzászólás témája:  Re: Sapka plugin

Ha jól emlékszem te is voltál kezdő..
-----------------
Tessék, próbáld ezt:
SMA Forráskód: [ Mindet kijelol ]
  1. #include < amxmodx >
  2. #include < engine >
  3. #include < cstrike >
  4. #include < hamsandwich >
  5.  
  6. new const g_szHatModel[] = "models/santahat_blue.mdl"
  7.  
  8. new g_iHats[ 33 ];
  9.  
  10. public plugin_init( ) {
  11. register_plugin( "Team Santa Hat", "1.3", "xPaw" );
  12.  
  13. register_cvar( "santa_hat", "1.3", FCVAR_SERVER );
  14.  
  15. register_event( "TeamInfo", "EventTeamInfo", "a" );
  16.  
  17. RegisterHam( Ham_Spawn, "player", "FwdHamPlayerSpawn", 1 );
  18. }
  19.  
  20. public plugin_precache( )
  21. {
  22. precache_model(g_szHatModel)
  23. }
  24.  
  25. public client_disconnect( id )
  26. if( is_valid_ent( g_iHats[ id ] ) )
  27. remove_entity( g_iHats[ id ] );
  28.  
  29. public FwdHamPlayerSpawn( const id ) {
  30. if( is_user_alive( id ) && cs_get_user_team( id ) == CS_TEAM_CT)
  31. {
  32. new iEntity = g_iHats[ id ];
  33.  
  34. if( !is_valid_ent( iEntity ) ) {
  35. if( !( iEntity = g_iHats[ id ] = create_entity( "info_target" ) ) )
  36. return;
  37.  
  38. entity_set_model( iEntity, g_szHatModel);
  39. entity_set_int( iEntity, EV_INT_movetype, MOVETYPE_FOLLOW );
  40. entity_set_edict( iEntity, EV_ENT_aiment, id );
  41. }
  42. }
  43. }
  44.  
  45. public EventTeamInfo( )
  46. {
  47. new id = read_data( 1 ), iEntity = g_iHats[ id ];
  48.  
  49. if( !is_valid_ent( iEntity ) ) {
  50. if( iEntity > 0 )
  51. g_iHats[ id ] = 0;
  52.  
  53. return;
  54. }
  55.  
  56. new szTeam[ 2 ];
  57. read_data( 2, szTeam, 1 );
  58.  
  59. if( szTeam[ 0 ] == 'C' )
  60. entity_set_model( iEntity, g_szHatModel);
  61. }

Oldal: 1 / 1 Minden időpont UTC+02:00 időzóna szerinti
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/