when i ban a player its banded but data not saved in db
function Ban( player, admin, reason )
{
local now = date();
local type = "Nick-Banned";
QuerySQL( db, "INSERT INTO Bans ( Name, IP, Mac, Admin, Reason, Date, Type) VALUES ( '" + player + "', '" + player.IP + "', '" + player.UniqueID + "', '" + admin + "', '" + reason + "', '" + now.day + "/" + now.month + "/" + now.year + " " + now.hour + ":" + now.min + ":" + now.sec + "', '" + type + "')" );
Message(RED+ "--> Admin [ "+ admin +" ] Banned Player:[ " + player + " ] Reason:[ " + reason + " ]" );
EchoMessage(ICOL_RED+ICOL_BOLD+">> [Banned] Player:[ " + player + " ] Reason:[ " + reason + " ]" );
KickPlayer( player );
}
My god, use player.Name
like this???
Message(RED+ "--> Admin [ "+ admin +" ] Banned Player:[ " + player.Name + " ] Reason:[ " + reason + " ]" );
... '" + now.day + "/" + now.month + "/" + now.year + " " + now.hour + ":" + now.min + ":" + now.sec + "' ...
Do you even have columns for all of these values? If you want to put the time in on column then you have to generate a single string with all of these datas combined to add it in one separate column of your time
Use this function:-
function Ban( player, admin, reason )
{
local now = date();
local type = "Nick-Banned";
QuerySQL( db, "INSERT INTO Bans ( Name, IP, Mac, Admin, Reason, Date, Type) VALUES ( " + player.Name + "', '" + player.IP + "', '" + player.UniqueID + "', '" + admin + "', '" + reason + "', '" + GetFullTime() + "', '" + type + "')" );
Message(RED+ "--> Admin [ "+ admin +" ] Banned Player:[ " + player.Name + " ] Reason:[ " + reason + " ]" );
EchoMessage(ICOL_RED+ICOL_BOLD+">> [Banned] Player:[ " + player.Name + " ] Reason:[ " + reason + " ]" );
KickPlayer( player );
}
Here is the getfulltime function:-(made by SLC)
function GetFullTime()
{
local t = date();
return ::format(@"%.2d/%.2d/%d - %.2d:%.2d:%.2d", t.day, t.month, t.year, t.hour, t.min, t.sec);
}
STILL NOT SAVING
Quote from: aliabbas on Sep 25, 2015, 05:36 AMSTILL NOT SAVING
Do you actually have the table with those columns?
Try printing the query and executing it manually in your SQLiteBrowser, or whatever software you use to see your database.
its ok but in this error occurs Player does not exists no specific line
function Code( player, admin, reason )
{
local now = date();
local type = "MacID-Banned";
QuerySQL( db, "INSERT INTO Bans ( Name, IP, Mac, Admin, Reason, Date, Type) VALUES ( '" + player + "', '" + player.IP + "', '" + Player.UniqueID + "', '" + admin + "', '" + reason + "', '" + type + "')" );
Message(RED+"--> Admin [ "+ admin +" ] Banned MacID of Player:[ " + player + " ] Reason:[ " + reason + " ]" );
EchoMessage(ICOL_RED+ICOL_BOLD+">> Admin [ "+ admin +" ] Banned MacID of Player:[ " + player + " ] Reason:[ " + reason + " ]" );
KickPlayer( player );
}
Where is date and where is player.Name? xD Are u banning a IRC person? if yes, its not possible
KillerX, use this one It's working.. i'm sure..
Quote from: KAKAN on Sep 24, 2015, 04:19 PMUse this function:-
function Ban( player, admin, reason )
{
local now = date();
local type = "Nick-Banned";
QuerySQL( db, "INSERT INTO Bans ( Name, IP, Mac, Admin, Reason, Date, Type) VALUES ( " + player.Name + "', '" + player.IP + "', '" + player.UniqueID + "', '" + admin + "', '" + reason + "', '" + GetFullTime() + "', '" + type + "')" );
Message(RED+ "--> Admin [ "+ admin +" ] Banned Player:[ " + player.Name + " ] Reason:[ " + reason + " ]" );
EchoMessage(ICOL_RED+ICOL_BOLD+">> [Banned] Player:[ " + player.Name + " ] Reason:[ " + reason + " ]" );
KickPlayer( player );
}
Here is the getfulltime function:-(made by SLC)
function GetFullTime()
{
local t = date();
return ::format(@"%.2d/%.2d/%d - %.2d:%.2d:%.2d", t.day, t.month, t.year, t.hour, t.min, t.sec);
}
Quote from: KAKAN on Sep 25, 2015, 06:14 AMWhere is date and where is player.Name? xD Are u banning a IRC person? if yes, its not possible
date() is an inbuild squirrel function and player instances when casted to a string will return the name. And of course you can ban someone from IRC.
Why do you even post when you clearly don't know any more then this guy?
I know about date(), i mean he made the function with VALUES, but he didn't include the date() anywhere
How can we ban someone from IRC, using our IRC bot
I tried to kick someone, but instead of that it kicked everyone
Quote from: aliabbas on Sep 25, 2015, 06:07 AMits ok but in this error occurs Player does not exists no specific line
function Code( player, admin, reason )
{
local now = date();
local type = "MacID-Banned";
QuerySQL( db, "INSERT INTO Bans ( Name, IP, Mac, Admin, Reason, Date, Type) VALUES ( '" + player + "', '" + player.IP + "', '" + Player.UniqueID + "', '" + admin + "', '" + reason + "', '" + type + "')" );
Message(RED+"--> Admin [ "+ admin +" ] Banned MacID of Player:[ " + player + " ] Reason:[ " + reason + " ]" );
EchoMessage(ICOL_RED+ICOL_BOLD+">> Admin [ "+ admin +" ] Banned MacID of Player:[ " + player + " ] Reason:[ " + reason + " ]" );
KickPlayer( player );
}
For IRC Past It In Your Echo.nut
CMD
else if ( cmd == "!ban" )
{
if ( level <6 ) EchoNotice( user, "Error - Your Level is not Enough." );
else if ( !text ) EchoNotice( user,"Error - Syntax: " + cmd + " <Nick/ID> <Reason> ");
else {
local plr = GetPlayer( GetTok( text, " ", 1 ) );
if ( !plr ) EchoNotice( user, "[Error] No Such Player." );
else
{
local msg = GetTok( text, " ", 2, NumTok( text, " " ) );
if ( !msg ) EchoNotice( user, "Invalid Format.." );
else {
if ( msg == null ) msg = "None";
Ban( plr, user, msg );
}
}
}
}
FUNCTION
function Ban( player, admin, reason )
{
local now = date();
local type = "MacID-Banned";
QuerySQL( db, "INSERT INTO Bans ( Name, IP, Mac, Admin, Reason, Date, Type) VALUES ( '" + player.Name + "', '" + player.IP + "', '" + Player.UniqueID + "', '" + admin + "', '" + reason + "', '"+GetFullTime()+"', '" + type + "')" );
Message(RED+"--> Admin [ "+ admin +" ] Banned MacID of Player:[ " + player + " ] Reason:[ " + reason + " ]" );
EchoMessage(ICOL_RED+ICOL_BOLD+">> Admin [ "+ admin +" ] Banned MacID of Player:[ " + player + " ] Reason:[ " + reason + " ]" );
KickPlayer( player );
}
TRY if it works for you
Everyone can use it, I mean the IRC USer ban, not server one, server one is easy, if u want to ban a player from IRC, you need to use player, not player.Name in the functions, hope you got the point