mysql kick log
#1

How can I kick the mysql log? I give kick to appear in MySQL datebase?

I did something but not good ..

pawn Код:
public KickLog(playerid, reason[])
{
     new query[128];
     new year,month,day,hour,minute,second;
     getdate(year, month, day),gettime(hour, minute, second);
     format(query, sizeof(query), "INSERT INTO kicklog (username,day,moon,year,second,minute,hour,reason) VALUES ('%s','%d',%d,'%d','%d','%d','%d','%s')", ReturnName(playerid), day, month, year, second, minute, hour, reason);
     mysql_query(query);
     return 1;
}
The kick command is:

pawn Код:
CMD:kick(playerid, params[])
{
    new year, month,day, string[ 700 ], giveplayer[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME], result[ 700 ], giveplayerid;
    if(IsPlayerConnected(playerid)) {
        if (sscanf(params, "us", giveplayerid, result)) return SendClientMessage(playerid, 0xAFAFAFAA, "USAGE: /kick [playerid/PartOfName] [reason]");
        if (PlayerInfo[playerid][pAdmin] >= 1) {
            if(IsPlayerConnected(giveplayerid)) {
                if(giveplayerid != INVALID_PLAYER_ID) {
                    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    getdate(year, month, day);
                    format(string, sizeof(string), "MySQL: %s was kicked by %s, reason: %s (%d-%d-%d)", giveplayer, sendername, result,month,day,year);
                    KickLog(giveplayerid, result);
                    format(string, sizeof(string), "{FF0000}MySQL: {FFFFFF}%s was kicked by %s, reason: %s", giveplayer, sendername, result);
                    SendClientMessageToAll(0xAFAFAFAA, string);
                    Kick(giveplayerid);
                    return 1;
                }
            } else { format(string, 700, "   %d is not an active player.", giveplayerid); SendClientMessage(playerid, 0xAFAFAFAA, string); return 1; }
        } else return SendClientMessage(playerid, 0xAFAFAFAA, "   you are not authorized to use that command!");
    }
    return 1;
}
Reply
#2

Why would you ever use MySQL for logging anything?
It's slower than normal files in this case and not as simple to read as normal files...
Reply
#3

I didn't really check it, but is this your problem?
pawn Код:
format(query, sizeof(query), "INSERT INTO `kicklog` (`username`, `day`, `moon`, `year`, `second`, `minute`, `hour`, `reason`)/
     VALUES ('%s','%d',%d,'%d','%d','%d','%d','%s')"
, ReturnName(playerid), day, month, year, second, minute, hour, reason);
Reply
#4

I system login / register based on mysql but I do the logs .. and I need a demo log .. then I take that I do not know how to give kick to occur when log in phpMyAdmin
Reply
#5

Quote:
Originally Posted by dr.pepper
Посмотреть сообщение
I didn't really check it, but is this your problem?
pawn Код:
format(query, sizeof(query), "INSERT INTO `kicklog` (`username`, `day`, `moon`, `year`, `second`, `minute`, `hour`, `reason`)/
     VALUES ('%s','%d',%d,'%d','%d','%d','%d','%s')"
, ReturnName(playerid), day, month, year, second, minute, hour, reason);
does not work ..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)