UniqueID does not exist

Started by Amazing, Jan 03, 2016, 05:20 PM

Previous topic - Next topic

Amazing

Hi, i need help.. when i ban some one so its giving error UniqueID dose not exist please any can tell me what is bug?...help me plzz

Table....
QuerySQL( db, "CREATE TABLE IF NOT EXISTS Ban ( Name VARCHAR(32), IP VARCHAR(25), MacID TEXT(50), Admin TEXT, Reason TEXT, Date TEXT, Type TEXT )" );
Function...
function Ban( player, admin, reason )
{
    local now = date();
    local type = "Mac-Banned";
    QuerySQL( db, "INSERT INTO Ban ( 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 + " ]" );
    KickPla,yer( player );
}

Mashreq

#1
You are trying to enter a record in the table (Ban) which is having the column title MacID whereas you have specified the wrong column title Mac while entering a record in the table (Ban). This might be the reason that leads to show the error - UniqueID does not exists. So try changing your Mac column title in your ban function to MacID.

And I have noticed a mistake that you have done in your ban function, you have given KickPla,yer( player ); which should be KickPlayer( player );

KAKAN

Try this:-
function Ban( player, admin, reason )
{
    local now = date();
    local type = "Mac-Banned";
    QuerySQL( db, "INSERT INTO Ban ( Name, IP, MacID, Admin, Reason, Date, Type) VALUES ( '" + player.Name + "', '" + player.IP + "', '" + player.UID + "', '" + 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 );
}
oh no