Particle's Custom RPG
Assistance => Assistance & Feedback => Topic started 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?
Thanks in advance.
-
// 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
-
Thanks a bunch. <3
What's AdminID?
-
The clientID of the admin
-
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());
-
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?
-
Just use Net::Kick(%clientID, Reason);
The code looks a bit faulty for admin::kick
-
Alright, but that didn't display a reason either.
-
oh malarkey dude, my bad, I assumed something about %reason that I shouldn't have, so use this:
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.
-
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.
-
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