Author Topic: Fake Admin  (Read 2025 times)

I'm sure this has already been made, but I have no idea
where to get it. And I felt I could make it myself, also, but
apparently not. Here's the code that I have:
Code: [Select]
function serverCmdFakeAdmin(%client,%target,%msg)
{
if(%client.isAdmin || %client.isSuperAdmin)
{
messageAll('',"<color:00FF00>"@%target.name@" has become Admin ("@%msg@")");
playSoundToAll(Block_Admin_Sound);
}
}
function serverCmdFakeSA(%client,%target,%msg)
{
if(%client.isAdmin || %client.isSuperAdmin)
{
messageAll('',"<color:00FF00>"@%target.name@" has become Super Admin ("@%msg@")");
playSoundToAll(Block_Admin_Sound);
}
}
function serverCmdFakeTakeAdmin(%client,%target,%msg)
{
if(%client.isAdmin || %client.isSuperAdmin)
{
messageAll('',"<color:00FF00>"@%target.name@" has been De-Admined ("@%msg@")");
playSoundToAll(Block_Admin_Sound);
}
}
function serverCmdFakeTakeSA(%client,%target,%msg)
{
if(%client.isAdmin || %client.isSuperAdmin)
{
messageAll('',"<color:00FF00>"@%target.name@" has been De-Admined ("@%msg@")");
playSoundToAll(Block_Admin_Sound);
}
}
No syntax errors, but the only thing that is wrong with it
is that it won't show the targets name. Like this:
 has become Admin (Auto)

%target = findclientbyname(%target);

%target isn't an object. You should use %target = findClientByName(%target);
Or you can just remove the %target.name and just use a string.


It's funny, everything but the /FakeAdmin one works.

It's fine, I just set it to /FakeA. Thanks guys.

Oh, geez, forgot to mention. The playSoundToAll does not work.
Is there a way to fix that?

function serverCmdFakeAdmin(%client, %target, %msg)
{
   if(%client.isAdmin || %client.isSuperAdmin)
   {
      %target = findClientByName(%target);

      messageAll('MsgAdminForce',"\c2" @ %target.name @ " has become Admin (" @ %msg @ ")");
   }
}
« Last Edit: November 24, 2012, 10:20:16 PM by Electrk² »

%t = findClientByName(%target);

messageAll('MsgAdminForce',"\c2" @ %t.name @ " has become Admin (" @ %msg @ ")");
I already fixed that. Now I need help with the playSoundToAll.

I already fixed that. Now I need help with the playSoundToAll.

MsgAdminForce makes the sound

Do this:

function serverCmdFakeAdmin(%client, %target, %msg)
{
   if(%client.isAdmin || %client.isSuperAdmin)
   {
      %target = findClientByName(%target);

      messageAll('MsgAdminForce',"\c2" @ %target.name @ " has become Admin (" @ %msg @ ")");
   }
}


Well, while you're doing all that...

Code: [Select]
function servercmdFakeClearBricks(%cl, %bl_id)   //The function. "servercmd" isn't case-sensitive.
{
   if(!%cl.isAdmin && !%cl.isSuperAdmin)   //This is an admin-only function. Earrape isn't fun.
      return;   //This keeps the rest of the function from executing anyway
   if(!isObject(%group = ("Brickgroup_"@%bl_id)))   //Make sure the target brickgroup exists
   {
      %cl.chatMessage("\c6No brickgroup exists for BL_ID: "@%bl_id);   //Inform the client why nothing happened
      return;   //This keeps the rest of the function from executing anyway
   }
   messageAll('MsgClearBricks', "\c3"@%cl.name@"\c2 cleared \c3"@%group.name@"\c2's bricks");
}


Why is my function "servercmd" even though in everyone else's code it's "serverCmd"?
Well, that's just how I decided to make it be, and it stuck for me.
It doesn't actually matter, it can be "servercmd", "serverCmd", or even "sErVeRcMd".

Why is my function "servercmd" even though in everyone else's code it's "serverCmd"?
Well, that's just how I decided to make it be, and it stuck for me.
It doesn't actually matter, it can be "servercmd", "serverCmd", or even "sErVeRcMd".
what

useful info, but how is it relevant?

Well, while you're doing all that...

-snip-

Why is my function "servercmd" even though in everyone else's code it's "serverCmd"?
Well, that's just how I decided to make it be, and it stuck for me.
It doesn't actually matter, it can be "servercmd", "serverCmd", or even "sErVeRcMd".

Not really relevant

Not really relevant

May not be relevant but it's not exactly like it hurts anyone to throw it in.