hlmod.hu
https://hlmod.hu/

sapka csak játékosoknak
https://hlmod.hu/viewtopic.php?f=9&t=28527
Oldal: 1 / 1

Szerző:  elit [ 2017.12.07. 09:02 ]
Hozzászólás témája:  sapka csak játékosoknak

Üdv.

ebbe a pluginba meglehet oldani hogy csak játékosok kapjanak sapkát adminok ne.

mivel adminoknak külön-külön van 1-1 skin és nem akarom hogy az adminoknak legyen. thx

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

Szerző:  Jucika [ 2017.12.07. 09:05 ]
Hozzászólás témája:  Re: sapka csak játékosoknak

Tessék.
  1. #include <amxmodx>
  2. #include <cstrike>
  3. #include <hamsandwich>
  4. #include <colorchat>
  5. #include <engine>
  6.  
  7. new const g_szHatModel[][] = {
  8.     "models/santahat.mdl",
  9.     "models/santahat_blue.mdl"
  10. }
  11. new g_iHats[33]
  12.  
  13. public plugin_init() {
  14.     register_plugin("Sapkat", "1.0", "Fiment"); /// Szerk Jucika
  15.    
  16.     register_event("TeamInfo", "EventTeamInfo", "a");
  17.     RegisterHam(Ham_Spawn, "player", "FwdHamPlayerSpawn", 1);
  18. }
  19. public plugin_precache() {
  20.     precache_model(g_szHatModel[0]);
  21.     precache_model(g_szHatModel[1]);
  22. }
  23. public client_disconnect(id) if(is_valid_ent(g_iHats[id])) remove_entity(g_iHats[id])
  24. public FwdHamPlayerSpawn(id) {
  25.     if(!is_user_alive(id)) return PLUGIN_HANDLED;
  26.    
  27.     g_iHats[id] = create_entity("info_target")
  28.    
  29.     if(!is_valid_ent(g_iHats[id])) return PLUGIN_HANDLED;
  30.  
  31.     entity_set_edict(g_iHats[id], EV_ENT_aiment, id)
  32.     entity_set_int(g_iHats[id], EV_INT_movetype, MOVETYPE_FOLLOW)
  33.     if(cs_get_user_team(id) == CS_TEAM_T) entity_set_model(g_iHats[id], g_szHatModel[0])
  34.     else if(cs_get_user_team(id) == CS_TEAM_CT) entity_set_model(g_iHats[id], g_szHatModel[1])
  35.    
  36.     return PLUGIN_CONTINUE
  37. }
  38. public EventTeamInfo() {
  39.     new id = read_data(1)
  40.    
  41.     if(!is_valid_ent(g_iHats[id])) return PLUGIN_HANDLED;
  42.    
  43.     new szTeam[2];
  44.     read_data(2, szTeam, 1);
  45.    
  46.     if(szTeam[0] == 'C') entity_set_model(g_iHats[id], g_szHatModel[1])
  47.     else entity_set_model(g_iHats[id], g_szHatModel[0])
  48.        
  49.     return PLUGIN_CONTINUE
  50. }

Szerző:  Dooz [ 2017.12.07. 09:50 ]
Hozzászólás témája:  Re: sapka csak játékosoknak

Üdv. Talán én vagyok a vak, de nem látom ebben azt a részt, amikor ellenőrzi, hogy admin-e a játékos.
Nem egy más plugint kért, hanem azt kérte, hogy az általa elküldöttbe írjuk bele, hogy adminoknak ne legyen sapkája, csak játékosoknak.

Jucika írta:
Tessék.
  1. #include <amxmodx>
  2. #include <cstrike>
  3. #include <hamsandwich>
  4. #include <colorchat>
  5. #include <engine>
  6.  
  7. new const g_szHatModel[][] = {
  8.     "models/santahat.mdl",
  9.     "models/santahat_blue.mdl"
  10. }
  11. new g_iHats[33]
  12.  
  13. public plugin_init() {
  14.     register_plugin("Sapkat", "1.0", "Fiment"); /// Szerk Jucika
  15.    
  16.     register_event("TeamInfo", "EventTeamInfo", "a");
  17.     RegisterHam(Ham_Spawn, "player", "FwdHamPlayerSpawn", 1);
  18. }
  19. public plugin_precache() {
  20.     precache_model(g_szHatModel[0]);
  21.     precache_model(g_szHatModel[1]);
  22. }
  23. public client_disconnect(id) if(is_valid_ent(g_iHats[id])) remove_entity(g_iHats[id])
  24. public FwdHamPlayerSpawn(id) {
  25.     if(!is_user_alive(id)) return PLUGIN_HANDLED;
  26.    
  27.     g_iHats[id] = create_entity("info_target")
  28.    
  29.     if(!is_valid_ent(g_iHats[id])) return PLUGIN_HANDLED;
  30.  
  31.     entity_set_edict(g_iHats[id], EV_ENT_aiment, id)
  32.     entity_set_int(g_iHats[id], EV_INT_movetype, MOVETYPE_FOLLOW)
  33.     if(cs_get_user_team(id) == CS_TEAM_T) entity_set_model(g_iHats[id], g_szHatModel[0])
  34.     else if(cs_get_user_team(id) == CS_TEAM_CT) entity_set_model(g_iHats[id], g_szHatModel[1])
  35.    
  36.     return PLUGIN_CONTINUE
  37. }
  38. public EventTeamInfo() {
  39.     new id = read_data(1)
  40.    
  41.     if(!is_valid_ent(g_iHats[id])) return PLUGIN_HANDLED;
  42.    
  43.     new szTeam[2];
  44.     read_data(2, szTeam, 1);
  45.    
  46.     if(szTeam[0] == 'C') entity_set_model(g_iHats[id], g_szHatModel[1])
  47.     else entity_set_model(g_iHats[id], g_szHatModel[0])
  48.        
  49.     return PLUGIN_CONTINUE
  50. }


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

Ha bármi gond lenne ezzel, szólj.
Akkor nem kap sapkát egy játékos, ha van Kick joga.

Szerző:  elit [ 2017.12.07. 10:03 ]
Hozzászólás témája:  Re: sapka csak játékosoknak

tökéletes! köszönöm! :)

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