hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.03.29. 00:05



Jelenlévő felhasználók

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

A legtöbb felhasználó (1565 fő) 2020.11.21. 11:26-kor tartózkodott itt.

Regisztrált felhasználók: nincs regisztrált felhasználó 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  [ 10 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: Vip plugin hiba (plugin by demon)
HozzászólásElküldve: 2017.08.02. 10:46 
Offline
Beavatott
Avatar

Csatlakozott: 2017.07.16. 10:56
Hozzászólások: 91
Megköszönt másnak: 1 alkalommal
Megköszönték neki: 4 alkalommal
Sziasztok, valaki kitudná javítani fordításnál hibát ír ki.

Fordtítás hiba.
viprendszer.sma(19) : error 017: undefined symbol "MAX_PLAYERS"
viprendszer.sma(46) : error 017: undefined symbol "client_print_color"
viprendszer.sma(86) : warning 224: indeterminate array size in "sizeof" expression (symbol "")
viprendszer.sma(127) : error 088: number of arguments does not match definition
viprendszer.sma(149) : error 017: undefined symbol "client_print_color"
viprendszer.sma(198) : error 017: undefined symbol "client_print_color"
viprendszer.sma(198) : warning 215: expression has no effect
viprendszer.sma(198) : warning 215: expression has no effect
viprendszer.sma(198) : warning 215: expression has no effect
viprendszer.sma(198) : warning 215: expression has no effect
viprendszer.sma(198) : error 001: expected token: ";", but found ")"
viprendszer.sma(198) : error 029: invalid expression, assumed zero
viprendszer.sma(198) : fatal error 107: too many error messages on one line


Csatolmányok:
viprendszer.sma [12.4 KiB]
Letöltve 149 alkalommal.

_________________
Kép
Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Vip plugin hiba (plugin by demon)
HozzászólásElküldve: 2017.08.02. 11:16 
Offline
Félisten
Avatar

Csatlakozott: 2015.03.12. 18:30
Hozzászólások: 975
Megköszönt másnak: 67 alkalommal
Megköszönték neki: 136 alkalommal
Nem fordítottam le a plugint, de azt az egyet tudom, ha [profil]demon[/profil] ide kirak valami plugint, akkor 100%-osan jó.
Használj rendes fordítót.

Kód:
//// viprendszer.sma
//
// Header size:           1344 bytes
// Code size:            11236 bytes
// Data size:            24200 bytes
// Stack/heap size:      16384 bytes
// Total requirements:   53164 bytes
// Done.
//
// Compilation Time: 0,14 sec
// ----------------------------------------

Press enter to exit ...

_________________
Fórumi aktivitásom véget ért: 2017.09.07.
Innentől esetleg steamen vagyok elérhető.


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Vip plugin hiba (plugin by demon)
HozzászólásElküldve: 2017.08.02. 11:19 
Offline
Beavatott
Avatar

Csatlakozott: 2017.07.16. 10:56
Hozzászólások: 91
Megköszönt másnak: 1 alkalommal
Megköszönték neki: 4 alkalommal
kengurumancs írta:
Nem fordítottam le a plugint, de azt az egyet tudom, ha [profil]demon[/profil] ide kirak valami plugint, akkor 100%-osan jó.
Használj rendes fordítót.

Kód:
//// viprendszer.sma
//
// Header size:           1344 bytes
// Code size:            11236 bytes
// Data size:            24200 bytes
// Stack/heap size:      16384 bytes
// Total requirements:   53164 bytes
// Done.
//
// Compilation Time: 0,14 sec
// ----------------------------------------

Press enter to exit ...

Próbáltam de nem fordítja le.

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Vip plugin hiba (plugin by demon)
HozzászólásElküldve: 2017.08.02. 11:27 
Offline
Jómunkásember
Avatar

Csatlakozott: 2013.01.15. 19:04
Hozzászólások: 407
Megköszönt másnak: 17 alkalommal
Megköszönték neki: 176 alkalommal
1.8.3 fordítót használj.


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Vip plugin hiba (plugin by demon)
HozzászólásElküldve: 2017.08.02. 11:30 
Offline
Beavatott
Avatar

Csatlakozott: 2017.07.16. 10:56
Hozzászólások: 91
Megköszönt másnak: 1 alkalommal
Megköszönték neki: 4 alkalommal
demon írta:
1.8.3 fordítót használj.

Nem működik.

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Vip plugin hiba (plugin by demon)
HozzászólásElküldve: 2017.08.02. 11:50 
Offline
Félisten
Avatar

Csatlakozott: 2015.03.12. 18:30
Hozzászólások: 975
Megköszönt másnak: 67 alkalommal
Megköszönték neki: 136 alkalommal
Stew írta:
demon írta:
1.8.3 fordítót használj.

Nem működik.

Előtted másoltam be a sikeres fordítást. Ne beszélj hülyeségeket.

_________________
Fórumi aktivitásom véget ért: 2017.09.07.
Innentől esetleg steamen vagyok elérhető.


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Vip plugin hiba (plugin by demon)
HozzászólásElküldve: 2017.08.02. 13:10 
Offline
Beavatott
Avatar

Csatlakozott: 2017.07.16. 10:56
Hozzászólások: 91
Megköszönt másnak: 1 alkalommal
Megköszönték neki: 4 alkalommal
kengurumancs írta:
Stew írta:
demon írta:
1.8.3 fordítót használj.

Nem működik.

Előtted másoltam be a sikeres fordítást. Ne beszélj hülyeségeket.

Nekem folyton ezt a hibát írja.


Csatolmányok:
Névtelen.png
Névtelen.png [ 42.8 KiB | Megtekintve 3116 alkalommal ]

_________________
Kép
Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Vip plugin hiba (plugin by demon)
HozzászólásElküldve: 2017.08.02. 13:19 
Offline
Tud valamit
Avatar

Csatlakozott: 2016.11.08. 18:40
Hozzászólások: 127
Megköszönt másnak: 7 alkalommal
Megköszönték neki: 22 alkalommal
  1. #include < amxmodx >
  2. #include < sqlx >
  3.  
  4. #define FLAGS "t"
  5.  
  6. #pragma semicolon 1
  7. #define MAX_PLAYERS 33
  8.  
  9. new const g_sPrefix[ ] = ".:Wu Tang:.";
  10.  
  11. new const g_sSQLInfos[ ][ ] =
  12. {
  13.     "db.synhosting.eu",     // HOST
  14.     "", // USERNAME
  15.     "", // PASSWORD
  16.     ""  // DATABASE
  17. };
  18.  
  19. new Handle: g_hSqlTuple;
  20. new g_iPoints[ MAX_PLAYERS ], g_sAuthId[ MAX_PLAYERS ][ 32 ], g_iSavedMonth;
  21.  
  22. public plugin_init( )
  23. {
  24.     register_plugin( "Top 3 VIP (Sql)", "1.0", "Demon" );
  25.     register_cvar( "Top 3 VIP (Sql)", "By Demon", FCVAR_SERVER );
  26.    
  27.     if ( InitSQL( ) )
  28.     {
  29.         Load( );
  30.        
  31.         register_concmd( "say /ptop15", "cmdPTop15" );
  32.         register_concmd( "say /prank", "cmdPRank" );
  33.         register_concmd( "say /pontok", "cmdMyPoints" );
  34.         register_concmd( "say_team /ptop15", "cmdPTop15" );
  35.         register_concmd( "say_team /prank", "cmdPRank" );
  36.         register_concmd( "say_team /pontok", "cmdMyPoints" );
  37.        
  38.         register_event( "DeathMsg", "onDeath", "a" );
  39.        
  40.         set_task( 60.0, "Check", 56789, _, _, "b" );
  41.         set_task( 180.0, "Advertising", 98765, _, _, "b" );
  42.     }
  43. }
  44.  
  45. public cmdPTop15( iPlayerId ) { LoadDatas( iPlayerId, 3 ); }
  46. public cmdPRank( iPlayerId ) { LoadDatas( iPlayerId, 2 ); }
  47. public cmdMyPoints( iPlayerId ) { client_print_color( iPlayerId, iPlayerId, "^4[%s] ^1Pontjaid száma: ^3%d^1.", g_sPrefix, g_iPoints[ iPlayerId ] ); }
  48.  
  49. InitSQL( )
  50. {
  51.     g_hSqlTuple = SQL_MakeDbTuple( g_sSQLInfos[ 0 ], g_sSQLInfos[ 1 ], g_sSQLInfos[ 2 ], g_sSQLInfos[ 3 ] );
  52.    
  53.     if( g_hSqlTuple == Empty_Handle ) return -1;
  54.    
  55.     new iError, sError[ 128 ];
  56.     new Handle: hDb = SQL_Connect( g_hSqlTuple, iError, sError, charsmax( sError ) );
  57.    
  58.     if( hDb == Empty_Handle )
  59.     {
  60.         log_amx( "Nem lehet csatlakozni az adatbazishoz: (%d) %s", iError, sError );
  61.         return -1;
  62.     }
  63.    
  64.     new Handle: hQuery = SQL_PrepareQuery( hDb, "CREATE TABLE IF NOT EXISTS `point_system` (`authid` varchar(32) NOT NULL PRIMARY KEY, `username` varchar(32) NOT NULL, `points` INT(11) NOT NULL);" );
  65.    
  66.     if( !SQL_Execute( hQuery ) )
  67.     {
  68.         SQL_QueryError( hQuery, sError, charsmax( sError ) );
  69.         log_amx( "Tabla letrehozas sikertelen: %s", sError );
  70.         return -1;
  71.     }
  72.    
  73.     SQL_FreeHandle( hQuery );
  74.     SQL_FreeHandle( hDb );
  75.     return 1;
  76. }
  77.  
  78. public SaveDatas( iPlayerId, iMode )
  79. {
  80.     static sText[ 512 ], sName[ 32 ];
  81.     get_user_name( iPlayerId, sName, charsmax( sName ) );
  82.     MakeStringSQLSafe( sName, charsmax( sName ) );
  83.    
  84.     if ( iMode == 1 ) formatex( sText, charsmax( sText ), "REPLACE INTO `point_system` (`authid`,`username`,`points`) VALUES (^"%s^", ^"%s^", %d);", g_sAuthId[ iPlayerId ], sName, g_iPoints[ iPlayerId ] );
  85.     else
  86.     {
  87.         arrayset( g_iPoints, 0, sizeof( g_iPoints ) );
  88.         formatex( sText, charsmax( sText ), "TRUNCATE `point_system`;" );
  89.     }
  90.    
  91.     SQL_ThreadQuery( g_hSqlTuple, "ThreadHandler", sText, { 0 }, 1 );
  92. }
  93.  
  94. public LoadDatas( iPlayerId, iMode )
  95. {
  96.     static sText[ 128 ], iArray[ 1 ];
  97.     iArray[ 0 ] = iPlayerId;
  98.    
  99.     switch( iMode )
  100.     {
  101.         case 1: formatex( sText, charsmax( sText ), "SELECT `points` FROM `point_system` WHERE `authid` = ^"%s^";", g_sAuthId[ iPlayerId ] );
  102.         case 2:
  103.         {
  104.             iArray[ 0 ] += 100;
  105.             formatex( sText, charsmax( sText ), "SELECT COUNT(*) AS players, rank.num AS prank FROM `point_system`, (SELECT COUNT(*) AS num FROM `point_system` WHERE `points` > %d ) AS rank;", g_iPoints[ iPlayerId ] );
  106.         }
  107.         case 3:
  108.         {
  109.             iArray[ 0 ] += 200;
  110.             formatex( sText, charsmax( sText ), "SELECT `points`, `username` FROM `point_system` ORDER BY `points` DESC LIMIT 15;" );
  111.         }
  112.         case 4:
  113.         {
  114.             iArray[ 0 ] = 300;
  115.             formatex( sText, charsmax( sText ), "SELECT `authid`, `username` FROM `point_system` ORDER BY `points` DESC LIMIT 3;" );
  116.         }
  117.     }
  118.     SQL_ThreadQuery( g_hSqlTuple, "ThreadHandler", sText, iArray, sizeof ( iArray ) );
  119. }
  120.  
  121. public ThreadHandler( iFailState, Handle: hQuery, const sError[ ], iError, const iARRAY[ ], iArraySize, Float: fQueueTime )
  122. {
  123.     switch( iFailState )
  124.     {
  125.         case TQUERY_CONNECT_FAILED:
  126.         {
  127.             log_amx( "Nem lehet csatlakozni az adatbazishoz: (%d) %s", iError, sError );
  128.             set_fail_state( "Nem lehet csatlakozni az adatbazishoz: (%d) %s", iError, sError );
  129.         }
  130.         case TQUERY_QUERY_FAILED:
  131.         {
  132.             log_amx( "Hibas lekerdezes: (%d) %s", iError, sError );
  133.             return;
  134.         }
  135.     }
  136.    
  137.     new iPlayerId = iARRAY[ 0 ];
  138.     if ( iPlayerId )
  139.     {
  140.         if ( iPlayerId < 100 )
  141.         {
  142.             if ( SQL_NumResults( hQuery ) > 0 )
  143.                 g_iPoints[ iPlayerId ] = SQL_ReadResult( hQuery, SQL_FieldNameToNum( hQuery, "points" ) );
  144.         }
  145.         else if ( iPlayerId < 200 )
  146.         {
  147.             iPlayerId -= 100;
  148.             new iRank = SQL_ReadResult( hQuery, SQL_FieldNameToNum( hQuery, "prank" ) );
  149.             new iPlayers = SQL_ReadResult( hQuery, SQL_FieldNameToNum( hQuery, "players" ) );
  150.             client_print_color( iPlayerId, iPlayerId, "^4[%s] ^1Te pont rankod ^3%d ^1a ^3%d^1-ból/bÅ‘l ^3%d ^1ponttal.", g_sPrefix, iRank == 0 ? 1 : iRank, iPlayers == 0 ? 1 : iPlayers, g_iPoints[ iPlayerId ] );
  151.         }
  152.         else if ( iPlayerId < 300 )
  153.         {
  154.             static iLen, sMotd[ 2048 ], sName[ 32 ], i, iPoints, iMLen = charsmax( sMotd );
  155.             iLen = 0;
  156.            
  157.             iPlayerId -= 200;
  158.        
  159.             iLen = formatex( sMotd, iMLen, "<meta charset=utf-8><body bgcolor=#000000><font color=#FFB000><pre>" );
  160.             iLen += formatex( sMotd[ iLen ], iMLen - iLen, "%2s %-22.22s %6s^n", "#", "Név", "Pont" );
  161.            
  162.             i = 1;
  163.             while ( SQL_MoreResults( hQuery ) )
  164.             {
  165.                 SQL_ReadResult( hQuery, SQL_FieldNameToNum( hQuery, "username" ), sName, charsmax( sName ) );
  166.                 iPoints = SQL_ReadResult( hQuery, SQL_FieldNameToNum( hQuery, "points" ) );
  167.                 switch ( i )
  168.                 {
  169.                     case 1: iLen += formatex( sMotd[iLen], iMLen - iLen, "<font color=ff0bb7>%2d %-22.22s %d</font>^n", i, sName, iPoints );
  170.                     case 2: iLen += formatex( sMotd[iLen], iMLen - iLen, "<font color=#07fcff>%2d %-22.22s %d</font>^n", i, sName, iPoints );
  171.                     case 3: iLen += formatex( sMotd[iLen], iMLen - iLen, "<font color=#0BF402>%2d %-22.22s %d</font>^n", i, sName, iPoints );
  172.                     default: iLen += formatex( sMotd[iLen], iMLen - iLen, "%2d %-22.22s %d^n", i, sName, iPoints );
  173.                 }
  174.                
  175.                 ++i;  
  176.                 SQL_NextRow( hQuery );
  177.             }
  178.            
  179.             show_motd( iPlayerId, sMotd, "Pont TOP15" );
  180.         }
  181.         else
  182.         {
  183.             new sFile[ 64 ] = "addons/amxmodx/configs/users.ini";
  184.             new pFile = fopen( sFile, "rt" );
  185.            
  186.             if ( pFile )
  187.             {  
  188.                 new sNewLine[ 128 ], i = 1, sName[ 32 ], sAuthId[ 32 ];
  189.                 write_file( sFile, "; VIP rendszer által sorsolt VIP tagok: ", 0 );
  190.                 if ( SQL_NumResults( hQuery ) > 0 )
  191.                 {
  192.                     while ( SQL_MoreResults( hQuery ) )
  193.                     {
  194.                         SQL_ReadResult( hQuery, SQL_FieldNameToNum( hQuery, "username" ), sName, charsmax( sName ) );
  195.                         SQL_ReadResult( hQuery, SQL_FieldNameToNum( hQuery, "authid" ), sAuthId, charsmax( sAuthId ) );
  196.                        
  197.                         formatex( sNewLine, charsmax( sNewLine ), "^"%s^" ^"^" ^"%s^" ^"ce^" //%s", sAuthId, FLAGS, sName );
  198.                         write_file( sFile, sNewLine, i );
  199.                         client_print_color( 0, print_team_default, "^4[%s] ^3%s VIP tagságban részesültélt mivel benne van a PTOP3-ban (rankja: ^4PTOP%d^3).", g_sPrefix, sName, i );
  200.                        
  201.                         ++i;
  202.                        
  203.                         SQL_NextRow( hQuery );
  204.                     }
  205.                 }
  206.                 else
  207.                 {
  208.                     write_file( sFile, "", 1 );
  209.                     write_file( sFile, "", 2 );
  210.                     write_file( sFile, "", 3 );
  211.                 }
  212.                 Save( );
  213.                 server_cmd( "amx_reloadadmins" );
  214.                 SaveDatas( 0, 2 );
  215.                 if ( task_exists( 56789 ) ) remove_task( 56789 );
  216.                
  217.                 fclose( pFile );
  218.             }
  219.         }
  220.     }
  221.    
  222.     return;
  223. }
  224.  
  225. public client_putinserver( iPlayerId )
  226. {
  227.     g_iPoints[ iPlayerId ] = 0;
  228.     g_sAuthId[ iPlayerId ][ 0 ] = EOS;
  229.    
  230.     if ( is_user_bot( iPlayerId ) || is_user_hltv( iPlayerId ) ) return;
  231.    
  232.     get_user_authid( iPlayerId, g_sAuthId[ iPlayerId ], charsmax( g_sAuthId[ ] ) );
  233.    
  234.     LoadDatas( iPlayerId, 1 );
  235. }
  236.  
  237. public Advertising( )
  238. {
  239.     static iAdv = -1;
  240.     ++iAdv;
  241.     switch( iAdv )
  242.     {
  243.         case 0: client_print_color( 0, print_team_default, "^4[%s] ^3Minden hónap 1. napján a PTOP3 játékos VIP tagságban részesül.", g_sPrefix );
  244.         case 1:
  245.         {
  246.             static sMonth[ 5 ], sDay[ 5 ], sYear[ 7 ], iMonth, iDay, iYear;
  247.             get_time( "%d", sDay, charsmax( sDay )  );
  248.             get_time( "%m", sMonth, charsmax( sMonth ) );
  249.             get_time( "%Y", sYear, charsmax( sYear ) );
  250.            
  251.             iMonth = str_to_num( sMonth );
  252.             iDay = str_to_num( sDay );
  253.             iYear = str_to_num( sYear );
  254.            
  255.             client_print_color( 0, print_team_default, "^4[%s] ^1Még ^3%d nap ^1van a következÅ‘ VIP sorsolásig.", g_sPrefix, ( GetDaysInMonth( iMonth, iYear ) - iDay ) );
  256.         }
  257.         case 2: client_print_color( 0, print_team_default, "^4[%s] ^1A pont rankod megtekintéséhez í­rd be, hogy ^3/prank^1.", g_sPrefix );
  258.         case 3: client_print_color( 0, print_team_default, "^4[%s] ^1A Pont TOP15 megtekintéséhez í­rd be, hogy ^3/ptop15^1.", g_sPrefix );
  259.         default: iAdv = -1;
  260.     }
  261. }
  262.  
  263. public onDeath( )
  264. {
  265.     new iKiller = read_data( 1 );
  266.    
  267.     if ( is_user_bot( iKiller ) ) return;
  268.    
  269.     new iVictim = read_data( 2 );
  270.     new iHs = read_data( 3 );
  271.     new bTK = get_user_team( iKiller ) == get_user_team( iVictim );
  272.     new sWpn[ 3 ];
  273.     read_data( 4, sWpn, charsmax( sWpn ) );
  274.    
  275.     if ( iKiller != iVictim )
  276.     {
  277.         if ( !bTK && !iHs && sWpn[ 1 ] != 'r' && sWpn[ 0 ] != 'k' ) g_iPoints[ iKiller ] += 1;
  278.         else if ( !bTK && ( iHs || sWpn[ 1 ] == 'r' || sWpn[ 0 ] == 'k' ) ) g_iPoints[ iKiller ] += 2;
  279.        
  280.         SaveDatas( iKiller, 1 );
  281.     }
  282. }
  283.  
  284. public Check( )
  285. {  
  286.     static sDay[ 5 ], sMonth[ 5 ], iDay, iMonth;
  287.     get_time( "%d", sDay, charsmax( sDay ) );
  288.     get_time( "%m", sMonth, charsmax( sMonth ) );
  289.    
  290.     iDay = str_to_num( sDay );
  291.     iMonth = str_to_num( sMonth );
  292.    
  293.     if ( iDay > 1 )
  294.         if ( task_exists( 56789 ) ) remove_task( 56789 );
  295.    
  296.     if ( iMonth == g_iSavedMonth || iDay != 1 ) return;
  297.     LoadDatas( 0, 4 );
  298. }
  299.  
  300. public Save( )
  301. {
  302.     new sMonth[ 5 ], iMonth, sFile[ 200 ], sNewLine[ 16 ];
  303.     get_time( "%m", sMonth, charsmax( sMonth ) );
  304.            
  305.     iMonth = g_iSavedMonth = str_to_num( sMonth );
  306.    
  307.     format( sFile, charsmax( sFile ), "addons/amxmodx/configs/pontrendszer_by_demon", sFile);
  308.  
  309.     if ( !dir_exists( sFile ) ) mkdir( sFile );
  310.    
  311.     format( sFile, 199, "%s/honap.txt", sFile );
  312.    
  313.     formatex( sNewLine, charsmax( sNewLine ), "^"%d^"", iMonth );
  314.     write_file( sFile, sNewLine, 0 );
  315. }
  316.  
  317. public Load( )
  318. {
  319.     new pFile  = fopen( "addons/amxmodx/configs/pontrendszer_by_demon/honap.txt", "rt" );
  320.    
  321.     if ( pFile )
  322.     {
  323.         new sLine[ 8 ];
  324.         fgets( pFile, sLine, charsmax( sLine ) );
  325.        
  326.         trim( sLine );
  327.         remove_quotes( sLine );
  328.         g_iSavedMonth = str_to_num( sLine );
  329.        
  330.         fclose( pFile );
  331.     }
  332.     else g_iSavedMonth = 0;
  333. }
  334.  
  335. public plugin_end( ) { SQL_FreeHandle( g_hSqlTuple ); }
  336.  
  337. stock GetDaysInMonth( iMonth, iYear )
  338. {
  339.     switch( iMonth )
  340.     {
  341.         case 1, 3, 5, 7, 8, 10, 12: return 31;
  342.         case 2: return ( ( iYear % 4 ) == 0 ) ? 29 : 28;
  343.     }
  344.     return 30;
  345. }
  346.  
  347. stock MakeStringSQLSafe( sName[ ], iLen )
  348. {
  349.     replace_all( sName, iLen, "'", "*" );
  350.     replace_all( sName, iLen, "^"", "*" );
  351.    replace_all( sName, iLen, "`", "*" );
  352. }

esetleg ?

_________________
Just* Szerverek hamarosan!


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Vip plugin hiba (plugin by demon)
HozzászólásElküldve: 2017.08.02. 13:26 
Offline
Beavatott
Avatar

Csatlakozott: 2017.07.16. 10:56
Hozzászólások: 91
Megköszönt másnak: 1 alkalommal
Megköszönték neki: 4 alkalommal
Zoe írta:
  1. #include < amxmodx >
  2. #include < sqlx >
  3.  
  4. #define FLAGS "t"
  5.  
  6. #pragma semicolon 1
  7. #define MAX_PLAYERS 33
  8.  
  9. new const g_sPrefix[ ] = ".:Wu Tang:.";
  10.  
  11. new const g_sSQLInfos[ ][ ] =
  12. {
  13.     "db.synhosting.eu",     // HOST
  14.     "", // USERNAME
  15.     "", // PASSWORD
  16.     ""  // DATABASE
  17. };
  18.  
  19. new Handle: g_hSqlTuple;
  20. new g_iPoints[ MAX_PLAYERS ], g_sAuthId[ MAX_PLAYERS ][ 32 ], g_iSavedMonth;
  21.  
  22. public plugin_init( )
  23. {
  24.     register_plugin( "Top 3 VIP (Sql)", "1.0", "Demon" );
  25.     register_cvar( "Top 3 VIP (Sql)", "By Demon", FCVAR_SERVER );
  26.    
  27.     if ( InitSQL( ) )
  28.     {
  29.         Load( );
  30.        
  31.         register_concmd( "say /ptop15", "cmdPTop15" );
  32.         register_concmd( "say /prank", "cmdPRank" );
  33.         register_concmd( "say /pontok", "cmdMyPoints" );
  34.         register_concmd( "say_team /ptop15", "cmdPTop15" );
  35.         register_concmd( "say_team /prank", "cmdPRank" );
  36.         register_concmd( "say_team /pontok", "cmdMyPoints" );
  37.        
  38.         register_event( "DeathMsg", "onDeath", "a" );
  39.        
  40.         set_task( 60.0, "Check", 56789, _, _, "b" );
  41.         set_task( 180.0, "Advertising", 98765, _, _, "b" );
  42.     }
  43. }
  44.  
  45. public cmdPTop15( iPlayerId ) { LoadDatas( iPlayerId, 3 ); }
  46. public cmdPRank( iPlayerId ) { LoadDatas( iPlayerId, 2 ); }
  47. public cmdMyPoints( iPlayerId ) { client_print_color( iPlayerId, iPlayerId, "^4[%s] ^1Pontjaid száma: ^3%d^1.", g_sPrefix, g_iPoints[ iPlayerId ] ); }
  48.  
  49. InitSQL( )
  50. {
  51.     g_hSqlTuple = SQL_MakeDbTuple( g_sSQLInfos[ 0 ], g_sSQLInfos[ 1 ], g_sSQLInfos[ 2 ], g_sSQLInfos[ 3 ] );
  52.    
  53.     if( g_hSqlTuple == Empty_Handle ) return -1;
  54.    
  55.     new iError, sError[ 128 ];
  56.     new Handle: hDb = SQL_Connect( g_hSqlTuple, iError, sError, charsmax( sError ) );
  57.    
  58.     if( hDb == Empty_Handle )
  59.     {
  60.         log_amx( "Nem lehet csatlakozni az adatbazishoz: (%d) %s", iError, sError );
  61.         return -1;
  62.     }
  63.    
  64.     new Handle: hQuery = SQL_PrepareQuery( hDb, "CREATE TABLE IF NOT EXISTS `point_system` (`authid` varchar(32) NOT NULL PRIMARY KEY, `username` varchar(32) NOT NULL, `points` INT(11) NOT NULL);" );
  65.    
  66.     if( !SQL_Execute( hQuery ) )
  67.     {
  68.         SQL_QueryError( hQuery, sError, charsmax( sError ) );
  69.         log_amx( "Tabla letrehozas sikertelen: %s", sError );
  70.         return -1;
  71.     }
  72.    
  73.     SQL_FreeHandle( hQuery );
  74.     SQL_FreeHandle( hDb );
  75.     return 1;
  76. }
  77.  
  78. public SaveDatas( iPlayerId, iMode )
  79. {
  80.     static sText[ 512 ], sName[ 32 ];
  81.     get_user_name( iPlayerId, sName, charsmax( sName ) );
  82.     MakeStringSQLSafe( sName, charsmax( sName ) );
  83.    
  84.     if ( iMode == 1 ) formatex( sText, charsmax( sText ), "REPLACE INTO `point_system` (`authid`,`username`,`points`) VALUES (^"%s^", ^"%s^", %d);", g_sAuthId[ iPlayerId ], sName, g_iPoints[ iPlayerId ] );
  85.     else
  86.     {
  87.         arrayset( g_iPoints, 0, sizeof( g_iPoints ) );
  88.         formatex( sText, charsmax( sText ), "TRUNCATE `point_system`;" );
  89.     }
  90.    
  91.     SQL_ThreadQuery( g_hSqlTuple, "ThreadHandler", sText, { 0 }, 1 );
  92. }
  93.  
  94. public LoadDatas( iPlayerId, iMode )
  95. {
  96.     static sText[ 128 ], iArray[ 1 ];
  97.     iArray[ 0 ] = iPlayerId;
  98.    
  99.     switch( iMode )
  100.     {
  101.         case 1: formatex( sText, charsmax( sText ), "SELECT `points` FROM `point_system` WHERE `authid` = ^"%s^";", g_sAuthId[ iPlayerId ] );
  102.         case 2:
  103.         {
  104.             iArray[ 0 ] += 100;
  105.             formatex( sText, charsmax( sText ), "SELECT COUNT(*) AS players, rank.num AS prank FROM `point_system`, (SELECT COUNT(*) AS num FROM `point_system` WHERE `points` > %d ) AS rank;", g_iPoints[ iPlayerId ] );
  106.         }
  107.         case 3:
  108.         {
  109.             iArray[ 0 ] += 200;
  110.             formatex( sText, charsmax( sText ), "SELECT `points`, `username` FROM `point_system` ORDER BY `points` DESC LIMIT 15;" );
  111.         }
  112.         case 4:
  113.         {
  114.             iArray[ 0 ] = 300;
  115.             formatex( sText, charsmax( sText ), "SELECT `authid`, `username` FROM `point_system` ORDER BY `points` DESC LIMIT 3;" );
  116.         }
  117.     }
  118.     SQL_ThreadQuery( g_hSqlTuple, "ThreadHandler", sText, iArray, sizeof ( iArray ) );
  119. }
  120.  
  121. public ThreadHandler( iFailState, Handle: hQuery, const sError[ ], iError, const iARRAY[ ], iArraySize, Float: fQueueTime )
  122. {
  123.     switch( iFailState )
  124.     {
  125.         case TQUERY_CONNECT_FAILED:
  126.         {
  127.             log_amx( "Nem lehet csatlakozni az adatbazishoz: (%d) %s", iError, sError );
  128.             set_fail_state( "Nem lehet csatlakozni az adatbazishoz: (%d) %s", iError, sError );
  129.         }
  130.         case TQUERY_QUERY_FAILED:
  131.         {
  132.             log_amx( "Hibas lekerdezes: (%d) %s", iError, sError );
  133.             return;
  134.         }
  135.     }
  136.    
  137.     new iPlayerId = iARRAY[ 0 ];
  138.     if ( iPlayerId )
  139.     {
  140.         if ( iPlayerId < 100 )
  141.         {
  142.             if ( SQL_NumResults( hQuery ) > 0 )
  143.                 g_iPoints[ iPlayerId ] = SQL_ReadResult( hQuery, SQL_FieldNameToNum( hQuery, "points" ) );
  144.         }
  145.         else if ( iPlayerId < 200 )
  146.         {
  147.             iPlayerId -= 100;
  148.             new iRank = SQL_ReadResult( hQuery, SQL_FieldNameToNum( hQuery, "prank" ) );
  149.             new iPlayers = SQL_ReadResult( hQuery, SQL_FieldNameToNum( hQuery, "players" ) );
  150.             client_print_color( iPlayerId, iPlayerId, "^4[%s] ^1Te pont rankod ^3%d ^1a ^3%d^1-ból/bÅ‘l ^3%d ^1ponttal.", g_sPrefix, iRank == 0 ? 1 : iRank, iPlayers == 0 ? 1 : iPlayers, g_iPoints[ iPlayerId ] );
  151.         }
  152.         else if ( iPlayerId < 300 )
  153.         {
  154.             static iLen, sMotd[ 2048 ], sName[ 32 ], i, iPoints, iMLen = charsmax( sMotd );
  155.             iLen = 0;
  156.            
  157.             iPlayerId -= 200;
  158.        
  159.             iLen = formatex( sMotd, iMLen, "<meta charset=utf-8><body bgcolor=#000000><font color=#FFB000><pre>" );
  160.             iLen += formatex( sMotd[ iLen ], iMLen - iLen, "%2s %-22.22s %6s^n", "#", "Név", "Pont" );
  161.            
  162.             i = 1;
  163.             while ( SQL_MoreResults( hQuery ) )
  164.             {
  165.                 SQL_ReadResult( hQuery, SQL_FieldNameToNum( hQuery, "username" ), sName, charsmax( sName ) );
  166.                 iPoints = SQL_ReadResult( hQuery, SQL_FieldNameToNum( hQuery, "points" ) );
  167.                 switch ( i )
  168.                 {
  169.                     case 1: iLen += formatex( sMotd[iLen], iMLen - iLen, "<font color=ff0bb7>%2d %-22.22s %d</font>^n", i, sName, iPoints );
  170.                     case 2: iLen += formatex( sMotd[iLen], iMLen - iLen, "<font color=#07fcff>%2d %-22.22s %d</font>^n", i, sName, iPoints );
  171.                     case 3: iLen += formatex( sMotd[iLen], iMLen - iLen, "<font color=#0BF402>%2d %-22.22s %d</font>^n", i, sName, iPoints );
  172.                     default: iLen += formatex( sMotd[iLen], iMLen - iLen, "%2d %-22.22s %d^n", i, sName, iPoints );
  173.                 }
  174.                
  175.                 ++i;  
  176.                 SQL_NextRow( hQuery );
  177.             }
  178.            
  179.             show_motd( iPlayerId, sMotd, "Pont TOP15" );
  180.         }
  181.         else
  182.         {
  183.             new sFile[ 64 ] = "addons/amxmodx/configs/users.ini";
  184.             new pFile = fopen( sFile, "rt" );
  185.            
  186.             if ( pFile )
  187.             {  
  188.                 new sNewLine[ 128 ], i = 1, sName[ 32 ], sAuthId[ 32 ];
  189.                 write_file( sFile, "; VIP rendszer által sorsolt VIP tagok: ", 0 );
  190.                 if ( SQL_NumResults( hQuery ) > 0 )
  191.                 {
  192.                     while ( SQL_MoreResults( hQuery ) )
  193.                     {
  194.                         SQL_ReadResult( hQuery, SQL_FieldNameToNum( hQuery, "username" ), sName, charsmax( sName ) );
  195.                         SQL_ReadResult( hQuery, SQL_FieldNameToNum( hQuery, "authid" ), sAuthId, charsmax( sAuthId ) );
  196.                        
  197.                         formatex( sNewLine, charsmax( sNewLine ), "^"%s^" ^"^" ^"%s^" ^"ce^" //%s", sAuthId, FLAGS, sName );
  198.                         write_file( sFile, sNewLine, i );
  199.                         client_print_color( 0, print_team_default, "^4[%s] ^3%s VIP tagságban részesültélt mivel benne van a PTOP3-ban (rankja: ^4PTOP%d^3).", g_sPrefix, sName, i );
  200.                        
  201.                         ++i;
  202.                        
  203.                         SQL_NextRow( hQuery );
  204.                     }
  205.                 }
  206.                 else
  207.                 {
  208.                     write_file( sFile, "", 1 );
  209.                     write_file( sFile, "", 2 );
  210.                     write_file( sFile, "", 3 );
  211.                 }
  212.                 Save( );
  213.                 server_cmd( "amx_reloadadmins" );
  214.                 SaveDatas( 0, 2 );
  215.                 if ( task_exists( 56789 ) ) remove_task( 56789 );
  216.                
  217.                 fclose( pFile );
  218.             }
  219.         }
  220.     }
  221.    
  222.     return;
  223. }
  224.  
  225. public client_putinserver( iPlayerId )
  226. {
  227.     g_iPoints[ iPlayerId ] = 0;
  228.     g_sAuthId[ iPlayerId ][ 0 ] = EOS;
  229.    
  230.     if ( is_user_bot( iPlayerId ) || is_user_hltv( iPlayerId ) ) return;
  231.    
  232.     get_user_authid( iPlayerId, g_sAuthId[ iPlayerId ], charsmax( g_sAuthId[ ] ) );
  233.    
  234.     LoadDatas( iPlayerId, 1 );
  235. }
  236.  
  237. public Advertising( )
  238. {
  239.     static iAdv = -1;
  240.     ++iAdv;
  241.     switch( iAdv )
  242.     {
  243.         case 0: client_print_color( 0, print_team_default, "^4[%s] ^3Minden hónap 1. napján a PTOP3 játékos VIP tagságban részesül.", g_sPrefix );
  244.         case 1:
  245.         {
  246.             static sMonth[ 5 ], sDay[ 5 ], sYear[ 7 ], iMonth, iDay, iYear;
  247.             get_time( "%d", sDay, charsmax( sDay )  );
  248.             get_time( "%m", sMonth, charsmax( sMonth ) );
  249.             get_time( "%Y", sYear, charsmax( sYear ) );
  250.            
  251.             iMonth = str_to_num( sMonth );
  252.             iDay = str_to_num( sDay );
  253.             iYear = str_to_num( sYear );
  254.            
  255.             client_print_color( 0, print_team_default, "^4[%s] ^1Még ^3%d nap ^1van a következÅ‘ VIP sorsolásig.", g_sPrefix, ( GetDaysInMonth( iMonth, iYear ) - iDay ) );
  256.         }
  257.         case 2: client_print_color( 0, print_team_default, "^4[%s] ^1A pont rankod megtekintéséhez í­rd be, hogy ^3/prank^1.", g_sPrefix );
  258.         case 3: client_print_color( 0, print_team_default, "^4[%s] ^1A Pont TOP15 megtekintéséhez í­rd be, hogy ^3/ptop15^1.", g_sPrefix );
  259.         default: iAdv = -1;
  260.     }
  261. }
  262.  
  263. public onDeath( )
  264. {
  265.     new iKiller = read_data( 1 );
  266.    
  267.     if ( is_user_bot( iKiller ) ) return;
  268.    
  269.     new iVictim = read_data( 2 );
  270.     new iHs = read_data( 3 );
  271.     new bTK = get_user_team( iKiller ) == get_user_team( iVictim );
  272.     new sWpn[ 3 ];
  273.     read_data( 4, sWpn, charsmax( sWpn ) );
  274.    
  275.     if ( iKiller != iVictim )
  276.     {
  277.         if ( !bTK && !iHs && sWpn[ 1 ] != 'r' && sWpn[ 0 ] != 'k' ) g_iPoints[ iKiller ] += 1;
  278.         else if ( !bTK && ( iHs || sWpn[ 1 ] == 'r' || sWpn[ 0 ] == 'k' ) ) g_iPoints[ iKiller ] += 2;
  279.        
  280.         SaveDatas( iKiller, 1 );
  281.     }
  282. }
  283.  
  284. public Check( )
  285. {  
  286.     static sDay[ 5 ], sMonth[ 5 ], iDay, iMonth;
  287.     get_time( "%d", sDay, charsmax( sDay ) );
  288.     get_time( "%m", sMonth, charsmax( sMonth ) );
  289.    
  290.     iDay = str_to_num( sDay );
  291.     iMonth = str_to_num( sMonth );
  292.    
  293.     if ( iDay > 1 )
  294.         if ( task_exists( 56789 ) ) remove_task( 56789 );
  295.    
  296.     if ( iMonth == g_iSavedMonth || iDay != 1 ) return;
  297.     LoadDatas( 0, 4 );
  298. }
  299.  
  300. public Save( )
  301. {
  302.     new sMonth[ 5 ], iMonth, sFile[ 200 ], sNewLine[ 16 ];
  303.     get_time( "%m", sMonth, charsmax( sMonth ) );
  304.            
  305.     iMonth = g_iSavedMonth = str_to_num( sMonth );
  306.    
  307.     format( sFile, charsmax( sFile ), "addons/amxmodx/configs/pontrendszer_by_demon", sFile);
  308.  
  309.     if ( !dir_exists( sFile ) ) mkdir( sFile );
  310.    
  311.     format( sFile, 199, "%s/honap.txt", sFile );
  312.    
  313.     formatex( sNewLine, charsmax( sNewLine ), "^"%d^"", iMonth );
  314.     write_file( sFile, sNewLine, 0 );
  315. }
  316.  
  317. public Load( )
  318. {
  319.     new pFile  = fopen( "addons/amxmodx/configs/pontrendszer_by_demon/honap.txt", "rt" );
  320.    
  321.     if ( pFile )
  322.     {
  323.         new sLine[ 8 ];
  324.         fgets( pFile, sLine, charsmax( sLine ) );
  325.        
  326.         trim( sLine );
  327.         remove_quotes( sLine );
  328.         g_iSavedMonth = str_to_num( sLine );
  329.        
  330.         fclose( pFile );
  331.     }
  332.     else g_iSavedMonth = 0;
  333. }
  334.  
  335. public plugin_end( ) { SQL_FreeHandle( g_hSqlTuple ); }
  336.  
  337. stock GetDaysInMonth( iMonth, iYear )
  338. {
  339.     switch( iMonth )
  340.     {
  341.         case 1, 3, 5, 7, 8, 10, 12: return 31;
  342.         case 2: return ( ( iYear % 4 ) == 0 ) ? 29 : 28;
  343.     }
  344.     return 30;
  345. }
  346.  
  347. stock MakeStringSQLSafe( sName[ ], iLen )
  348. {
  349.     replace_all( sName, iLen, "'", "*" );
  350.     replace_all( sName, iLen, "^"", "*" );
  351.    replace_all( sName, iLen, "`", "*" );
  352. }

esetleg ?

Mindig fent ál a probléma
viprendszer.sma(19) : error 017: undefined symbol "MAX_PLAYERS"
viprendszer.sma(46) : error 017: undefined symbol "client_print_color"
viprendszer.sma(86) : warning 224: indeterminate array size in "sizeof" expression (symbol "")
viprendszer.sma(127) : error 088: number of arguments does not match definition
viprendszer.sma(149) : error 017: undefined symbol "client_print_color"
viprendszer.sma(198) : error 017: undefined symbol "client_print_color"
viprendszer.sma(198) : warning 215: expression has no effect
viprendszer.sma(198) : warning 215: expression has no effect
viprendszer.sma(198) : warning 215: expression has no effect
viprendszer.sma(198) : warning 215: expression has no effect
viprendszer.sma(198) : error 001: expected token: ";", but found ")"
viprendszer.sma(198) : error 029: invalid expression, assumed zero
viprendszer.sma(198) : fatal error 107: too many error messages on one line

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Vip plugin hiba (plugin by demon)
HozzászólásElküldve: 2017.08.02. 13:41 
Offline
Félisten
Avatar

Csatlakozott: 2015.03.12. 18:30
Hozzászólások: 975
Megköszönt másnak: 67 alkalommal
Megköszönték neki: 136 alkalommal
Idézet:
Welcome to the AMX Mod X 1.8.1-300 Compiler

_________________
Fórumi aktivitásom véget ért: 2017.09.07.
Innentől esetleg steamen vagyok elérhető.

Ők köszönték meg kengurumancs nek ezt a hozzászólást: ultraibolya (2017.08.02. 13:53)
  Népszerűség: 2.27%


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  [ 10 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 11 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