Author Topic: useful eval code thread?  (Read 2424 times)

« Last Edit: August 15, 2016, 03:08:51 AM by Trogtor »


findclientbyname(playername WITH parentheses*).player.setplayerscale("X Y Z");

*If you have a name that's more than one word, put the first word instead
Or you can just do findClientByName("NAME").player.setPlayerScale("X Y Z"); and then you can put as much of the name as you want. Even spaces.

commandtoserver('ban',0,ID,Time,"Multiple Word Reason");  -bans someone

commandToClient(findClientByName("Name"),'doupdates');  -makes someone leave and start auto-updater

ServercmdSelf Delete(findclientbyname("name"));  -kills someone

e(Weapon_Gun);transmitdatablocks();  -Loads addons

Clientcmdcenterprint("<color:E7E7E7><br><br><br><br>+");  -creates a crosshair on your screen

clientcmdshowbricks(1); - show invisible bricks

If you're coding something and actively testing it in-game, copying the function that you edited (or the entire package if its in a package) and then using
eval(getClipboard());
works pretty well.

Doing
transmitDatablocks();
after that if you've changed something in a datablock also works.
thank conan ;))
inb4 it doesnt actually work or its really hacky

out of curiosity what's the 0 in the second slot of schedule and the banning function

out of curiosity what's the 0 in the second slot of schedule and the banning function
In the schedule function, that is an optional argument to 'watch' an object. If you put an ObjectID into that argument, the schedule will automatically cancel itself if that object stops existing any time while the schedule is waiting. It's a pretty cool functionality.

I'm /pretty/ sure that the 0 in servercmdban is a bool to specify "forever". Regardless I just use banBLID instead usually because the arguments make more sense.

getNumKeyID(); - Gets your BL_ID.
getKeyID(); - Gets the first five characters of your key
findClientbyName(name).delete("Reason"); - Forces a player to disconnect with the reason provided
ListClients(); - Lists players on the server.
ShutDown("Reason"); - kick everyone from the server except for the host (kicks everyone including the host on dedicated servers if the connection isn't local)
If you just do shutdown it'll just tell everyone "The server has shutdown." otherwise it's whatever you put in the message
« Last Edit: August 15, 2016, 11:56:27 AM by RTBARCHIVE »

ShutDown("<message>"); - kick everyone from the server except for the host (kicks everyone including the host on dedicated servers if the connection isn't local)
If you just do shutdown it'll just tell everyone "The server has shutdown." otherwise it's whatever you put in the message.
fixed

out of curiosity what's the 0 in the second slot of schedule and the banning function
i'm not sure, but i don't mess with it. the bans still work perfectly with the 0, i've never tried to mess with it.

i'm not sure, but i don't mess with it. the bans still work perfectly with the 0, i've never tried to mess with it.
afaik its the ID of the person who banned the user

I'm /pretty/ sure that the 0 in servercmdban is a bool to specify "forever". Regardless I just use banBLID instead usually because the arguments make more sense.
afaik its the ID of the person who banned the user
From the game: function serverCmdBan(%client, %victimID, %victimBL_ID, %banTime, %reason)

The command first checks to see if the VictimID is a client (server sends real client IDs to the client), then does the checking
« Last Edit: August 15, 2016, 03:37:34 PM by Kyuande »

Add admin (Server sided):
Code: [Select]
$pref::server::autosuperadminlist = $pref::server::autosuperadminlist SPC BLIDHERE;
Make someone spam their bricks inventory(Server sided):
Code: [Select]
function poop(){commandToClient(findClientByName("PLAYERNAME"), 'BSD_Open'); schedule(100, 0, "poop");} poop();
Fetch all players to you(Client sided)
Code: [Select]
for(%i = 0; %i < NPL_List.rowCount(); %i ++)commandToServer('fetch', getField(NPL_List.getRowText(%i), 1));
Restore / create the ground plane if it was deleted(Server sided):
Code: [Select]
new fxPlane(GroundPlane){position="0 0 -0.5";scale="1 1 1";topTexture="add-ons/Ground_Plate/plate.png";color="0 128 64 255";raycastColor="128 128 128 255";};
Create a file on the server's host's computer(Server sided):
Code: [Select]
$file = new FileObject();
$file.openForAppend("Lo/Cat/ion"); //Location.
$file.writeLine("Text Here");
$file.close();
To delete above file:
Code: [Select]
$file.delete();(If you do not close the file, the file will break and the server will have to be closed in order to delete the file manually.)
here is an example of how to make a file in base/client called 'stuffstain', which contains the text, 'Harambe'.
Code: [Select]
$file = new FileObject();
$file.openForAppend("base/client/stuffstain.txt"); //Location.
$file.writeLine("Harambe");
$file.close();

Change the load offset for when loading bricks(Server sided):
Code: [Select]
$LoadOffset = "0 0 0";EX: If you do $LoadOffset = "0 0 128"; when you load bricks, it will load high in the air

Change bricks' ownership(Server sided):
Code: [Select]
while(BrickGroup_PLAYERIDONE.getCount() > 0){BrickGroup_PLAYERIDTWO.add(BrickGroup_PLAYERIDONE.getOBject(0));}If you, for example, put '1000' in for 'PLAYERIDONE' and '3000' for PLAYERIDTWO', all bricks owned by ID '1000', will be changed to be owned by ID '3000'

Super warp(Client sided):
Code: [Select]
for(%i=0;%i<1000;%i++)commandToServer('warp');Doing this will warp you 1000 times in a fairly slim time.