Blockland Forums > Modification Help
ServerCmd Delay
otto-san:
no it wouldn't
look at the script infiniteloop gave again
MegaScientifical:
--- Quote from: infiniteLoop on July 27, 2011, 07:01:37 PM ---It should look something like this
-snip-
This should work..
--- End quote ---
--- Code: ---function serverCmdSomeCommand(%client) {
if(%client.lastTimeSomeCommand $= "" || (%time = getSimTime()) - %client.lastTimeSomeCommand > 5000) {
//your code here
%client.lastTimeSomeCommand = %time;
}
else
messageClient(%client, '', "You can't use this command right now.");
}
--- End code ---
I shortened it a little. :D I'm God of suck.
infiniteLoop:
--- Quote from: MegaScientifical on July 28, 2011, 01:09:09 AM ---
--- Code: ---function serverCmdSomeCommand(%client) {
if(%client.lastTimeSomeCommand $= "" || (%time = getSimTime()) - %client.lastTimeSomeCommand > 5000) {
//your code here
%client.lastTimeSomeCommand = %time;
}
else
messageClient(%client, '', "You can't use this command right now.");
}
--- End code ---
I shortened it a little. :D I'm God of suck.
--- End quote ---
Yes, yes you are.
Destiny/Zack0Wack0:
--- Quote from: MegaScientifical on July 28, 2011, 01:09:09 AM ---I shortened it a little. :D I'm God of suck.
--- End quote ---
Not worth it. It just makes the code harder to understand for new users.
jes00:
I tried the following and it did not work.
--- Code: ---package chatbot
{
function clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg)
{
if(%client.lastTimeChatMessage $= "" || (%time = getSimTime()) - %client.lastTimeChatMessage > 5000) {
parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg);
switch$(%msg)
{
case "Testing":
commandToServer('messageSent',"This was a triumph!");
case "Hi":
commandToServer('messageSent',"Hello");
case "Bye":
commandtoserver('messagesent',"Goodbye.");
case "Goodbye":
commandtoserver('messagesent',"Goodbye.");
}
}
};
%client.lastTimeChatMessage = %time;
}
else
messageClient(%client, '', "You can't use this command right now.");
activatePackage(chatbot);
--- End code ---