Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: Cool on Sep 24, 2015, 04:08 PM

Title: bans saving prob
Post by: Cool on Sep 24, 2015, 04:08 PM
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 );
}
Title: Re: bans saving prob
Post by: KAKAN on Sep 24, 2015, 04:15 PM
My god, use player.Name
Title: Re: bans saving prob
Post by: Cool on Sep 24, 2015, 04:16 PM
like this???
Message(RED+ "--> Admin [ "+ admin +" ] Banned Player:[ "  + player.Name +  " ] Reason:[ " + reason + " ]" );
Title: Re: bans saving prob
Post by: DizzasTeR on Sep 24, 2015, 04:17 PM
... '" + 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
Title: Re: bans saving prob
Post by: KAKAN on Sep 24, 2015, 04:19 PM
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);
}
Title: Re: bans saving prob
Post by: Cool on Sep 25, 2015, 05:36 AM
STILL NOT SAVING
Title: Re: bans saving prob
Post by: Thijn on Sep 25, 2015, 05:55 AM
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.
Title: Re: bans saving prob
Post by: Cool on Sep 25, 2015, 06:07 AM
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 );
}
Title: Re: bans saving prob
Post by: KAKAN on Sep 25, 2015, 06:14 AM
Where is date and where is player.Name? xD Are u banning a IRC person? if yes, its not possible
Title: Re: bans saving prob
Post by: SAzEe21 on Sep 25, 2015, 11:16 AM
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);
}
Title: Re: bans saving prob
Post by: Thijn on Sep 25, 2015, 03:18 PM
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?
Title: Re: bans saving prob
Post by: KAKAN on Sep 25, 2015, 04:26 PM
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
Title: Re: bans saving prob
Post by: MacTavish on Sep 25, 2015, 07:44 PM
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
Title: Re: bans saving prob
Post by: KAKAN on Sep 26, 2015, 07:01 AM
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