SA-MP Forums Archive
[Help] Mysql. - 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: [Help] Mysql. (/showthread.php?tid=566546)



[Help] Mysql. - KingPersona - 06.03.2015

Hello

i need help , i want change this command in mysql r39-2 , this cmds is mysql R7

pawn Код:
CMD:offjail(playerid, params[]){
    new targetName[MAX_PLAYER_NAME],reason[32],menit,querySz[384];
    if(playerVariables[playerid][pAdminLevel] >= 2)
    {
        if(sscanf(params,"s[128]ds[32]",targetName,menit,reason)) return SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/offjail [playername] [menit] [reason]");
        format(szMessage, sizeof(szMessage), "%s telah di jail (offline) oleh %s untuk %d menit, reason : %s", targetName,GetPlayerNameEx(playerid),menit, reason);
        submitToAdmins(szMessage,COLOR_LIGHTRED);
        mysql_real_escape_string(targetName, targetName);
        format(querySz, sizeof(querySz), "UPDATE playeraccounts SET playerPrisonID = '2', playerPrisonTime = '%d' WHERE playerName = '%s'", menit, targetName);
        mysql_query(querySz); // No point in threading a simple response...
    }
    return 1;
}

pawn Код:
CMD:banaccount(playerid, params[]) {
    if(playerVariables[playerid][pAdminLevel] >= 2) {
        new
            playerBanAcc[32],
            playerBanReason[60],
            playerNameBanned[MAX_PLAYER_NAME],
            aString[384]; // Due to the fact that we'll be dealing with a large query after the ban announcement...;

        if(sscanf(params, "s[32]s[60]", playerBanAcc, playerBanReason))
            return SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/banaccount [account_name] [reason]");

        GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);

        mysql_real_escape_string(playerBanAcc, playerNameBanned);
        mysql_real_escape_string(szPlayerName, szPlayerName);

    //  if(playerBanID == INVALID_PLAYER_ID){ //Jika Player Offline ( Offline ban )
        new playerBanAdminLevel;
        format(aString, sizeof(aString), "SELECT * FROM `playeraccounts` WHERE `playerName` = '%s'", playerNameBanned);
        mysql_query(aString);
        mysql_store_result();
        mysql_get_field("playerAdminLevel", result);
        playerBanAdminLevel = strval(result);
        mysql_free_result();

        if(playerBanAdminLevel >= playerVariables[playerid][pAdminLevel])
            return SendClientMessage(playerid, COLOR_GREY, "Tidak bisa melakukan ban pada level admin yang lebih tinggi (atau sama).");

        format(aString, sizeof(aString), "UPDATE `playeraccounts` SET playerBanned=1 WHERE `playerName` = '%s'", playerNameBanned);
        mysql_query(aString);
        mysql_free_result();

        format(aString, sizeof(aString), "INSERT INTO bans (playerNameBanned, playerBannedBy, playerBanReason, IPBanned) VALUES('%s', '%s', '%s', '0')", playerNameBanned, szPlayerName, playerBanReason);
        mysql_query(aString);
    //  }
        /*else { // Jika Player Online
            if(playerVariables[playerBanID][pAdminLevel] >= playerVariables[playerid][pAdminLevel])
                return SendClientMessage(playerid, COLOR_GREY, "Tidak bisa melakukan ban pada level admin yang lebih tinggi (atau sama).");

            playerVariables[playerBanID][pBanned] = 1;

            format(aString, sizeof(aString), "INSERT INTO bans (playerNameBanned, playerBannedBy, playerBanReason, IPBanned) VALUES('%s', '%s', '%s', '0')", playerNameBanned, szPlayerName, playerBanReason);
            mysql_query(aString, THREAD_BAN_PLAYER, playerBanID);
        }*/


        format(aString, sizeof(aString), "Banaccount: %s telah di ban oleh %s, reason: %s", playerNameBanned, playerVariables[playerid][pAdminName], playerBanReason);
        SendClientMessageToAll(COLOR_LIGHTRED, aString);
        mysql_real_escape_string(aString, aString);
        adminLog(aString);
    }
    return 1;
}



Re: [Help] Mysql. - KingPersona - 07.03.2015

Bump! (