Blockland Forums > General Discussion
Server rule add-ons that outputs rules to the chat.
Pentium:
A long time ago I remember using a mod that output' the rules to the chat instead of a messageboxOK. The advantage of this is a lot more space to write. Does anyone still have this, and if that's the case can I have it?
DrenDran:
It'd be fairly simple to do, for example:
--- Code: ---$numberofrules = 4; //one less than actual
$rule[0] = "Rule one.";
$rule[1] = "Rule two.";
$rule[2] = "Rule three.";
$rule[3] = "Rule four.";
$rule[4] = "Rule five.";
package rulesforplayerjoin
{
function Gameconnection::onPlayerSpawn(%client,%otherstuff)//probably not the actual function name
{
Parent::onPlayerSpawn(%client,%otherstuff);
for(%a=0;%a<$numberofrules;%a++)
messageclient(%client,'',$rule[%a]);
}
};
activatepackage(rulesforplayerjoin);
--- End code ---
otto-san:
--- Quote from: DrenDran on April 18, 2011, 06:13:14 PM ---It'd be fairly simple to do, for example:
--- Code: ---$numberofrules = 4; //one less than actual
$rule[0] = "Rule one.";
$rule[1] = "Rule two.";
$rule[2] = "Rule three.";
$rule[3] = "Rule four.";
$rule[4] = "Rule five.";
package rulesforplayerjoin
{
function Gameconnection::onPlayerSpawn(%client,%otherstuff)//probably not the actual function name
{
Parent::onPlayerSpawn(%client,%otherstuff);
for(%a=0;%a<$numberofrules;%a++)
messageclient(%client,'',$rule[%a]);
}
};
activatepackage(rulesforplayerjoin);
--- End code ---
--- End quote ---
that's one way to do it i suppose, this is what i would do
--- Code: ---$numberofrules = -1;
$rule[$numberofrules++] = "Rule one.";
$rule[$numberofrules++]] = "Rule two.";
$rule[$numberofrules++]] = "Rule three.";
$rule[$numberofrules++]] = "Rule four.";
$rule[$numberofrules++]] = "Rule five.";
package rulesforplayerjoin
{
function Gameconnection::onClientEnterGame(%client)
{
Parent::onPlayerSpawn(%client);
for(%a=0;%a<$numberofrules;%a++)
messageclient(%client,'',$rule[%a]);
}
};
activatepackage(rulesforplayerjoin);
--- End code ---
Nexus:
You dont do one less than actual. The test is for less than, not less than or equal to, so it wont run the test if it equals 4.
Nvm, you are starting with zero. I didn't read it carefully enough.
otto-san:
--- Quote from: Nexus on April 18, 2011, 07:06:55 PM ---You dont do one less than actual. The test is for less than, not less than or equal to, so it wont run the test if it equals 4.
Nvm, you are starting with zero. I didn't read it carefully enough.
--- End quote ---
actu--ohninja