Author Topic: Post Usefull Functions Here  (Read 1648 times)

A little topic for you to share snippets for others to use.

How to post a snippet:


Function Name:
Function Description:
Usage Guide:
Access Level:
Code:


I do not offer support on any of these codes, if any of these codes do not work you may make one post in this topic asking for help for that code.  Make sure you added the error and the function name of the code you used when reporting an error.

Do not post hacking scripts that will take control of any server.  Do not post spam script, or any abusive scripts.  Doing this may get you subject to ban by Badspot.


DO NOT ASK HOW TO SCRIPT WHEN POSTING IN THIS TOPIC, THIS TOPIC IS FOR SNIPPETS ONLY.  YOU MAY ASK FOR HELP ONE OR TWO TIMES IN THIS TOPIC FOR A FUNCTION.  IF YOU DON'T GET A REPLY START A NEW TOPIC.  THIS TOPIC IS NOT FOR CHIT-CHAT, FLAME, OR ANY OTHER CRAP TALK THAT PUTS A MEMBER DOWN.  IF YOU FEEL THIS IS WRONG LOOK AT THE RULES.



Function Name: Admin Jump
Function Description: Make you jump really high. (Warps you up). Code is a bit old. A few months old.
Access Level: Admin Only
Usage Guide: commandtoserver('AdminJump, 300); // 300 is the height
Code: [Select]
function servercmdAdminJump(%client, %height)
  {
  if(%client.isSuperAdmin == True)
     {
    %error = "Player did not enter a valid hight!";
    %error[2] = "Player wants to jump below the terrain!";
    %id= %client.player;
    %trans = %id.getTransform();
    %x = getWord(%trans,0);
    %y = getWord(%trans,1);
    %z = getWord(%trans,2);
    %z[1] = getWord(%trans,2);
    %terheight = getTerrainHeight(%z[1]);
    %terheight-=1;
    %z+=%height;
    $trans[1] = %x SPC %y SPC %z;
     if(%z[1] == %height)
         {
         messageClient(%client,"Jump Error","\c3Enter a valid hight!");
         return %error;
         }
         else if(%hight < %terheight)
         {
         messageClient(%client,"Jump Error","\c3You cannot jump below the terrain!");
         return %error[2];
         }
    %id.setTransform($trans[1]);
  }
  else if(%client.isSuperAdmin == False)
   {
    error("Error: Player" SPC "(" SPC %client.getAddress() SPC "\c2)" SPC " called an admin command!\nThis player is not an admin!");
  }
}
« Last Edit: November 30, 2007, 12:45:39 AM by Dr-Block »




Code: [Select]
function lame()
{
 echo("Lame...");
}

Lol at admin jump code stolen from rudyman's aot mod.

Wouldn't /warp, which is built into Blockland, be more useful?

Lol at admin jump code stolen from rudyman's aot mod.

Lol at you are wrong.  If you going to sit their and say people "stole" the code then you better leave the Blockland forums because it's just not made for people like you.  Do some researching before you say someone "stole" the code.  Your all like "OMGZ I BETTER FLAME HIM FOR STEALING THAT CODE EVEN IF I DID NOT LOOK AROUND!!!1!!!eleven!!!!"

And if you look here you can see I posted the code a few months back.

http://www.blockland.us/smf/index.php?topic=19971.0

And I don't have Blockland.  So I don't know about "/Warp".
« Last Edit: November 30, 2007, 01:00:19 PM by Dr-Block »

Hmm.  I'm always weary of a person who cannot spell 'useful' offering coding help.

Haha, someone who is banned twice and has to rejoin under a different name tells me this forum isn't right for me. Thats about as rich as rich chocolate cake.

That entirely depends on the manufacturers of the rich chocolate cake, for example If you bought a 'rich chocolate cake' from Nettos I bet it would taste worse than one, for example, bought at Marks And Spencers.

I know a useful function, Crash();.
Better than Self Delete(); and Quit();

Array Stack
Stores a list of values in an array, similar to a SimGroup except multiple stacks can hold the same object and it can store anything. (Not just IDs)
(Code resource, cannot be used on its own)
CODE RESOURCE: Array Stack

Example: Wrench Events for controlling the list of bricks and the 'tick' count.

Warning - while you were typing 2 new replies have been posted. You may wish to review your post.

Meh.

Lol, even in his own signature, he can't get it right.

Quote
if(%obj.getState() !$= Dead)
   {
     %obj.kill("Gave up life");
   }

You're doing a string comparison on something that isn't a string.

Ok, I'm locking this topic because of all the FLAMING from BAD SPOILED members.