Jump to content

[REZOLVAT] Gamemode Burned - Big edit


Fuhrer
 Share

Recommended Posts

Salutare ! Cum aș putea să adaug la funcțiile administratorilor să-mi adauge în staff_logs, comenzile pe care le scriu să se bage în baza de date? Că văd că nu are așa ceva. Mulțumesc !

Link to comment
Share on other sites

Dupa fiecare comanda de admin folosita, trimiti un query in baza de date:

INSERT INTO `staff_logs` (Variabilele tale) VALUES (Valorile tale)

Respecta si vei fi respectat.

 

BigInt Pawn:

Pacman C++: 

Snake C++:

Minesweeper C++:

 

mattbb.cash

leaks.ro

Link to comment
Share on other sites

  • Administrator

Formatezi un mesaj si il inserezi in baza de date.

new string[ 128 ], query[ 128 ]; // variabile pt mesaj si interogare.

format( string, sizeof string, "aici vine mesaju" ); // mesaj formatat

format( query, sizeof query, "INSERT INTO `staff_logs` (`Text`) VALUES ('%s')", string ); // interogare formatata
mysql_tquery( SQL, query ); // interogare

De aici te descurci si singur.

Link to comment
Share on other sites

Formatezi un mesaj si il inserezi in baza de date.

new string[ 128 ], query[ 128 ]; // variabile pt mesaj si interogare.

format( string, sizeof string, "aici vine mesaju" ); // mesaj formatat

format( query, sizeof query, "INSERT INTO `staff_logs` (`Text`) VALUES ('%s')", string ); // interogare formatata
mysql_tquery( SQL, query ); // interogare

De aici te descurci si singur.

 

Dacă nu te superi, poți să-mi faci comanda cum ar veni adăugată în comanda setadmin? Că n-am mai adăugat până acum..

Link to comment
Share on other sites

  • Administrator

@@Fuhrer poftim:

YCMD:setadmin( playerid, params[], help ) {
    if( PlayerInfo[ playerid ][ pAdmin ] < 6 )
        return SCM( playerid, COLOR_WHITE, AdminOnly );

    new userID, level;
    if( sscanf( params, "ui", userID, level ) )
        return SCM( playerid, COLOR_GREY, "Usage: {FFFFFF}/setadmin <playerid/name> <level>" );

    if( !IsPlayerConnected( userID ) || userID == INVALID_PLAYER_ID )
        return SCM( playerid, COLOR_GREY, "Eroare: Invalid playerid/name." );

    if( level < 0 || level > 8 )
        return SCM( playerid, COLOR_GREY, "Eroare: Invalid admin leve. ( 1 - 8, 0 = remove )" );

    if( PlayerInfo[ userID ][ pAdmin ] > PlayerInfo[ playerid ][ pAdmin ] )
        return SCM( playerid, COLOR_GREY, "Eroare: Acel jucator are un admin mai mare decat al tau." );

    promotePlayerToAdmin( playerid, userID, level );

    return true;
}

function promotePlayerToAdmin( playerid, userID, level ) {
    if( level > PlayerInfo[ userID ][ pAdmin ] ) 
        SCMF( userID, COLOR_YELLOW, "* Felicitari, ai fost promovat la admin nivel %d de catre administratorul %s.", level, GetName( playerid ) );

    else if( level < PlayerInfo[ userID ][ pAdmin ] && level != 0 ) 
        SCMF( userID, COLOR_YELLOW, "* Ai fost retrogradat din functia de admin nivel %d la admin nivel %d de catre administratorul %s.", PlayerInfo[ userID ][ pAdmin ], level, GetName( playerid ) );
    
    else if( level == 0 ) 
        SCMF( userID, COLOR_YELLOW, "* Ai fost exclus din Echipa Staff a server-ului Ryse de catre administratorul %s.", GetName( playerid ) );

    if(level) Iter_Add( PlayerAdmins, userID );
    else removePlayerAdmin( userID );
    
    PlayerInfo[ userID ][ pAdmin ] = level;
    finishAchievement( userID, 27 );

    new string[ 128 ];

    format( string, sizeof string, "(AdminInfo): {FFFFFF}%s a fost promovat la admin nivel %d de catre administratorul %s.", GetName( userID ), level, GetName( playerid ) );
    SendAdminHelperMessage( COLOR_LOGS, string );

    SCMF( playerid, COLOR_YELLOW, "* I-ai setat lui %s nivelul de admin la %d.", GetName( userID ), level);

    new gQuery[ 128 ];
    mysql_format( SQL, gQuery, sizeof gQuery, "UPDATE `users` SET `Admin` = '%d WHERE `ID` = '%d'", PlayerInfo[ userID ][ pAdmin ], PlayerInfo[ userID ][ pSQLID ] );
    mysql_tquery( SQL, gQuery, "", "" );

    format( string, sizeof string, "* Jucatorul %s a fost promovat la admin nivel %d de catre administratorul %s. ", GetName( userID ), level, GetName( playerid ) );

    mysql_format( SQL, gQuery, sizeof gQuery, "INSERT INTO `server_staff_logs` (`Text`) VALUES ('%s')", string );
    mysql_tquery( SQL, gQuery, "", "" ); 

    return true;
}

