Ban with server name

Started by KAKAN, Sep 14, 2015, 05:31 PM

Previous topic - Next topic

KAKAN

Here;s the BAN function:-
function Ban( plr, player, reason )
{
    QuerySQL( sqliteDB, "INSERT INTO Bans(Name, IP, UID, Reason, Time, Admin) VALUES('" + plr.Name + "', '" + plr.IP + "', '" + plr.UniqueID + "', '" + reason + "', '" + GetFullTime() + "', '"+player+"')" );
    EMessage( "Admin " + player + " has banned "+plr.Name+" from this server. Reason: " + reason + "." );
    plr.Kick();
}

Don't worry about tables and etc, I have them. Now tell me can i use something like this:-
Ban(plr, "Server", "Hax0r");Just tell this will work or not... If you found any error pl0x do tell me
oh no

DizzasTeR

Common sense is not common, you clearly see that in query you are taking the IP and the UniqueID of 'plr' instance, which won't work. Before that, you are taking 'plr.Name' which ends up like "Server".Name, will that work?

Atleast think over your implementation.

KAKAN

See the function name-
function Ban( plr, player, reason )
plr then player
So this one may work tho
Ban(player,"Server","hax0r")
OR this one
local plr = player, player = "server", reason = "Hax0r";
Ban(plr,player,reason)
oh no

KAKAN

Some more doubts:-
function onPlayerHealthChange( player, lastHP, newHP )
{

    if ( newHP > 100 )
    {
    KickPlayer(player);
    EMessage( ">>" + player.Name + " has been kicked from this server. Reason: HP Hack.");
    }

local SP = AntiSP[ player.ID ];
if ( SP == true )
{
player.Health = 100;
}
}

2nd one:-
function onPlayerArmourChange( player, lastArmour, newArmour )
{
if ( player.newArmour >= 1)
{
if(stats[ player.ID ].Level < 6)
{
player.Kick();
EMessage(">> " + player.Name + " has been kicked. Reason: Armour Hack.");
}
}
}

3rd one:
function onPlayerWeaponChange( player, oldWep, newWep )
{
if ( player.newWep == 33 )
{
player.Disarm();
}
}

4th one:-
function onPlayerNameChange( player, oldName, newName )
{
return 1;
Message(">> " + oldName + " is now known as " + newName);
}
This one is from wiki, so it may work well.
oh no

Thijn

I don't get what your last post has anything to do with it.
Why are you even asking stuff like this? Try it... It's not like your house will explode if it goes wrong.

KAKAN

But plz tell me about the Ban, I need it badly
oh no

DizzasTeR

Quote from: KAKAN on Sep 14, 2015, 06:15 PMBut plz tell me about the Ban, I need it badly

Seriously? What the heck did I just post there?

KAKAN

Regarding to that, this should work:-
Ban(player,"Server","hax0r")
If not, then tell me
Else, lemme try
oh no

Thijn