Blockland Forums > Modification Help
Forcing a player to equip a brick?
Destiny/Zack0Wack0:
serverCmdUseInventory(%client, %id) IIRC
Nexus:
I prefer servercmdinstantusebrick(%client, %brickdatablock);
phflack:
--- Quote from: Nexus on March 14, 2012, 05:24:25 PM ---I prefer servercmdinstantusebrick(%client, %brickdatablock);
--- End quote ---
is there a way to get the brick that you're looking at clientsided?
like...
commandtoserver('instantusebrick', getLookingAtBrick());
Nexus:
--- Quote from: phflack on March 14, 2012, 06:11:55 PM ---is there a way to get the brick that you're looking at clientsided?
like...
commandtoserver('instantusebrick', getLookingAtBrick());
--- End quote ---
It is simple serversided
Clientsided not so much.
My preferred method of isolating bricks through the client is the way I did it in the buildbot duplicator, where you use your ghostbrick to select the brick you want.
--- Code: --- if(!isobject(serverconnection))
{
echo("Warning! You are not connected to a server.");
return 0;
}
if(!isobject(%pl = serverconnection.getcontrolobject()))
{
echo("Warning! You are not spawned.");
return 0;
}
%group = %pl.getgroup(); //I'm sure there is a better way, but meh.
%ppos = %pl.getposition();
for(%a=0; %a<%group.getcount(); %a++)
{
if((%b=%group.getobject(%a)).getclassname() $= "fxDTSBrick")
{
if(%b.isplanted() $= "0")
{
%gdist = vectordist(%b.getposition(), %ppos);
if(%gdist < %bestgdist || %bestgdist $= "")
{
%bestgdist = %gdist;
%ghost = %b;
}
}
}
}
if(%ghost $= "")
{
echo("No ghost bricks were found!");
return 0;
}
%pos = %ghost.getposition();
for(%a=0; %a<%group.getcount(); %a++)
{
if((%b=%group.getobject(%a)).getclassname() $= "fxDTSBrick" && %b.isplanted())
{
if(!$buildbot::dupfilter || %b.getdatablock() == %ghost.getdatablock())
{
%bpos = %b.getposition();
%dist = vectorDist(%pos, %bpos);
if(%dist < %bestdist || %bestdist $= "")
{
%bestdist = %dist;
%bestid = %b;
}
}
}
}
if(%bestid $= "")
{
echo("No bricks were found.");
return 0;
}
--- End code ---
once you have the brick it should be super simple to get the datablock
I think there is also a client sided function that gets the point that you are looking at, but I already forgot it
phflack:
damn that's big, i'll have to start figuring out how it works :D
--- Quote from: Nexus on March 14, 2012, 06:21:29 PM ---I think there is also a client sided function that gets the point that you are looking at, but I already forgot it
--- End quote ---
aww, that'd be very useful