hlmod.hu
https://hlmod.hu/

Pénz
https://hlmod.hu/viewtopic.php?f=29&t=27632
Oldal: 1 / 1

Szerző:  dumbass1116 [ 2017.04.26. 17:28 ]
Hozzászólás témája:  Pénz

Sziasztok, írna valaki nekem olyan plugin-t hogy ha beírja valaki /penz, akkor kapjon 16000-pénzt ezt a parancsot csak 1-nap 1x tudja használni, előreis köszönöm.

Szerző:  demon [ 2017.04.26. 19:25 ]
Hozzászólás témája:  Re: Pénz

Próbáld:
  1. #include < amxmodx >
  2. #include < cstrike >
  3.  
  4. new const g_sFile[ ] = "addons/amxmodx/configs/palyers.ini";
  5. new Array: g_daPlayers, g_iSize, bool: g_bCommand[ MAX_PLAYERS + 1 ], g_sAuthId[ MAX_PLAYERS + 1 ][ 32 ];
  6.  
  7. public plugin_init( )
  8. {
  9.     register_plugin( "", "1.0", "Demon" );
  10.    
  11.     g_daPlayers = ArrayCreate( );
  12.    
  13.     Load( );
  14.    
  15.     register_clcmd( "say /penz", "cmdMoney" );
  16. }
  17.  
  18. public cmdMoney( iPlayerId )
  19. {
  20.     if ( g_bCommand[ iPlayerId ] )
  21.     {
  22.         g_bCommand[ iPlayerId ] = false;
  23.         ArrayPushString( g_daPlayers, g_sAuthId[ iPlayerId ] );
  24.         cs_set_user_money( iPlayerId, 16000 );
  25.         client_print( iPlayerId, print_chat, "Penzed 16000-re allitva, ma mar tobbet nem hasznalhatod ezt a prancsot!" );
  26.         return;
  27.     }
  28.     client_print( iPlayerId, print_chat, "Ma mar hasznaltad ezt a parancsot!" );
  29. }
  30.  
  31. public client_authorized( iPlayerId, const sSteamId[ ] )
  32. {
  33.     if ( sSteamId[ 0 ] != 'B' )
  34.     {
  35.         copy( g_sAuthId[ iPlayerId ], charsmax( g_sAuthId[ ] ), sSteamId );
  36.        
  37.         g_bCommand[ iPlayerId ] = ( ArrayFindString( g_daPlayers, sSteamId ) != -1 ) ? false : true;
  38.     }
  39. }
  40.  
  41. public Load( )
  42. {
  43.     new pFile = fopen( g_sFile, "rt" );
  44.    
  45.     if ( pFile )
  46.     {
  47.         new sLine[ 36 ];
  48.        
  49.         while ( !feof( pFile ) )
  50.         {
  51.             fgets( pFile, sLine, charsmax( sLine ) );
  52.             trim( sLine );
  53.             remove_quotes( sLine );
  54.            
  55.             ArrayPushString( g_daPlayers, sLine );
  56.         }
  57.         fclose( pFile );
  58.         g_iSize = ArraySize( g_daPlayers );
  59.     }
  60. }
  61.  
  62. public Save( )
  63. {
  64.     if ( file_exists( g_sFile ) ) delete_file( g_sFile );
  65.    
  66.     new pFile = fopen( g_sFile, "wt" );
  67.    
  68.     if ( pFile )
  69.     {
  70.         new sLine[ 40 ];
  71.         for ( new i; i < g_iSize; ++i )
  72.         {
  73.             formatex( sLine, charsmax( sLine ), "^"%a^"", ArrayGetStringHandle( g_daPlayers, i ) );
  74.            
  75.             fputs( pFile, sLine );
  76.         }
  77.         fclose( pFile );
  78.     }
  79.     ArrayDestroy( g_daPlayers );
  80. }
  81.  
  82. public plugin_end( ) { Save( ); }

Szerző:  dumbass1116 [ 2017.04.26. 19:53 ]
Hozzászólás témája:  Re: Pénz

demon írta:
Próbáld:
  1. #include < amxmodx >
  2. #include < cstrike >
  3.  
  4. new const g_sFile[ ] = "addons/amxmodx/configs/palyers.ini";
  5. new Array: g_daPlayers, g_iSize, bool: g_bCommand[ MAX_PLAYERS + 1 ], g_sAuthId[ MAX_PLAYERS + 1 ][ 32 ];
  6.  
  7. public plugin_init( )
  8. {
  9.     register_plugin( "", "1.0", "Demon" );
  10.    
  11.     g_daPlayers = ArrayCreate( );
  12.    
  13.     Load( );
  14.    
  15.     register_clcmd( "say /penz", "cmdMoney" );
  16. }
  17.  
  18. public cmdMoney( iPlayerId )
  19. {
  20.     if ( g_bCommand[ iPlayerId ] )
  21.     {
  22.         g_bCommand[ iPlayerId ] = false;
  23.         ArrayPushString( g_daPlayers, g_sAuthId[ iPlayerId ] );
  24.         cs_set_user_money( iPlayerId, 16000 );
  25.         client_print( iPlayerId, print_chat, "Penzed 16000-re allitva, ma mar tobbet nem hasznalhatod ezt a prancsot!" );
  26.         return;
  27.     }
  28.     client_print( iPlayerId, print_chat, "Ma mar hasznaltad ezt a parancsot!" );
  29. }
  30.  
  31. public client_authorized( iPlayerId, const sSteamId[ ] )
  32. {
  33.     if ( sSteamId[ 0 ] != 'B' )
  34.     {
  35.         copy( g_sAuthId[ iPlayerId ], charsmax( g_sAuthId[ ] ), sSteamId );
  36.        
  37.         g_bCommand[ iPlayerId ] = ( ArrayFindString( g_daPlayers, sSteamId ) != -1 ) ? false : true;
  38.     }
  39. }
  40.  
  41. public Load( )
  42. {
  43.     new pFile = fopen( g_sFile, "rt" );
  44.    
  45.     if ( pFile )
  46.     {
  47.         new sLine[ 36 ];
  48.        
  49.         while ( !feof( pFile ) )
  50.         {
  51.             fgets( pFile, sLine, charsmax( sLine ) );
  52.             trim( sLine );
  53.             remove_quotes( sLine );
  54.            
  55.             ArrayPushString( g_daPlayers, sLine );
  56.         }
  57.         fclose( pFile );
  58.         g_iSize = ArraySize( g_daPlayers );
  59.     }
  60. }
  61.  
  62. public Save( )
  63. {
  64.     if ( file_exists( g_sFile ) ) delete_file( g_sFile );
  65.    
  66.     new pFile = fopen( g_sFile, "wt" );
  67.    
  68.     if ( pFile )
  69.     {
  70.         new sLine[ 40 ];
  71.         for ( new i; i < g_iSize; ++i )
  72.         {
  73.             formatex( sLine, charsmax( sLine ), "^"%a^"", ArrayGetStringHandle( g_daPlayers, i ) );
  74.            
  75.             fputs( pFile, sLine );
  76.         }
  77.         fclose( pFile );
  78.     }
  79.     ArrayDestroy( g_daPlayers );
  80. }
  81.  
  82. public plugin_end( ) { Save( ); }

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/