Author Topic: Stopping someone from using a server command  (Read 3353 times)

No, I do have a script,

Sorry, I don't see one:

The title is self-explanitory, But to clear things up more, I want to know how to package a servercmd and how to stop someone from using that command when I type in a servercmd myself. Would I have to use schedules? =/

I don't want to post because it's, well, it's a shot in the dark, I had no idea what I was doing when I packaged the function, its a mute command so I tried to package servercmdmessagesent but I have no idea how to do this, thus this post, I'll post the code:

[WARNING] ITS MESSY

Code: [Select]
function servercmdmute(%client, %user)
{
if(%Client.isSuperAdmin == false || %Client.isAdmin == false)
{

messageClient(%client, '', '\c6You must be admin to use this command.');

return;
}
if(%user !$= "")
{
%victim = findClientByName(%user).player;
%victimn = findClientByName(%user);
muteplayer(%victim);
messageAll("",'\c3%1 \c6was muted by \c3%2', %victimn.name, %client.name);
messageClient(%victimn, '', '\c6You are now muted', %user);

return;
}}
package mute
{
function muteplayer(%victim)
{
%victim::onservercmdmessagesent

return;
}
parent::servercmdmessagesent
}
};
activate(mute);

function servercmdunmute(%client, %user)
{
if(%Client.isSuperAdmin == false || %Client.isAdmin == false)
{

messageClient(%client, '', '\c6You must be admin to use this command.');

return;
}
if(%user !$= "")
{
%victim = findClientByName(%user).player;
%victimn = findClientByName(%user);
cancel(%victim.muteplayer);
messageAll("",'\c3%1 \c6was unmuted by \c3%2', %victimn.name, %client.name);
messageClient(%victimn, '', '\c6You are now unmuted', %user);
}
This will be painful.....

Let's actually just help out, and not bash. After all, that's what this section is for.

just help out
This wasn't really possible until he posted his script...

Helping isn't the same as just giving him the script, either.

Can you help now? I posted a script.
« Last Edit: March 18, 2009, 03:01:43 PM by AGlass0fMilk »


You have to set a variable on the client then package serverCmdMessageSent(%client,%text) to check if the client's mute variable is set to 1, if yes return, else parent::servercmdMessagesent(%client,%text).

how do i set a variable?

Wait. Are you trying to stop them from talking, or from using the serverCmd?

I'm trying to do the first one here, but I want to learn how to do both.

Here's the old Mute. (v8 mod I believe)

http://www.mediafire.com/?oyymvmmcmyv
You can learn from this.

Thanks for the reference, and not flaming me.