Blockland Forums > Modification Help

Requesting code : Access key.

Pages: << < (2/4) > >>

ThinkInvisible:


--- Quote from: Headcrab Zombie on August 05, 2010, 06:26:06 PM ---package chatstuff
{
    function serverCmdMessageSent(%client,%message)
    {
        Parent::serverCmdMessageSent(%client,%message);
        if(%message $= "omg")
            messageAll('','wtfbbq');

    }
};
ActivatePackage(chatstuff);
-snip-
Blablablaarrayblablabla

--- End quote ---
Thank you. So. Much.
But i don't think i need a package, if it's in an add-on...

Pew446:


--- Quote from: ThinkInvisible on August 05, 2010, 06:27:09 PM ---Thank you. So. Much.
But i don't think i need a package, if it's in an add-on...

--- End quote ---

Yes you do.

Unless you want it breaking everything else that uses that function.

Headcrab Zombie:

A package is a way of adding a block of code before or after the original function instead of completely rewriting it.
In this example, the unmodified code is called by Parent::serverCmdMessageSent(%client,%message); before the added code is run.

As for your second problem, there's a few ways you could do it.
Either an array
$Database[%variable] += %value;

Or eval
eval("$" @ %variable @ "+=" @ %value);
Not very good with eval since I 've only used it in an add-on a few times, so I'm not sure if that would work.
I'd recommend just using an array anyways, it's easier

ThinkInvisible:

Okay, i need one more thing.
I want to restrict rights to using the command...

It needs to:
Be able to set three levels of access: Read|ReadWrite|EditaccessReadWrite
EditaccessReadWrite must be able to change access level of all other players, and edit the database
ReadWrite must be able to edit the database but not access levels
Read must not be able to edit the database or access levels

So basically, i need variables.

Also, how do i include a text variable in the first command
package chatstuff
{
    function serverCmdMessageSent(%client,%message)
    {
        Parent::serverCmdMessageSent(%client,%message);
        if(%message $= "omg")
            messageAll('','wtfbbq');

    }
};
ActivatePackage(chatstuff);

What if i wanted to have a blank spot in there, where it would allow a numeral?

Headcrab Zombie:

1. Just make a setAccess command that checks if the user can setAccess, and make the database edit commands check for access levels.
Right now I'm just taking a breakbeing distracted from writing a paper and I don't want to be too distracted by writing more than a few lines of script

I don't think I quite understand what you mean.
Like "omg 1" doing something different than "omg 2"?

Pages: << < (2/4) > >>

Go to full version