unban probelm

Started by kokia, Jul 22, 2015, 03:35 PM

Previous topic - Next topic

kokia

hello all in script when i ban player it works but unban not works pls help no error comes the code is :
else if ( cmd == "unban" )
{
   if ( IsNoob( player, cmd ) ) return 0;
   else if ( !text ) ePrivMessage( "Syntax, / " + cmd + " <Full Nick>", player );
   else if ( CheckBan( text ) == 0 ) ePrivMessage( "Error - " + text + " is not Banned.", player );
   else DelBan( player, text );
}
delban:
function DelBan( admin, banned )
{
    QuerySQL( db, "DELETE FROM Bans WHERE Name='" + banned + "'" );
rMessage( "** Admin " + admin + " UnBanned Player:[ " + banned + " ]" );
}

[VSS]Shawn

can u post which error show on console?

kokia


EK.IceFlake

Query where you create tables?
(CREATE TABLE IF NOT EXISTS Bans ...)

kokia

#4
here
▄︻̷̿┻̿═━一
QuerySQL( db, "CREATE TABLE IF NOT EXISTS Bans ( Name VARCHAR(32), IP VARCHAR(25), Admin TEXT, Reason TEXT )" );
. [̲̅$̲̅(̲̅5̲̅)̲̅$̲̅].

kokia


[VSS]Shawn

set rMessage to Message

Thijn

What actually happens? Do you get every message you should get, but aren't being unbanned?
And post your ban command.

kokia

i dont get any msg i will post my ban cmd once i am on my pc wait

EK.IceFlake

rMessage( "** Admin " + admin + " UnBanned Player:[ " + banned + " ]" );
Find the problem with it.
[spoiler]You passed admin as instance, now trying to put it in string. Fix it yourself.
[spoiler]Change "admin" to "admin.Name"[/spoiler][/spoiler]

[VSS]Shawn

On Command DelBan( player, text )
In function DelBan( admin, banned ) Wow

Use this DelBan Function


function DelBan( player, text )
{
    QuerySQL( db, "DELETE FROM Bans WHERE Name='" + text + "'" );
 Message( "** Admin " + player.Name + " UnBanned Player: " + text + "." );
}

DizzasTeR

#11
Quote from: [VSS]Shawn on Jul 23, 2015, 07:59 AMOn Command DelBan( player, text )
In function DelBan( admin, banned ) Wow

You stupid moron, we can change the defined variables differently, that doesn't affect the script at all as long as the arguments passed are correct. So:

function onScriptLoad() {
    local msg = "Hello world!";
    local fact = "Shawn can't script";

    PrintData( msg, fact );
}

function PrintData( strine, totally_correct ) {
    print( format( "%s %s", string, totally_correct ) )

}

I know you won't even try to learn from that and end up having an error on this small script which you can't fix yourself.

As for the topic, provide enough info and code so it is atleast possible to check for errors..

Crystal caught the error already.

kokia

Quote from: [VSS]Shawn on Jul 23, 2015, 07:59 AMOn Command DelBan( player, text )
In function DelBan( admin, banned ) Wow

Use this DelBan Function


function DelBan( player, text )
{
    QuerySQL( db, "DELETE FROM Bans WHERE Name='" + text + "'" );
 Message( "** Admin " + player.Name + " UnBanned Player: " + text + "." );
}

not works
my ban cmd
        else if ( cmd == "ban" )
        {
   if ( IsNoob( player, cmd ) ) return 0;
   else if ( !text ) PrivMessage( "Syntax, /" + cmd + " <nick> <reason>", player );
   local plr = GetPlayer( GetTok( text, " ", 1 ) );
   if ( !plr ) PrivMessage( "Invalid Player Nick /ID!", player );
   else
   {
      local reason = GetTok( text, " ", 2 NumTok( text, " " ) );
  if ( reason == null ) reason = "None";
  Ban( plr, player, reason );
   }
}
this ban cmd works
now error even with crystal's script is
[SCRIPT]  OnPlayerCommand Error: the index 'Name' does not exist

KAKAN

In which line does it shows, and plz post that line too
oh no

kokia

no line it just say that index name doesnt exists