function removePlayerAdmin( userID ) {
    PlayerInfo[ userID ][pAW] = 0;
    SpecFaction[ userID ] = 0;
    StopFly( userID );
    UsedFly[ userID ] = 0;
    SetPlayerHealthEx( userID, 99.0 );

    Iter_Remove( PlayerAdmins, userID );  

    new gQuery[ 128 ];
    mysql_format( SQL, gQuery, sizeof gQuery, "UPDATE `users` SET `AW` = '%d WHERE `ID` = '%d'", PlayerInfo[ userID ][pAW], PlayerInfo[ userID ][ pSQLID ] );
    mysql_tquery( SQL, gQuery, "", "" );

    return true;
}
Link to comment
Share on other sites

 

@@Fuhrer poftim:

YCMD:setadmin( playerid, params[], help ) {
    if( PlayerInfo[ playerid ][ pAdmin ] < 6 )
        return SCM( playerid, COLOR_WHITE, AdminOnly );

    new userID, level;
    if( sscanf( params, "ui", userID, level ) )
        return SCM( playerid, COLOR_GREY, "Usage: {FFFFFF}/setadmin <playerid/name> <level>" );

    if( !IsPlayerConnected( userID ) || userID == INVALID_PLAYER_ID )
        return SCM( playerid, COLOR_GREY, "Eroare: Invalid playerid/name." );

    if( level < 0 || level > 8 )
        return SCM( playerid, COLOR_GREY, "Eroare: Invalid admin leve. ( 1 - 8, 0 = remove )" );

    if( PlayerInfo[ userID ][ pAdmin ] > PlayerInfo[ playerid ][ pAdmin ] )
        return SCM( playerid, COLOR_GREY, "Eroare: Acel jucator are un admin mai mare decat al tau." );

    promotePlayerToAdmin( playerid, userID, level );

    return true;
}

function promotePlayerToAdmin( playerid, userID, level ) {
    if( level > PlayerInfo[ userID ][ pAdmin ] ) 
        SCMF( userID, COLOR_YELLOW, "* Felicitari, ai fost promovat la admin nivel %d de catre administratorul %s.", level, GetName( playerid ) );

    else if( level < PlayerInfo[ userID ][ pAdmin ] && level != 0 ) 
        SCMF( userID, COLOR_YELLOW, "* Ai fost retrogradat din functia de admin nivel %d la admin nivel %d de catre administratorul %s.", PlayerInfo[ userID ][ pAdmin ], level, GetName( playerid ) );
    
    else if( level == 0 ) 
        SCMF( userID, COLOR_YELLOW, "* Ai fost exclus din Echipa Staff a server-ului Ryse de catre administratorul %s.", GetName( playerid ) );

    if(level) Iter_Add( PlayerAdmins, userID );
    else removePlayerAdmin( userID );
    
    PlayerInfo[ userID ][ pAdmin ] = level;
    finishAchievement( userID, 27 );

    new string[ 128 ];

    format( string, sizeof string, "(AdminInfo): {FFFFFF}%s a fost promovat la admin nivel %d de catre administratorul %s.", GetName( userID ), level, GetName( playerid ) );
    SendAdminHelperMessage( COLOR_LOGS, string );

    SCMF( playerid, COLOR_YELLOW, "* I-ai setat lui %s nivelul de admin la %d.", GetName( userID ), level);

    new gQuery[ 128 ];
    mysql_format( SQL, gQuery, sizeof gQuery, "UPDATE `users` SET `Admin` = '%d WHERE `ID` = '%d'", PlayerInfo[ userID ][ pAdmin ], PlayerInfo[ userID ][ pSQLID ] );
    mysql_tquery( SQL, gQuery, "", "" );

    format( string, sizeof string, "* Jucatorul %s a fost promovat la admin nivel %d de catre administratorul %s. ", GetName( userID ), level, GetName( playerid ) );

    mysql_format( SQL, gQuery, sizeof gQuery, "INSERT INTO `server_staff_logs` (`Text`) VALUES ('%s')", string );
    mysql_tquery( SQL, gQuery, "", "" ); 

    return true;
}

function removePlayerAdmin( userID ) {
    PlayerInfo[ userID ][pAW] = 0;
    SpecFaction[ userID ] = 0;
    StopFly( userID );
    UsedFly[ userID ] = 0;
    SetPlayerHealthEx( userID, 99.0 );

    Iter_Remove( PlayerAdmins, userID );  

    new gQuery[ 128 ];
    mysql_format( SQL, gQuery, sizeof gQuery, "UPDATE `users` SET `AW` = '%d WHERE `ID` = '%d'", PlayerInfo[ userID ][pAW], PlayerInfo[ userID ][ pSQLID ] );
    mysql_tquery( SQL, gQuery, "", "" );

    return true;
}

 

 

Îmi dă aceste erori la compilare:

D:\Gamemodes\Burned\Burned\gamemodes\gmm.pwn(18068) : error 017: undefined symbol "SCMF"
D:\Gamemodes\Burned\Burned\gamemodes\gmm.pwn(18071) : error 017: undefined symbol "SCMF"
D:\Gamemodes\Burned\Burned\gamemodes\gmm.pwn(18074) : error 017: undefined symbol "SCMF"
D:\Gamemodes\Burned\Burned\gamemodes\gmm.pwn(18087) : error 017: undefined symbol "SCMF"
Pawn compiler 3.10.6	 	 	Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
[Finished in 3.0s]
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...