What's wrong with this?
#1

pawn Код:
dcmd_accban(playerid,params[])
{
    new string[128];
    new ID;
    new time;
    new reason;
    if(sscanf(params,"uis[100]",ID,time,reason))
    {
        SendClientMessage(playerid,COLOR_ERROR,"USAGE: /accban (Player Name/ID) (Days) (Reason)");
        return 1;
    }
    if(!IsPlayerConnected(ID))
    {
        format(string,sizeof(string),"[ERROR] The player ID (%d) is not connected to the server. You cannot ban them.",ID);
        SendClientMessage(playerid,COLOR_ERROR,string);
        return 1;
    }
    new string1[128];
    format(string1,sizeof(string1),"[ADMIN] Administrator has banned %s(%d) from the server. Reason: %s. Time : %i days.",PlayerName(ID),ID,reason,time);
    SendClientMessageToAll(COLOR_ADMIN,string1);
    jBan(ID,playerid,reason,time);
    LogTo("AccountBans",string1);

    format(string,sizeof(string),"9[ADMIN] Administrator has banned %s(%d) from the server. Reason: %s. Ban Time : %i days.",PlayerName(ID),ID,reason,time);
    IRC_GroupSay(gGroupID,IRC_CHANNEL,string);
    return 1;
}
I was trying to edit the jBan and make this out. None of those stocks gave me an error. But, the problem is here.
Stock is given below.
pawn Код:
stock jBan(player_banned, player_banner, reason[], time = 0)
{
    new TempQuery[500];
    new IP[14];
    GetPlayerIp(player_banned,IP,sizeof(IP));
    format(TempQuery, sizeof(TempQuery), "INSERT INTO `"Bans_Table"` (user_banned, user_banned_ip, user_banner, ban_reason, ban_timestamp, ban_time) VALUES ('%s', '%s', '%s', '%s', CURRENT_TIMESTAMP, %d)", PlayerName(player_banned), IP, PlayerName(player_banner), reason, time);
    mysql_query(TempQuery);
    jBanCheck(player_banned);
    Kick(player_banned);
    return 1;
}
Please help me solve my issue, This is getting serious..
Thanks.
Reply
#2

Hm?
pawn Код:
format(TempQuery, sizeof(TempQuery), "INSERT INTO Bans_Table (user_banned, user_banned_ip, user_banner, ban_reason, ban_timestamp, ban_time) VALUES ('%s', '%s', '%s', '%s', CURRENT_TIMESTAMP, %d)", PlayerName(player_banned), IP, PlayerName(player_banner), reason, time);
ehh and what is this CURRENT_TIMESTAMP?
Reply
#3

Quote:
Originally Posted by Matess
Посмотреть сообщение
Hm?
pawn Код:
format(TempQuery, sizeof(TempQuery), "INSERT INTO Bans_Table (user_banned, user_banned_ip, user_banner, ban_reason, ban_timestamp, ban_time) VALUES ('%s', '%s', '%s', '%s', CURRENT_TIMESTAMP, %d)", PlayerName(player_banned), IP, PlayerName(player_banner), reason, time);
ehh and what is this CURRENT_TIMESTAMP?
Current date. I think.
Reply
#4

BUMP!
Reply
#5

And what is your problem? You have nothing in database or what? Have you deleted "" from format as i said? Check server_log also...
Reply
#6

It's not compiling. Sorry, I forgot to say the error lol
pawn Код:
C:\Users\Matt\Desktop\Started\Gamemode\robbing.pwn(7005) : error 035: argument type mismatch (argument 3)
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase
LINE 7005 :
pawn Код:
jBan(ID,playerid,reason,time);
Reply
#7

new reason[64]; //
Reply
#8

Could you please explain me that, Since i'm just learning some scripting.
like why should I add that [64] there, and how it works with that size...
Reply
#9

pawn Код:
new string[128];
    new ID;
    new time;
    new reason[64];// 64 or more.. it depends on you but it means maximum of string length...new reason[5] = 12345;
    if(sscanf(params,"uis[100]",ID,time,reason))// parameter u scans id/nick. parameter i scans integer, and s is for string
Reply
#10

you said the thing which I already knew, thanks anyways, +rep'ed
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)