Author Topic: CommandToClient to make someone admin, Please help  (Read 976 times)

Well, im trying to make a bot admin, and i know the code to do so is something like this:

Code: [Select]
commandToClient("SetAdminLevel","BOTORPLAYERNAME","2");
Please help

Well, im trying to make a bot admin, and i know the code to do so is something like this:

Code: [Select]
commandToClient("SetAdminLevel","BOTORPLAYERNAME","2");
Please help

That's not how you do it. You're trying to make a Client bot, or a Player Bot Admin? You can't make a player model admin.

I wish I could remember how to do what you're asking.

Im useing a code to spawn a bot, and i need a code to make the bot into admin.

Im useing a code to spawn a bot, and i need a code to make the bot into admin.

You're using CommandToClient on a Player Model. That is impossible. Client is the actual connected person, where as their player is just their current object. Works the same for bots.

Its possible. Ive done it about a year ago.

Its possible. Ive done it about a year ago.

Using CommandToClient on a Bot's Player model?

I dont get it, Mind posting a example code?

you just use ___.isAdmin == 1 or == 0..

i.e.
Code: [Select]
function servercmdadmin(%c)
{
    %c.isAdmin == 1;
    return;
}


Ok the a bot does not have a client object so you'll need to emulate one.You can do this by applying the bots player object with a linked client (of course its fake),like so.

Code: [Select]
////////////////////////////////////////////////////////////
//   Creates the client object needed for a player object //
//                                                        //
//                                                        //
//    %bot - The bot that is being fake cliented.         //
//                                                        //
//                                                        //
//    halts:                                              //
//      If the bot object is invalid                      //
//      If the bot object has a client object             //
//                                                        //
//                                                        //
////////////////////////////////////////////////////////////
function emulateClient(%bot)
{
if(!isObject(%bot) || isObject(%bot.client))
return;

%bot.client = new SimObject()
{
isAdmin = 0;
};
}

Don't quote me on this but it was done before in other mods.The server handles the admining and deadmining.If your want the message you could add messageAll('msg',"[Blah] Bot has been admin by server"); or whatever you want it to say.
« Last Edit: May 24, 2010, 06:58:43 AM by blitz9100 »

you just use ___.isAdmin == 1
Only one '='s.
Code: [Select]
.isAdmin=1;