SA-MP Forums Archive
Ban problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Ban problem (/showthread.php?tid=519293)



Ban problem - ShoortyFl - 13.06.2014

So i'm creating ban system, and it wont load the data.

So thiis are the codes:


ban command:

pawn Код:
CMD:ban(playerid, params[])
{
    new id, razlog[128], str[255], escaped[128];
    if(PI[playerid][Admin] == 0) return SCM(playerid, RED, " (greska) {FFFFFF}Nemate ovlastenje za koristenje ove komande !");
    if(sscanf(params, "us[128]", id, razlog)) return SCM(playerid, GREY, "Koristite: /ban [ID Igraca / Deo Imena] [Razlog]");
    if(!IsPlayerConnected(id)) return SCM(playerid, RED, " (greska) {FFFFFF}Taj igrac nije u igri !");
   
    format(str, sizeof(str), "AdmCmd: %s je banovao igraca %s, razlog: %s", ImeIgraca(playerid), ImeIgraca(id), razlog);
    SendClientMessageToAll(TOMATO, str);
   
    mysql_real_escape_string(razlog, escaped);
    BanujIgraca(id, playerid, escaped);
    KikujIgraca(id);
    return 1;
}
Banning Stock:

pawn Код:
stock BanujIgraca(playerid, adminid, razlog[])
{
    new escaped[128], query[255], ip[17];
    mysql_real_escape_string(razlog, escaped);
   
    GetPlayerIp(playerid, ip, sizeof(ip));
   
    format(BInfo[playerid][Admin], 32, "%s", ImeIgraca(adminid));
    format(BInfo[playerid][Razlog], 32, "%s", escaped);
    format(BInfo[playerid][Vreme], 32, "%s", TimeDate());
   
    PI[playerid][Banovan] = 1;
   
    format(query, sizeof(query), "INSERT INTO `Banovi` (`Igrac`, `Admin`, `Razlog`, `Vreme`, `IP`) VALUES ('%s', '%s', '%s', '%s', '%s')", ImeIgraca(playerid), ImeIgraca(adminid), escaped, TimeDate(), ip);
    mysql_function_query(konekt, query, true, "OnQueryFinish", "ii", THREAD_OSTALO, playerid);
   
    format(query, sizeof(query), "INSERT INTO `banlog` (`Admin`, `Igrac`, `Razlog`, `Vreme`) VALUES ('%s', '%s', '%s', '%s')", ImeIgraca(playerid), ImeIgraca(adminid), escaped, TimeDate());
    mysql_function_query(konekt, query, true, "OnQueryFinish", "i", THREAD_OSTALO);
    return KikujIgraca(playerid);
}
This is the thread for loading user data

pawn Код:
if(szRows)
            {
                cache_get_field_content(0, "Lozinka", temp);
                format(PI[extraid][Lozinka], 129, "%s", temp);
               
                cache_get_field_content(0, "Email", temp);
                format(PI[extraid][Email], 50, temp);
               
                cache_get_field_content(0, "Spol", temp);
                PI[extraid][Spol] = strval(temp);
               
                cache_get_field_content(0, "Godine", temp);
                PI[extraid][Godine] = strval(temp);
               
                cache_get_field_content(0, "Skin", temp);
                PI[extraid][Skin] = strval(temp);
               
                cache_get_field_content(0, "Admin", temp);
                PI[extraid][Admin] = strval(temp);
               
                cache_get_field_content(0, "Banovan", temp);
                PI[extraid][Banovan] = strval(temp);
               
                format(str2, sizeof(str2), "{C3C3C3}Unesite vasu loznku kako biste se prijavili na vas racun.\nImate 60 sekundi da se prijavite.\nNapomena: Molimo vas da nikome ne dajete vasu lozinku !");
                SPD(extraid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Prijava", str2, "Prijava", "Izlaz");
            }
for login:

pawn Код:
UlogujIgraca(playerid)
{
    new str[259];
    SetSpawnInfo(playerid, 0, PI[playerid][Skin], 1765.2643, -1342.9196, 15.7564, 242.7716, 0, 0, 0, 0, 0, 0);
    SpawnPlayer(playerid);
    TogglePlayerSpectating(playerid, false);
    TextDrawHideForPlayer(playerid, lbt);
    TextDrawHideForPlayer(playerid, lbb);
   
    if(PI[playerid][Banovan] == 1)
    {
        new tquer[220];
        format(tquer, sizeof(tquer), "SELECT * FROM `Banovi` WHERE `Ime` = '%s'", ImeIgraca(playerid));
        mysql_function_query(konekt, tquer, true, "OnQueryFinish", "ii", THREAD_BANINFO, playerid);
        return 1;
    }
   
    OcistiChat(playerid, 50);
    format(str, sizeof(str), "Dobrodosli nazad na {FFFF00}Roleplay Factory{FFFFFF} %s, lepo vas je opet videti na serveru !", ImeIgraca(playerid));
    SCM(playerid, WHITE, str);
    return 1;
}
Baninfo thread

pawn Код:
if(szRows)
            {
                cache_get_field_content(0, "Admin", temp);
                format(BInfo[extraid][Admin], 24, "%s", temp);
               
                cache_get_field_content(0, "Razlog", temp);
                format(BInfo[extraid][Razlog], 32, "%s", temp);
               
                cache_get_field_content(0, "Vreme", temp);
                format(BInfo[extraid][Vreme], 32, "%s", temp);
               
                OcistiChat(extraid, 20);
                SCM(extraid, GOLD, " * Informacije o banovanom profilu ----- :");
                SCMF(extraid, WHITE, " - Vase Ime: %s", ImeIgraca(extraid));
                SCMF(extraid, WHITE, " - Ban Dao: %s", BInfo[extraid][Admin]);
                SCMF(extraid, WHITE, " - Razlog: %s", BInfo[extraid][Razlog]);
                SCMF(extraid, WHITE, " - Vreme Bana: %s", BInfo[extraid][Vreme]);
            }



Re: Ban problem - ShoortyFl - 13.06.2014

Anyone ?