Author Topic: Another Question From Me: Kicking a Player  (Read 3648 times)

0 Members and 1 Guest are viewing this topic.

bigbigger9

  • Gnoll Fighter
  • **
  • Posts: 73
  • Reputation: +0/-0
Another Question From Me: Kicking a Player
« on: September 20, 2003 08:59 pm CDT »
I found admin::kick(); but I don't know what to do for the arguments, also I want to kick with a reason, so they'll get a popup after they're dropped so they can see why they were kicked.

Sick of me yet?  :P
Thanks in advance.
« Last Edit: December 31, 1969 06:00 pm CST by bigbigger9 »
~bigbigger9

Dragoon

  • Gnoll Fighter
  • **
  • Posts: 52
  • Reputation: +0/-0
(No subject)
« Reply #1 on: September 20, 2003 09:05 pm CDT »
Code: [Select]
// Admin::Kick(|Admin ID|, |Client ID|, |Ban True/False|, |Reason|)
// Admin ID - Either True Admin's ID or -1 For Consensus
// Client ID - Client ID Of Client Being Kicked/Banned
// Ban - True: Bans (Bans For 30 Minutes) | False: Kick (Bans For 3 Minutes)
// Reason - Reason The Is Displayed On Kick Message

function Admin::kick(%admin, %client, %ban, %reason)
{
if(%admin != %client && (%admin == -1 || %admin.isAdmin))
{
if(%ban && !%admin.isSuperAdmin)
return;
         
if(%ban)
{
%word = "banned";
%cmd = "BAN: ";
}
else
{
%word = "kicked";
%cmd = "KICK: ";
}

if(%client.isSuperAdmin)
{
if(%admin == -1)
messageAll(0, "A super admin cannot be " @ %word @ ".");
else
Client::sendMessage(%admin, 0, "A super admin cannot be " @ %word @ ".");

return;
}

%ip = Client::getTransportAddress(%client);
%name = Client::getName(%client);
echo(%cmd @ %admin @ " " @ %client @ " " @ %ip);

if(%ip == "")
return;

if(%ban)
BanList::add(%ip, 1800);
else
BanList::add(%ip, 180);

if(%admin == -1)
{
MessageAll(0, %name @ " was " @ %word @ " from vote.");

if(!%Reason)
Net::kick(%client, "You were " @ %word @ " by  consensus.");
  }
else
{
MessageAll(0, %name @ " was " @ %word @ " by " @ Client::getName(%admin) @ ".");

if(!%Reason)
Net::kick(%client, "You were " @ %word @ " by " @ Client::getName(%admin));
}

if(%reason)
Net::Kick(%client, %reason);
}
}


sick of you... that was a few weeks ago ;)
« Last Edit: December 31, 1969 06:00 pm CST by Dragoon »
I r Dragoon.

bigbigger9

  • Gnoll Fighter
  • **
  • Posts: 73
  • Reputation: +0/-0
(No subject)
« Reply #2 on: September 20, 2003 09:17 pm CDT »
Thanks a bunch. :D <3

What's AdminID?
« Last Edit: December 31, 1969 06:00 pm CST by bigbigger9 »
~bigbigger9

UnderGod

  • Centurian Lord
  • ********
  • Posts: 2,691
  • Reputation: +0/-0
(No subject)
« Reply #3 on: September 20, 2003 09:22 pm CDT »
The clientID of the admin
« Last Edit: December 31, 1969 06:00 pm CST by UnderGod »
"The right man in the wrong place can make all the difference in the world"

bigbigger9

  • Gnoll Fighter
  • **
  • Posts: 73
  • Reputation: +0/-0
(No subject)
« Reply #4 on: September 20, 2003 09:27 pm CDT »
Ah, so if it's the server doing this, would I put in 2048 or 0?

Edit: Nevermind, 2048 I beleive thanks to echo(getmanagerid());
« Last Edit: December 31, 1969 06:00 pm CST by bigbigger9 »
~bigbigger9

bigbigger9

  • Gnoll Fighter
  • **
  • Posts: 73
  • Reputation: +0/-0
