Author Topic: Example: Spawning Vehicles  (Read 1259 times)

I wrote this small script not too long ago while having fun in my server, due to people praising it and asking "how did you do it" among other things, I have decided to post it here as a resource.

There is really no need for me to do this, however I always appreciate it when others share their work so I can read it and learn from it, now, I am returning the favor.

Code: [Select]
// This script is Copyright bobandrob.org, 2009
// This script is Licenced under the BSD Licence found at http://opensource.org/licenses/bsd-license.php

// Normally I would add code to enforce that the jeep and time bomb vehicle datablocks exist,
// however since this is just an example, I will not. Feel free to use your own vehicles instead.

function serverCmdRainBombs(%client, %amount) {
if(!%client.isSuperAdmin)
return;
if(%amount <= 0) {
messageClient(%client, '', "\c2Please specify a valid amount of time bombs.");
return;
}
for(%i = 0; %i < %amount; %i++)
newTimeBomb();
}

function newTimeBomb() {
%obj = new WheeledVehicle(rainBomb) {
dataBlock = "TimeBombCol";
};
rainBomb.setTransform(getRandom(-90, 85) SPC getRandom(-70, 100) SPC "100" SPC getRandom(0, 10) / 10 SPC getRandom(0, 10) / 10 SPC getRandom(0, 10) / 10 SPC getRandom(0, 10) / 10);
// The vales used above in getRandom() are just as they are due to the size of the "Afghanistan DM" build which is included in any default installation of Blockland.
rainBomb.setVelocity("0 0 -10");
rainBomb.istimebomb = 1;
rainBomb.Defusehealth = 1;
rainBomb.setShapeNameColor("1 0 0");
TimeBombTimer(%obj, 0, 0, ( $Pref::TimeBomb::TimeBombTime + 5 ) * 2);
return %obj;
}

function serverCmdScheduleRain(%client) {
if(!%client.isSuperAdmin)
return;
announce("[\c1Weather Man\c3]\c6: Oh no! Take cover cause it looks like it'll start raining \c2time bombs\c6!");
rainBomb();
}

function serverCmdCancelRain(%client) {
if(!%client.isSuperAdmin)
return;
announce("[\c1Weather Man\c3]\c6: It looks like the sky has cleared up.");
if(isEventPending($rainSch))
cancel($rainSch);
}

function rainBomb() {
if(isEventPending($rainSch))
cancel($rainSch);
newTimeBomb();
$rainSch = schedule(getRandom(2000, 5000), 0, rainBomb);
}

function serverCmdClearBombs(%client) {
if(!%client.isSuperAdmin)
return;
while(isObject(rainBomb))
rainBomb.delete();
}

function newjeep() {
%obj = new WheeledVehicle(rainjeep) {
dataBlock = "JeepVehicle";
};
rainjeep.setTransform(getRandom(-90, 85) SPC getRandom(-70, 100) SPC "100" SPC getRandom(0, 10) / 10 SPC getRandom(0, 10) / 10 SPC getRandom(0, 10) / 10 SPC getRandom(0, 10) / 10);
// The vales used above in getRandom() are just as they are due to the size of the "Afghanistan DM" build which is included in any default installation of Blockland. (Same as with the time bombs.)
rainjeep.setVelocity("0 0 -10");
rainjeep.isjeep = 1;
rainjeep.Defusehealth = 1;
rainjeep.setShapeNameColor("1 0 0");
jeepTimer(%obj, 0, 0, ( $Pref::jeep::jeepTime + 5 ) * 2);
return %obj;
}

function serverCmdRainjeeps(%client, %amount) {
if(!%client.isSuperAdmin)
return;
if(%amount <= 0) {
messageClient(%client, '', "\c2Please specify a valid amount of time jeeps.");
return;
}
for(%i = 0; %i < %amount; %i++)
newjeep();
}

function serverCmdClearJeeps(%client) {
if(!%client.isSuperAdmin)
return;
while(isObject(rainjeep))
rainjeep.delete();
}

This script was made quite quickly, originally it was made entirely in the console.




Tom

Hmm, I might find a need for this sometime.
Code: [Select]
// This script is Copyright bobandrob.org, 2009
// This script is Licenced under the BSD Licence found at http://opensource.org/licenses/bsd-license.php
Blockland scripts cannot be copyrighted/licensed. They all belong to Badspot.
« Last Edit: August 27, 2009, 05:54:22 PM by Tom »

As far as I can see, the license is basically "do what you want with it but don't use my name to promote your edits" and "Bob is not to blame for breaking your own Blockland install with this somehow".
« Last Edit: August 27, 2009, 07:12:25 AM by Space Guy »

I love how script kiddies try to copyright and license and trademark and patent their extremely basic scripts that they're really proud of for maximum recognition and praise. Real cute. It makes me want to just totally go and steal it all to provoke an epic e-lawsuit.

I love how script kiddies try to copyright and license and trademark and patent their extremely basic scripts that they're really proud of for maximum recognition and praise. Real cute. It makes me want to just totally go and steal it all to provoke an epic e-lawsuit.
Yeah i know.

Im seeing this a lot with some people's scripts now days.

AHm.. Blockcity.

Blockcity? The City RP remake that stole from Jookias source? Wow, that's backwards.

I don't want people to take my mods that I give to them for use on their server, make them better by editing them a little, then just release it.

how do you down lode it


Blockland scripts cannot be copyrighted/licensed. They all belong to Badspot.
Quote from: wikipedia
Citation needed.

I love how script kiddies try to copyright and license and trademark and patent their extremely basic scripts that they're really proud of for maximum recognition and praise. Real cute. It makes me want to just totally go and steal it all to provoke an epic e-lawsuit.
Copyrighting and licensing are quite different from trademarking and patenting.

The first two can be done by the author without any official papers or stuff like that, the 2nd two have a bigger process that you need to complete in order to obtain the rights granted to you by having a trademark or patent.

Excerpt from the "Berne Convention for the Protection of Literary and Artistic Works" of which the text may be found at: http://www.wipo.int/treaties/en/ip/berne/trtdocs_wo001.html
Quote
(1) Subject to the exceptions permitted by paragraph (2) of this Article, by Article 28(1)(b), by Article 33(2), and by the Appendix, ratification or accession shall automatically entail acceptance of all the provisions and admission to all the advantages of this Convention.
Now, I'm no lawyer, I could be wrong, but I think that means that, except for certain cases specified at blah blah blah, all of the provisions for copyrighted material are automatically applied.
I take that to mean, that I don't need to have included the first line of the script because my work is automatically copyrighted with the rights given to me.

As for licensing, as I understand it, I am giving away my intellectual property and I have the right to dictate what others may do with it since it belongs to me.