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 + " ]" );
}
can u post which error show on console?
no erro
Query where you create tables?
(CREATE TABLE IF NOT EXISTS Bans ...)
here
▄︻̷̿┻̿═━一
QuerySQL( db, "CREATE TABLE IF NOT EXISTS Bans ( Name VARCHAR(32), IP VARCHAR(25), Admin TEXT, Reason TEXT )" );
. [̲̅$̲̅(̲̅5̲̅)̲̅$̲̅].
plz help
set rMessage to Message
What actually happens? Do you get every message you should get, but aren't being unbanned?
And post your ban command.
i dont get any msg i will post my ban cmd once i am on my pc wait
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]
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 + "." );
}
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.
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
In which line does it shows, and plz post that line too
no line it just say that index name doesnt exists
Removed your try { } catch block from the onPlayerCommand.
yes no work
Post the following things
Unban function
A screenshot of your ban table
Quote from: Beztone on Jul 23, 2015, 08:45 AMPost the following things
Unban function
A screenshot of your ban table
He posted all those.
Post ur onPlayerCommand
Try it
else if ( cmd == "unban" )
{
if ( IsNoob( player, cmd ) ) return 0;
else if ( !text ) MessagePlayer("/" + cmd + " <Full Nick>", player );
else
{
local q = QuerySQL( db, "SELECT * FROM Bans WHERE Name='" + text + "' COLLATE NOCASE" );
if ( GetSQLColumnData(q, 0) )
{
QuerySQL(db, "DELETE FROM Bans WHERE Name='" + text + "'");
EchoMessage("Admin " + player.Name + " Has Un-Banned " + text + "");
Message("Admin " + player.Name + " Has Un-Banned " + text + "");
}
else MessagePlayer("Invalid Nick/ID Specified!",player );
FreeSQLQuery( q );
}
}
If it didnt work then do as
@Thijn says here (http://forum.vc-mp.org/?topic=1094.msg7281#msg7281)
Yup post ur ban function as well as the ban cmd
@beztone thanks