(No subject)
« Reply #5 on: September 20, 2003 09:54 pm CDT »
Alright, this is what I got working:

Admin::Kick(-1, 2049, False, "Bye.");

It dropped the player, and only for the 3 minutes like it should, but it didn't give the reason. So what'd I do wrong?
« Last Edit: December 31, 1969 06:00 pm CST by bigbigger9 »
~bigbigger9

UnderGod

  • Centurian Lord
  • ********
  • Posts: 2,691
  • Reputation: +0/-0
(No subject)
« Reply #6 on: September 20, 2003 10:04 pm CDT »
Just use Net::Kick(%clientID, Reason);

The code looks a bit faulty for admin::kick
« Last Edit: December 31, 1969 06:00 pm CST by UnderGod »
"The right man in the wrong place can make all the difference in the world"

bigbigger9

  • Gnoll Fighter
  • **
  • Posts: 73
  • Reputation: +0/-0
(No subject)
« Reply #7 on: September 20, 2003 10:14 pm CDT »
Alright, but that didn't display a reason either.
« Last Edit: December 31, 1969 06:00 pm CST by bigbigger9 »
~bigbigger9

Dragoon

  • Gnoll Fighter
  • **
  • Posts: 52
  • Reputation: +0/-0
(No subject)
« Reply #8 on: September 20, 2003 10:31 pm CDT »
oh malarkey dude, my bad, I assumed something about %reason that I shouldn't have, so use this:

Code: [Select]
function Admin::kick(%admin, %client, %ban, %reason)
{
if(%admin != %client && (%admin == -1 || %admin.isAdmin))
{
if(%ban && !%admin.isSuperAdmin)
return;
         
if(%ban)
{
%word = "banned";
%cmd = "BAN: ";
}
else
{
%word = "kicked";
%cmd = "KICK: ";
}

if(%client.isSuperAdmin)
{
if(%admin == -1)
messageAll(0, "A super admin cannot be " @ %word @ ".");
else
Client::sendMessage(%admin, 0, "A super admin cannot be " @ %word @ ".");

return;
}

%ip = Client::getTransportAddress(%client);
%name = Client::getName(%client);
echo(%cmd @ %admin @ " " @ %client @ " " @ %ip);

if(%ip == "")
return;

if(%ban)
BanList::add(%ip, 1800);
else
BanList::add(%ip, 180);

if(%admin == -1)
{
MessageAll(0, %name @ " was " @ %word @ " from vote.");

if(!%reason || %reason == "")
Net::kick(%client, "You were " @ %word @ " by  consensus.");
else
Net::Kick(%client, %reason);
  }
else
{
MessageAll(0, %name @ " was " @ %word @ " by " @ Client::getName(%admin) @ ".");

if(!%Reason || %reason == "")
Net::kick(%client, "You were " @ %word @ " by " @ Client::getName(%admin));
else
Net::Kick(%client, %reason);
}
}
}


that should work... dunno, test it and get back to me.
« Last Edit: December 31, 1969 06:00 pm CST by Dragoon »
I r Dragoon.

bigbigger9

  • Gnoll Fighter
  • **
  • Posts: 73
  • Reputation: +0/-0
(No subject)
« Reply #9 on: September 20, 2003 10:35 pm CDT »
Uh, maybe it's just my tribes installation, it works on dropping people from the server, it just doesn't show them the reason.

No matter, I'll just remoteCP(); them to tell them why they're being kicked.
« Last Edit: December 31, 1969 06:00 pm CST by bigbigger9 »
~bigbigger9

Hersh

  • Elvin Legion
  • *****
  • Posts: 413
  • Reputation: +0/-0
(No subject)
« Reply #10 on: September 20, 2003 11:40 pm CDT »
Connectivity.cs has a pretty good set up of how to kick someone for diffrent reasons and they get diffrent messages.
So you can make things like
#kick playername pk
#kick playername spam
#kick playername cheat
You get the idea.

Hersh
« Last Edit: December 31, 1969 06:00 pm CST by Hersh »

I kissed a drunk girl on the lips.
This post, by its very length, defends itself against the risk of being read.