Particle's Custom RPG

Assistance => Assistance & Feedback => Topic started by: bigbigger9 on September 20, 2003 08:59 pm CDT

Title: Another Question From Me: Kicking a Player
Post by: bigbigger9 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.
Title:
Post by: Dragoon 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 ;)
Title:
Post by: bigbigger9 on September 20, 2003 09:17 pm CDT
Thanks a bunch. :D <3

What's AdminID?
Title:
Post by: UnderGod on September 20, 2003 09:22 pm CDT
The clientID of the admin
Title:
Post by: bigbigger9 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());
Title:
Post by: bigbigger9 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?
Title:
Post by: UnderGod on September 20, 2003 10:04 pm CDT
Just use Net::Kick(%clientID, Reason);

The code looks a bit faulty for admin::kick
Title:
Post by: bigbigger9 on September 20, 2003 10:14 pm CDT
Alright, but that didn't display a reason either.
Title:
Post by: Dragoon 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.
Title:
Post by: bigbigger9 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.
Title:
Post by: Hersh 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