hlmod.hu
https://hlmod.hu/

Sapka csak CT
https://hlmod.hu/viewtopic.php?f=10&t=11712
Oldal: 1 / 1

Szerző:  ChaspeR [ 2013.11.08. 17:19 ]
Hozzászólás témája:  Sapka csak CT

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 ) ) {
  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. if( iTeam != CS_TEAM_T && iTeam != CS_TEAM_CT )
  46. iTeam = CS_TEAM_T;
  47.  
  48. entity_set_model( iEntity, g_szHatModel[ iTeam ] );
  49. entity_set_int( iEntity, EV_INT_movetype, MOVETYPE_FOLLOW );
  50. entity_set_edict( iEntity, EV_ENT_aiment, id );
  51. }
  52. }
  53. }
  54.  
  55. public EventTeamInfo( ) {
  56. new id = read_data( 1 ), iEntity = g_iHats[ id ];
  57.  
  58. if( !is_valid_ent( iEntity ) ) {
  59. if( iEntity > 0 )
  60. g_iHats[ id ] = 0;
  61.  
  62. return;
  63. }
  64.  
  65. new szTeam[ 2 ];
  66. read_data( 2, szTeam, 1 );
  67.  
  68. if( szTeam[ 0 ] == 'C' )
  69. entity_set_model( iEntity, g_szHatModel[ CS_TEAM_CT ] );
  70. else
  71. entity_set_model( iEntity, g_szHatModel[ CS_TEAM_T ] );
  72. }


Valaki megcsinálná nekem ,hogy csak a kék sapka legyen és csak CT_nek tehát terroroknak ne legyen , és ha netán átváltana egy embert ct-ből t-be akkor ellenőrizze le ( ezt úgy értem működjön Zombie Plague-én, csak embernek!)

Köszi előre is!

Szerző:  stupid [ 2013.11.08. 17:43 ]
Hozzászólás témája:  Re: Sapka csak CT

Teszteld

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_blue.mdl",
  9. ""
  10. };
  11.  
  12. new g_iHats[ 33 ];
  13.  
  14. public plugin_init( ) {
  15. register_plugin( "Team Santa Hat", "1.3", "xPaw" );
  16.  
  17. register_cvar( "santa_hat", "1.3", FCVAR_SERVER );
  18.  
  19. register_event( "TeamInfo", "EventTeamInfo", "a" );
  20.  
  21. RegisterHam( Ham_Spawn, "player", "FwdHamPlayerSpawn", 1 );
  22. }
  23.  
  24. public plugin_precache( ) {
  25.  
  26. precache_model( g_szHatModel[ CS_TEAM_CT ] );
  27. }
  28.  
  29. public client_disconnect( id )
  30. if( is_valid_ent( g_iHats[ id ] ) )
  31. remove_entity( g_iHats[ id ] );
  32.  
  33. public FwdHamPlayerSpawn( const id ) {
  34. if( is_user_alive( id ) ) {
  35. new iEntity = g_iHats[ id ];
  36.  
  37. if( !is_valid_ent( iEntity ) ) {
  38. if( !( iEntity = g_iHats[ id ] = create_entity( "info_target" ) ) )
  39. return;
  40.  
  41. new CsTeams:iTeam = cs_get_user_team( id );
  42.  
  43. if( iTeam != CS_TEAM_CT )
  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. }

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