[HELP] Little problem
#1

I created a ban system with SQLite, however the CheckBan don't work.

PS: I put in OnPlayerConnect!!!

Code:

pawn Код:
CheckBan(playerid)
{
    new DBResult:Resultado,
        Query[200],
        pIp[25]
    ;
    GetPlayerIp(playerid, pIp, sizeof(pIp));
    format(Query,sizeof(Query),"SELECT * FROM `Banidos` WHERE `IP` = '%s'", pIp);
    Resultado = db_query(Handle, Query);
    if(db_num_rows(Resultado) != 0)
    {
        SendClientMessage(playerid,Amarelo,"SERVER:"intBranco" Vocк estб banido do servidor!");
        new str[150],
            Campo[50]
        ;
        db_get_field_assoc(Resultado,"Motivo",Campo,50);
        format(pInfo[playerid][pBanMotivo],50, Campo);
        db_get_field_assoc(Resultado,"Admin",Campo,50);
        format(pInfo[playerid][pBanAdmin],25, Campo);
        db_get_field_assoc(Resultado,"DiaMesAno",Campo,50);
        format(pInfo[playerid][pBanData],30, Campo);
        db_get_field_assoc(Resultado,"HoraMinutoSegundo",Campo,50);
        format(pInfo[playerid][pBanHora],30, Campo);
        format(str,sizeof(str),"SERVER:"intBranco"Informaзхes: | Motivo: %s | Data: %s | Hora: %s | Admin: %s",
            pInfo[playerid][pBanMotivo],
            pInfo[playerid][pBanData],
            pInfo[playerid][pBanHora],
            pInfo[playerid][pBanAdmin]
            );
        SendClientMessage(playerid,Amarelo,str);
        SendClientMessage(playerid,-1,"Nosso site: www.site.com/forum");
        Kick(playerid);
    }
    db_free_result(Resultado);
    return 1;
}
Please, someone help me!
I've tried everything.

When I enter the server nothing happens
Reply
#2

There are cases reported where checking the IP does not work in OnPlayerConnect (and OnPlayerDisconnect). Also, most of the times when you kick someone in OnPlayerConnect it just says that it lost connection to the server and retries to join it.

To be sure if a player is banned (I think that is what you are checking but I have no idea because my (Spanish?) isn't ......... well, I don't speak (Spanish?) at all..) and keeping him away from the server, put this code in either a timer or in OnPlayerRequestClass (which they are bound to end up when they are done with OnPlayerConnect)
Reply
#3

I need a Translator to fix that code Translate it if you please and i ll fix the code and about OnPlayerConnect thing well as all the registering systems and login system , admin systems etc.. check if the user exists and loads / registers an account its all under the player connect function so its not related either by OnPlayerConnect or OnPlayerDisconnect because all in all it has to be saved in the account's file that a variable called PlayerBanned(as an example) equals to 0 if he is not banned and 1 if he is so he gets banned the variable in his profile automatically turns out to be 1 so he logs in with this account its blocked and about the ip the profile of the player has to inculde the GetPlayerIp Feature so as the same time his account gets banned his retrieved ip from this account gets banned as well so its a range ban.. i hope you got it
Reply
#4

Quote:
Originally Posted by CROSS_Hunter
Посмотреть сообщение
I need a Translator to fix that code Translate it if you please and i ll fix the code and about OnPlayerConnect thing well as all the registering systems and login system , admin systems etc.. check if the user exists and loads / registers an account its all under the player connect function so its not related either by OnPlayerConnect or OnPlayerDisconnect because all in all it has to be saved in the account's file that a variable called PlayerBanned(as an example) equals to 0 if he is not banned and 1 if he is so he gets banned the variable in his profile automatically turns out to be 1 so he logs in with this account its blocked and about the ip the profile of the player has to inculde the GetPlayerIp Feature so as the same time his account gets banned his retrieved ip from this account gets banned as well so its a range ban.. i hope you got it
Holy hell, dude! Punctuation exists for a reason + that I needed a translator for THAT response
Reply
#5

Quote:
Originally Posted by mamorunl
Посмотреть сообщение
Holy hell, dude! Punctuation exists for a reason + that I needed a translator for THAT response
my bad.. i was in a hurry Sorry
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)