SA-MP Forums Archive
What's wrong with this? - 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: What's wrong with this? (/showthread.php?tid=500506)



What's wrong with this? - rakshith122 - 13.03.2014

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.


Re: What's wrong with this? - Matess - 13.03.2014

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?


Re: What's wrong with this? - rakshith122 - 13.03.2014

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.


Re: What's wrong with this? - rakshith122 - 13.03.2014

BUMP!


Re: What's wrong with this? - Matess - 13.03.2014

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


Re: What's wrong with this? - rakshith122 - 13.03.2014

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);



Re: What's wrong with this? - Matess - 13.03.2014

new reason[64]; //


Re: What's wrong with this? - rakshith122 - 13.03.2014

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...


Re: What's wrong with this? - Matess - 13.03.2014

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



Re: What's wrong with this? - rakshith122 - 13.03.2014

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