Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: KAKAN on Sep 14, 2015, 05:31 PM

Title: Ban with server name
Post by: KAKAN on Sep 14, 2015, 05:31 PM
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
Title: Re: Ban with server name
Post by: DizzasTeR on Sep 14, 2015, 05:39 PM
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.
Title: Re: Ban with server name
Post by: KAKAN on Sep 14, 2015, 05:54 PM
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)
Title: Re: Ban with server name
Post by: KAKAN on Sep 14, 2015, 05:59 PM
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.
Title: Re: Ban with server name
Post by: Thijn on Sep 14, 2015, 06:06 PM
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.
Title: Re: Ban with server name
Post by: KAKAN on Sep 14, 2015, 06:15 PM
But plz tell me about the Ban, I need it badly
Title: Re: Ban with server name
Post by: DizzasTeR on Sep 14, 2015, 06:19 PM
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?
Title: Re: Ban with server name
Post by: KAKAN on Sep 14, 2015, 06:23 PM
Regarding to that, this should work:-
Ban(player,"Server","hax0r")
If not, then tell me
Else, lemme try
Title: Re: Ban with server name
Post by: Thijn on Sep 14, 2015, 06:26 PM
Locked.