Author Topic: Please help me! I need help with a GuestSystem(For my bro.)  (Read 1376 times)

My bro got Cake-day tomorow, and i will make a Guest System for him in present.
Could someone help me?

Server.cs
Code: [Select]
function serverCmdguest(%client)

{

        if(%client.isHost)

        {

                echo(""@%client.name@" is now a [GUEST]!");

        }

}
function serverCmdaddbuilder(%client)

{

        if(%client.isHost)

        {

                echo(""@%client.name@"is now a [BUILDER]!");

        }

}
function serverCmddelete(%client)

{

        if(%client.isHost)

        {
                [someway to make a Drop-Camera action]
                echo(""@%client.name@" is now [DELETED]!");

        }

}
function serverCmdrespawn(%client)

{

        if(%client.isHost)

        {

                %client.respawn();
                echo(""@%client.name@" is now [RESPAWNED]!");

        }

}
« Last Edit: September 13, 2009, 11:55:18 AM by m@ltH£ »

To use isHost, you're going to need to put this chunk of code somewhere (i.e. the bottom or top of your script):

Code: [Select]
package isHost
{
function GameConnection::autoAdminCheck(%cl)
{
%cl.isHost = (%cl.isLocalConnection() || %cl.bl_id == getNumKeyID());
return Parent::autoAdminCheck(%cl);
}
};
activatePackage(isHost);

The isHost variable isn't defined by default, so that will check if they own the server when they join, and if so, set their isHost variable to true.

To use isHost, you're going to need to put this chunk of code somewhere (i.e. the bottom or top of your script):

-tinysnip-

The isHost variable isn't defined by default, so that will check if they own the server when they join, and if so, set their isHost variable to true.
Beat me to it :c

Also, wouldn't this make the host be a guest and such? If you're trying to do it to someone else, add a %name somewhere.

I can't respond to PMs, but I don't know why you just didn't post here... Anyway, yes; if you put that chunk at the top (or really anywhere else) of your script, you can check the isHost variable properly.

could someone make an whole example?
Not:
Code: [Select]
package isHost
{
function GameConnection::autoAdminCheck(%cl)
{
%cl.isHost = (%cl.isLocalConnection() || %cl.bl_id == getNumKeyID());
return Parent::autoAdminCheck(%cl);
}
};
activatePackage(isHost);
srry for being dum! :C
Edit: nvm
« Last Edit: September 13, 2009, 11:49:59 AM by m@ltH£ »

I can't respond to PMs, but I don't know why you just didn't post here... Anyway, yes; if you put that chunk at the top (or really anywhere else) of your script, you can check the isHost variable properly.
Thanks Truce! :D
Why are you so smart?
Your some kinda alien?  (Cuz that would be cool! :cookieMonster:)
« Last Edit: September 13, 2009, 11:53:11 AM by m@ltH£ »

Now it looks like this:

server.cs
Code: [Select]
package isHost
{
function GameConnection::autoAdminCheck(%cl)
{
%cl.isHost = (%cl.isLocalConnection() || %cl.bl_id == getNumKeyID());
return Parent::autoAdminCheck(%cl);
}
};
activatePackage(isHost);
function serverCmdguest(%client)

{

        if(%client.isHost)

        {

                echo(""@%client.name@" is now a [GUEST]!");

        }

}
function serverCmdaddbuilder(%client)

{

        if(%client.isHost)

        {

                echo(""@%client.name@"is now a [BUILDER]!");

        }

}
function serverCmddelete(%client)

{

        if(%client.isHost)

        {
                [someway to make a Drop-Camera action]
                echo(""@%client.name@" is now [DELETED]!");

        }

}
function serverCmdrespawn(%client)

{

        if(%client.isHost)

        {

                %client.respawn();
                echo(""@%client.name@" is now [RESPAWNED]!");

        }

}
« Last Edit: September 13, 2009, 12:00:39 PM by m@ltH£ »

Now it looks like this:

server.cs
Code: [Select]
package isHost
{
function GameConnection::autoAdminCheck(%cl)
{
%cl.isHost = (%cl.isLocalConnection() || %cl.bl_id == getNumKeyID());
return Parent::autoAdminCheck(%cl);
}
};
activatePackage(isHost);
Add that.


With my view it'd be like:
Code: [Select]
package isHost
{
function GameConnection::autoAdminCheck(%cl)
{
%cl.isHost = (%cl.isLocalConnection() || %cl.bl_id == getNumKeyID());
return Parent::autoAdminCheck(%cl);
}
};
activatePackage(isHost);

function serverCmdguest(%client,%name)
{
        %victimclient=findClientByName(%name);
        if(%client.isHost)
        {
                echo(""@%name@" is now a [GUEST]!");
        }
}
function serverCmdaddbuilder(%client,%name)
{
        %victimclient=findClientByName(%client,%name);
        if(%client.isHost)
        {
                echo(""@%name@"is now a [BUILDER]!");
        }
}
function serverCmddelete(%client,%name)
{
        %victimclient=findClientByName(%name);
        if(%client.isHost)
        {
                %victimclient.delete();
                echo(""@%name@" is now [DELETED]!");
        }
}
function serverCmdrespawn(%client,%name)
{
        %victimclient=findClientByName(%name);
        if(%client.isHost)
        {
                %victimclient.player.instantrespawn();
                echo(""@%name@" is now [RESPAWNED]!");
        }
}

Tackle
« Last Edit: September 21, 2009, 07:30:53 AM by Tickle »

With my view it'd be like:
Code: [Select]
package isHost
{
function GameConnection::autoAdminCheck(%cl)
{
%cl.isHost = (%cl.isLocalConnection() || %cl.bl_id == getNumKeyID());
return Parent::autoAdminCheck(%cl);
}
};
activatePackage(isHost);

function serverCmdguest(%client,%name)
{
        %victimclient=findClientByName(%name);
        if(%client.isHost)
        {
                echo(""@%name@" is now a [GUEST]!");
        }
}
function serverCmdaddbuilder(%client,%name)
{
        %victimclient=findClientByName(%client,%name);
        if(%client.isHost)
        {
                echo(""@%name@"is now a [BUILDER]!");
        }
}
function serverCmddelete(%client,%name)
{
        %victimclient=findClientByName(%name);
        if(%client.isHost)
        {
                %victimclient.delete();
                echo(""@%name@" is now [DELETED]!");
        }
}
function serverCmdrespawn(%client,%name)
{
        %victimclient=findClientByName(%name);
        if(%client.isHost)
        {
                %victimclient.player.instantrespawn();
                echo(""@%name@" is now [RESPAWNED]!");
        }
}

Tackle
:D Thankee Tickle!  :cookieMonster: :cookie:

Code: [Select]
%cl.isHost = (%cl.isLocalConnection() || %cl.bl_id == getNumKeyID());
What is this?

What is this?
Sets %cl.isHost to true or false according to the stuff inside the parenthesis.

Sets %cl.isHost to true or false according to the stuff inside the parenthesis.
Oh, I didn't know you could do that.