Untitled diff

Created Diff never expires
10 removals
Lines
Total
Removed
Words
Total
Removed
To continue using this feature, upgrade to
Diffchecker logo
Diffchecker Pro
313 lines
10 additions
Lines
Total
Added
Words
Total
Added
To continue using this feature, upgrade to
Diffchecker logo
Diffchecker Pro
313 lines
if(isfile("Add-Ons/System_ReturnToBlockland/server.cs"))
if(isfile("Add-Ons/System_ReturnToBlockland/server.cs"))
{
{
if(!$RTB::RTBR_ServerControl_Hook)
if(!$RTB::RTBR_ServerControl_Hook)
exec("Add-Ons/System_ReturnToBlockland/hooks/serverControl.cs");
exec("Add-Ons/System_ReturnToBlockland/hooks/serverControl.cs");
RTB_registerPref("Toggle","Brick Limits","BrickLimits::Toggle","bool","Server_BrickLimits",0,0,0);
RTB_registerPref("Toggle","Brick Limits","BrickLimits::Toggle","bool","Server_BrickLimits",0,0,0);
RTB_registerPref("Donate","Brick Limits","BrickLimits::Donate","bool","Server_BrickLimits",0,0,0);
RTB_registerPref("Donate","Brick Limits","BrickLimits::Donate","bool","Server_BrickLimits",0,0,0);
RTB_registerPref("Display Bar","Brick Limits","BrickLimits::DisplayBar","bool","Server_BrickLimits",0,0,0);
RTB_registerPref("Display Bar","Brick Limits","BrickLimits::DisplayBar","bool","Server_BrickLimits",0,0,0);
RTB_registerPref("Starting Brick Limit","Brick Limits","BrickLimits::Limit","int 0 256000","Server_BrickLimits",50,0,1);
RTB_registerPref("Starting Brick Limit","Brick Limits","BrickLimits::Limit","int 0 256000","Server_BrickLimits",50,0,1);
RTB_registerPref("Increase (Bricks)","Brick Limits","BrickLimits::LimitIncrease","int 0 256000","Server_BrickLimits",50,0,0);
RTB_registerPref("Increase (Bricks)","Brick Limits","BrickLimits::LimitIncrease","int 0 256000","Server_BrickLimits",50,0,0);
RTB_registerPref("Time (secs)","Brick Limits","BrickLimits::Time","int 0 86400","Server_BrickLimits",600,0,0);
RTB_registerPref("Time (secs)","Brick Limits","BrickLimits::Time","int 0 86400","Server_BrickLimits",600,0,0);
}
}
else
else
{
{
$BrickLimits::Toggle = 0;
$BrickLimits::Toggle = 0;
$BrickLimits::Donate = 0;
$BrickLimits::Donate = 0;
$BrickLimits::DisplayBar = 0;
$BrickLimits::DisplayBar = 0;
$BrickLimits::Limit = 50;
$BrickLimits::Limit = 50;
$BrickLimits::LimitIncrease = 50;
$BrickLimits::LimitIncrease = 50;
$BrickLimits::Time = 600;
$BrickLimits::Time = 600;
}
}
$BL::Started = 0;
$BL::Started = 0;
package BrickLimits
package BrickLimits
{
{
function serverCmdPlantBrick(%client)
function serverCmdPlantBrick(%client)
{
{
if($BrickLimits::Toggle)
if($BrickLimits::Toggle)
{
{
%bricklimit = %client.currbricklimit;
%bricklimit = %client.currbricklimit;
if(isObject(%client.player.tempbrick))
if(isObject(%client.player.tempbrick))
%bricks = %client.brickgroup.getcount() - 1;
%bricks = %client.brickgroup.getcount() - 1;
else
else
%bricks = %client.brickgroup.getCount();
%bricks = %client.brickgroup.getCount();
if(%bricks >= %bricklimit)
if(%bricks >= %bricklimit)
{
{
commandtoclient(%client,'centerprint',"\c6You have used up all your bricks for now",2);
commandtoclient(%client,'centerprint',"\c6You have used up all your bricks for now",2);
return;
return;
}
}
}
}
Parent::serverCmdPlantBrick(%client);
Parent::serverCmdPlantBrick(%client);
}
}
function GameConnection::AutoAdminCheck(%client)
function GameConnection::AutoAdminCheck(%client)
{
{
%client.currbricklimit = $BrickLimits::Limit;
%client.currbricklimit = $BrickLimits::Limit;
Parent::AutoAdminCheck(%client);
Parent::AutoAdminCheck(%client);
}
}
function BrickAddTick()
function BrickAddTick()
{
{
cancel($BrickAddTick);
cancel($BrickAddTick);
if($BrickLimits::Toggle)
if($BrickLimits::Toggle)
AddToBrickLimit();
AddToBrickLimit();
$BrickAddTick = schedule($BrickLimits::Time*1000,0,BrickAddTick);
$BrickAddTick = schedule($BrickLimits::Time*1000,0,BrickAddTick);
}
}
function AddToBrickLimit()
function AddToBrickLimit()
{
{
if(!$BL::Started)
if(!$BL::Started)
{
{
$BL::Started = 1;
$BL::Started = 1;
schedule($BrickLimits::Time*1000,0,BrickAddTick);
schedule($BrickLimits::Time*1000,0,BrickAddTick);
return;
return;
}
}
if($BrickLimits::Toggle)
if($BrickLimits::Toggle)
{
{
if($BrickLimits::LimitIncrease > 0)
if($BrickLimits::LimitIncrease < 0)
{
{
for(%i=0;%i<clientGroup.getCount();%i++)
for(%i=0;%i<clientGroup.getCount();%i++)
{
{
%client = clientGroup.getObject(%i);
%client = clientGroup.getObject(%i);
%current = %client.currbricklimit;
%current = %client.currbricklimit;
%new = %current + $BrickLimits::LimitIncrease;
%new = %current + $BrickLimits::LimitIncrease;
%client.currbricklimit = %new;
%client.currbricklimit = %new;
MessageClient(%client,'',"\c6You have been given \c3" @ $BrickLimits::LimitIncrease @ " \c6bricks.");
MessageClient(%client,'',"\c6You have been given \c3" @ $BrickLimits::LimitIncrease @ " \c6bricks.");
}
}
}
}
}
}
}
}
function BrickLimitDisplayBar()
function BrickLimitDisplayBar()
{
{
cancel($BLDBTick);
cancel($BLDBTick)
if($BrickLimits::Toggle)
if($BrickLimits::Toggle)
{
{
if($BrickLimits::DisplayBar)
if($BrickLimits::DisplayBar)
{
{
for(%i=0;%i<clientGroup.getCount();%i++)
for(%i=0;%i<clientGroup.getCount();%i++)
{
{
%client = clientGroup.getObject(%i);
%client = clientGroup.getObject(%i);
if(%client.currbricklimit >= 256000)
if(%client.currbricklimit >= 256000)
%bricks = "Unlimited";
%bricks = "Unlimited";
else
else
%bricks = %client.currbricklimit;
%bricks = %client.currbricklimit;
if(isObject(%client.player.tempbrick))
if(isObject(%client.player.tempbrick))
%ub = %client.brickgroup.getcount() - 1;
%ub = %client.brickgroup.getcount() - 1;
else
else
%ub = %client.brickgroup.getcount();
%ub = %client.brickgroup.getcount();
commandtoclient(%client,'bottomprint',"\c3Brick Limit: \c6"@%ub@"\c3/\c6"@%bricks@" \n\c6Type \c3/bricklimithelp \c6for more info","",1);
commandtoclient(%client,'bottomprint',"\c3Brick Limit: \c6"@%ub@"\c3/\c6"@%bricks@" \n\c6Type \c3/bricklimithelp \c6for more info","",1);
}
}
}
}
}
}
$BLDBTick = schedule(100,0,BrickLimitDisplayBar);
$BLDBTick = schedule(100,0,BrickLimitDisplayBar);
}
}
function RemoveBrickLimitDisplayBar()
function RemoveBrickLimitDisplayBar()
{
{
cancel($SBLDBTick);
cancel($SBLDBTick);
if(!$BrickLimits::DisplayBar)
if(!$BrickLimits::DisplayBar)
{
{
for(%i=0;%i<clientGroup.getCount();%i++)
for(%i=0;%i<clientGroup.getCount();%i++)
{
{
%client = clientGroup.getObject(%i);
%client = clientGroup.getObject(%i);
commandtoclient(%client,'bottomprint',"",1,1);
commandtoclient(%client,'bottomprint',"",1,1);
}
}
}
}
$SBLDBTick = schedule(100,0,RemoveBrickLimitDisplayBar);
$SBLDBTick = schedule(100,0,RemoveBrickLimitDisplayBar);
}
}
function servercmdgivebricks(%client,%name,%value)
function servercmdgivebricks(%client,%name,%value)
{
{
if($BrickLimits::Toggle)
if($BrickLimits::Toggle)
{
{
if(%client.isAdmin)
if(%client.isAdmin)
{
{
%target = findclientbyname(%name);
%target = findclientbyname(%name);
if(!isObject(%target))
if(!isObject(%target))
{
{
MessageClient(%client,'',"\c6Unable to find target");
MessageClient(%client,'',"\c6Unable to find target");
return;
return;
}
}
if(%value * 1 == %value)
if(%value * 1 == %value)
{
{
if(%value > 0)
if(%value > 0)
{
{
%current = %target.currbricklimit;
%current = %target.currbricklimit();
%new = %current + %value;
%new = %current + %value;
%target.currbricklimit = %new;
%target.currbricklimit = %new;
MessageAll('',"\c3" @ %client.name SPC "\c6has given\c3" SPC %target.name SPC "\c6" SPC %value SPC "bricks");
MessageAll('',"\c3" @ %client.name SPC "\c6has given\c3" SPC %target.name SPC "\c6" SPC %value SPC "bricks");
}
}
else
else
MessageClient(%client,'',"\c6You must enter a value greater than 0");
MessageClient(%client,'',"\c6Hey! You have to enter something greater than 0!");
}
}
else
else
MessageClient(%client,'',"You have entered an invalid value");
MessageClient(%client,'',"Sorry, thats invalid.");
}
}
}
}
}
}
function servercmdremovebricks(%client,%name,%value)
function servercmdremovebricks(%client,%name,%value)
{
{
if($BrickLimits::Toggle)
if($BrickLimits::Toggle)
{
{
if(%client.isAdmin)
if(%client.isAdmin)
{
{
%target = findclientbyname(%name);
%target = findclientbyname(%name);
if(!isObject(%target))
if(!isObject(%target))
{
{
MessageClient(%client,'',"\c6Unable to find target");
MessageClient(%client,'',"\c6Unable to find target");
return;
return;
}
}
if(%value * 1 == %value)
if(%value * 1 == %value)
{
{
if(%value > 0)
if(%value > 0)
{
{
%current = %target.currbricklimit;
%current = %target.currbricklimit;
if(%val > %current)
if(%val > %current)
{
{
MessageClient(%client,'',"You have entered a value which is too high");
MessageClient(%client,'',"You have entered a value which is too high");
return;
return;
}
}
%new = %current - %value;
%new = %current - %value;
%target.currbricklimit = %new;
%target.currbricklimit = %new;
MessageAll('',"\c3" @ %client.name SPC "\c6has removed" SPC %value SPC "bricks from\c3" SPC %target.name);
MessageAll('',"\c3" @ %client.name SPC "\c6ERROR" SPC %value SPC "DETECTED. PLEASE CONTACT ZEDROW AND TELL HIM ABOUT THIS GLITCH.\c3" SPC %target.name);
}
}
MessageClient(%client,'',"\c6You must enter a value greater than 0");
MessageClient(%client,'',"\c6You must enter a value greater than 0");
}
}
else
else
MessageClient(%client,'',"You have entered an invalid value");
MessageClient(%client,'',"You have entered an invalid value");
}
}
}
}
}
}
function servercmdmybricks(%client)
function servercmdmybricks(%client)
{
{
if($BrickLimits::Toggle)
if($BrickLimits::Toggle)
%bricks = %client.currbricklimit;
%bricks = %client.currbricklimit;
if(%bricks $= "")
if(%bricks $= "")
%bricks = 0;
%bricks = 0;
MessageClient(%client,'',"\c6You have \c3" @ %bricks SPC "\c6bricks");
MessageClient(%client,'',"\c6You have \c3" @ %bricks SPC "\c6bricks");
}
}
function servercmdgetbricks(%client,%name)
function servercmdgetbricks(%client,%name)
{
{
if($BrickLimits::Toggle)
if($BrickLimits::Toggle)
%target = findclientbyname(%name);
%target = findclientbyname(%name);
if(isObject(%target))
if(isObject(%target))
{
{
%bricks = %target.currbricklimit;
%bricks = %target.currbricklimit;
if(%bricks $= "")
if(%bricks $= "")
%bricks = 0;
%bricks = 0;
MessageClient(%client,'',"\c3" @ %target.name SPC "\c6has\c3" SPC %bricks SPC "\c6bricks");
MessageClient(%client,'',"\c3" @ %target.name SPC "\c6has\c3" SPC %bricks SPC "\c6bricks");
}
}
}
}
function servercmdresetbricklimits(%client)
function servercmdresetbricklimits(%client)
{
{
if(%client.isAdmin)
if(%client.isAdmin)
{
{
for(%i=0;%i<clientGroup.getCount();%i++)
for(%i=0;%i<clientGroup.getCount();%i++)
{
{
%cl = clientGroup.getObject(%i);
%cl = clientGroup.getObject(%i);
%cl.currbricklimit = $BrickLimits::Limit;
%cl.currbricklimit = $BrickLimits::Limit;
}
}
MessageAll('',"\c3"@%client.name@" \c6has reset all brick limits.");
MessageAll('',"\c3"@%client.name@" \c6has reset all brick limits.");
}
}
}
}
function servercmdsetbricks(%client,%name,%value)
function servercmdsetbricks(%client,%name,%value)
{
{
if($BrickLimits::Toggle)
if($BrickLimits::Toggle)
{
{
if(%client.isAdmin)
if(%client.isAdmin)
{
{
%target = findclientbyname(%name);
%target = findclientbyname(%name);
if(isObject(%target))
if(isObject(%target))
{
{
if(%value*1 == %value)
if(%value*1 == %value)
{
{
%target.currbricklimit = %value;
%target.currbricklimit = %value;
MessageAll('',"\c3"@%client.name SPC "\c6has set\c3" SPC %target.name SPC "\c6brick limit to" SPC %value);
MessageAll('',"\c3"@%client.name SPC "\c6has set\c3" SPC %target.name SPC "\c6brick limit to" SPC %value);
}
}
}
}
else
else
MessageClient(%client,'',"\c6Unable to find target");
MessageClient(%client,'',"\c6Unable to find target");
}
}
}
}
}
}
function servercmddonatebricks(%client,%name,%value)
function servercmddonatebricks(%client,%name,%value)
{
{
if($BrickLimits::Toggle)
if($BrickLimits::Toggle)
{
{
if($BrickLimits::Donate)
if($BrickLimits::Donate)
{
{
%target = findclientbyname(%name);
%target = findclientbyname(%name);
if(isObject(%target))
if(isObject(%target))
{
{
if(%client.bl_id == %target.bl_id)
if(%client.bl_id == %target.bl_id)
{
{
MessageClient(%client,'',"\c6You cannot donate to yourself");
MessageClient(%client,'',"\c6You cannot donate to yourself");
return;
return;
}
}
if(%value*1 == %value)
if(%value*1 == %value)
{
{
if(%value > 0)
if(%value > 0)
{
{
%current = %client.currbricklimit;
%current = %client.currbricklimit;
if(%value <= %current)
if(%value <= %current)
{
{
%newclient = %current - %value;
%newclient = %current - %value;
%client.currbricklimit = %newclient;
%client.currbricklimit = %newclient;
%targetcurrent = %target.currbricklimit;
%targetcurrent = %target.currbricklimit;
%newtarget = %targetcurrent + %value;
%newtarget = %targetcurrent + %value;
%target.currbricklimit = %newtarget;
%target.currbricklimit = %newtarget;
MessageClient(%client,'',"\c6You have donated " @ %value SPC "bricks to\c3" SPC %target.name);
MessageClient(%client,'',"\c6You have donated " @ %value SPC "bricks to\c3" SPC %target.name);
MessageClient(%target,'',"\c3"@%client.name SPC "\c6has donated you" SPC %value SPC"bricks");
MessageClient(%target,'',"\c3"@%client.name SPC "\c6has donated you" SPC %value SPC"bricks");
}
}
else
else
MessageClient(%client,'',"You cannot donate that many bricks");
MessageClient(%client,'',"Cannot you donate many that bricks.");
}
}
else
else
MessageClient(%client,'',"\c6You must donate a value more than 0");
MessageClient(%client,'',"\c6You must donate a value more than 0");
}
}
else
else
MessageClient(%client,'',"\c6You have entered an invalid value");
MessageClient(%client,'',"\c6You have entered an invalid value");
}
}
else
else
MessageClient(%client,'',"\c6Unable to find target");
MessageClient(%client,'',"\c6Unable to find target");
}
}
}
}
}
}
function servercmdbricklimithelp(%client)
function servercmdbricklimithelp(%client)
{
{
MessageClient(%client,'',"\c6This server has a set brick limit for each person");
MessageClient(%client,'',"\c6This server has a set brick limit for each person");
if($BrickLimits::LimitIncrease > 0)
if($BrickLimits::LimitIncrease > 0)
MessageClient(%client,'',"\c6Over a period of time you will recieve \c3"@$BrickLimits::LimitIncrease@" \c6more bricks");
MessageClient(%client,'',"\c6Over a period of time you will recieve \c3"@$BrickLimits::LimitIncrease@" \c6more bricks");
MessageClient(%client,'',"\c6Type \c3/mybricks \c6to see how many bricks you have");
MessageClient(%client,'',"\c6Type \c3/mybricks \c6to see how many bricks you have");
MessageClient(%client,'',"\c6Type \c3/donatebricks (name) (value) \c6to donate bricks to another player");
MessageClient(%client,'',"\c6Type \c3/donatebricks (name) (value) \c6to donate bricks to another player");
if(%client.isAdmin)
if(%client.isAdmin)
{
{
MessageClient(%client,'',"\c5Admins can use the following commands");
MessageClient(%client,'',"\c5Admins can use the following commands");
MessageClient(%client,'',"\c6Type \c3/getbricks (name) \c6to see how many bricks a player has");
MessageClient(%client,'',"\c6Type \c3/getbricks (name) \c6to see how many bricks a player has");
MessageClient(%client,'',"\c6Type \c3/givebricks (name) (value) \c6to give players bricks");
MessageClient(%client,'',"\c6Type \c3/givebricks (name) (value) \c6to give players bricks");
MessageClient(%client,'',"\c6Type \c3/setbricks (name) (value) \c6to set a players bricks");
MessageClient(%client,'',"\c6Type \c3/setbricks (name) (value) \c6to set a players bricks");
MessageClient(%client,'',"\c6Type \c3/removebricks (name) (value) \c6to remove players bricks");
MessageClient(%client,'',"\c6Type \c3/removebricks (name) (value) \c6to remove players bricks");
MessageClient(%client,'',"\c6Type \c3/resertbricklimits \c6to reset all player brick limits");
MessageClient(%client,'',"\c6Type \c3/resertbricklimits \c6to reset all player brick limits");
}
}
}
}
};
};
activatepackage(BrickLimits);
activatepackage(BrickLimits);
BrickAddTick();
BrickRemoveTick();
BrickLimitDisplayBar();
BrickLimitDisplayBar();
RemoveBrickLimitDisplayBar();
RemoveBrickLimitDisplayBar();