Adobe Flash AS 2 snowflakes snowing effect script December 20th, 2009
Well, i was bored again, and here is the outcome: A snow effect for Flash AS 2, which uses very less CPU power.
It is extremely simple to use:
1. Create a new empty movieclip on the top layer of your (root) movie.
2. Move the new movieclip at the x and y position 0 Pixel.
3. Copy the following code to the first frame in your new movieclip: Flash Snow Script
Don’t forget to set your movie’s framerate to 30 FPS!
That’s it, compile and be happy.
There are some parameters you can change on top of the Script, mainly to tweak the number of snowflakes and the CPU usage.
Have fun and Happy Christmas!
Posted in Programming, Tools | No Comments »
Portal End Credits - The Flash version November 26th, 2009
Are you looking for “Portal The Flash Game - Console Commands List”?
Once there was a bored little Webdesigner.
One day he thought: “Wouldn’t it be nice to make a Flash version of the Portal end credits?”
No sooner said than done, he extracted the commands and the music from the game files itself, and wrote an interpreter for them in Flash.
My luck the Portal end credits are text based commandos and not a video, so i could take the commandos to reproduce the credits 100% identical in flash. You can even copy and paste the text.
Have Fun:

Portal End Credits in Flash
Twitter made easy - How to tweet with PHP with 19 lines of code October 7th, 2009
You know the dilemma, you want to write a simple tweeting PHP script and have to mess around with the Twitter API.
With the following small script you can tweet with a simple function call. It IS that simple (And SSL secured!!!).
Here’s the function:
function tweet($user, $pass, $text) {
unset($GLOBALS['tweetError']);
if(strlen($text) > 140) { $GLOBALS['tweetError'] = 'TEXT TOO LONG: '.$text; return false; }
$tweet = curl_init();
curl_setopt($tweet, CURLOPT_URL, 'https://www.twitter.com/statuses/update.xml');
curl_setopt($tweet, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($tweet, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($tweet, CURLOPT_HTTPHEADER, array('Authorization: Basic '.base64_encode($user.':'.$pass)));
curl_setopt($tweet, CURLOPT_POST, 1);
curl_setopt($tweet, CURLOPT_POSTFIELDS, 'status='.utf8_encode($text));
if(!$return = curl_exec($tweet)) $GLOBALS['tweetError'] = 'CURL ERROR: '.curl_error($tweet);
else if($returnData = simplexml_load_string($return)) {
if(!isSet($returnData->error)) $GLOBALS['tweetSuccess'] = 'Created at: '.$returnData->created_at.'Text: '.utf8_decode($returnData->text);
else $GLOBALS['tweetError'] = 'TWITTER ERROR: '.$returnData->error;
} else $GLOBALS['tweetError'] = 'RETURN IS NOT XML: '.$return;
curl_close($tweet);
return (isSet($GLOBALS['tweetError']))?false:true;
}
To make a tweet just call the function:
tweet("username", "password", "My cool tweet!");
The function returns “true” if successful or “false” if not.
To echo out the error or success messages, just use this code:
if(tweet("username", "password", "My cool tweet!")) {
echo 'Tweet Successful!'.$GLOBALS['tweetSuccess'];
} else {
echo 'Tweet Error!'.$GLOBALS['tweetError'];
}
If there was an error, the error description is saved in $GLOBALS['tweetError'], and if the tweet was successful, the time and the text itself is saved in $GLOBALS['tweetSuccess'].
Have fun and happy (automatic?) tweeting.
Posted in Programming | No Comments »
The smallest AJAX framework ever July 21st, 2009
The most AJAX frameworks are bloated with many functions you’ll never use or need. Who wants 60 KB of JavaScript if your only need is to send and load data? I Don’t.
I have found somewhere a short howto for AJAX, and derived (rewritten) the smallest AJAX framework ever out of it:
var ajax = false;
if(window.XMLHttpRequest) ajax = new XMLHttpRequest();
else if(window.ActiveXObject) {
try { ajax = new ActiveXObject("Msxml2.XMLHTTP"); }
catch (e) {
try { ajax = new ActiveXObject("Microsoft.XMLHTTP"); }
catch (e) {}
}
}
function ajaxGetContent(type, url, parameter, output_function) {
if(!ajax) eval(output_function + '(false);');
ajax.onreadystatechange = function() {
if(output_function != 'void' && ajax.readyState == 4) {
if(ajax.status == 200) eval(output_function + '(ajax.responseText);');
else eval(output_function + '(false);');
}
}
if(type == "post") {
ajax.open('POST', url, true);
ajax.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
ajax.send(parameter);
} else {
ajax.open('GET', url + ((parameter.length > 0)?"?":"") + parameter, true);
ajax.send(null);
}
}
That’s short, isn’t it?
To get the data you want you have to simply call the function and define a function which will be called after the data arrives:
ajaxGetContent('post', '/myURL/index.php', 'a=b', 'myDataCallBack');
function myDataCallBack(myContent) {
if(myContent == false) {
// something went wrong
} else {
// have fun with your data
}
}
And if you want to send data only and don’t care of the answer, use this syntax:
ajaxGetContent('post', '/myURL/index.php', 'a=b', 'void');
Some explanation:
- type = How to send the data (Parameters). “post” or “get”.
- url = Where to send it to.
- parameter = URL-style parameters. Never use a question mark!
- output_function = The function which will be called after the data is received.
This Tool is tested in Opera 9+10, Firefox 2+3 and MSIE 7+8.
Have fun!
Posted in Programming, Tools | No Comments »
MySQL Birthday Column - Age of a Person July 8th, 2009
If you search for a solution to get the age of a person (in years) in MySQL, google gives you many obsolete (and complicated) answers, from MySQL 4.1.1 it is very easy to get this number:
TIMESTAMPDIFF(YEAR, myDateColumn, NOW())
Have fun.
DIV layer with 100% height, the Javascript way July 1st, 2009
When you create a div layer with 100% width and height, the height is always only the height of the browser window, not of the page content (which can be much higher).
To solve this, give the layer div an id and use the following JS code inside the layer div:
<script type="text/javascript">document.getElementById("yourlayerid").style.height = document.getElementsByTagName("body")[0].offsetHeight + "px";</script>
The code is very simple, it gets the height of the content (the body element) and gives it the layer div.
Tested in Opera, Firefox and *barf* MSIE (8).
Posted in Programming | No Comments »
How to force file downloading with htaccess July 1st, 2009
Nearly every browser will show image oder video files you want to provide for download in the browser itself instead of opening a download dialog.
Most of the websites suggest to use this code in your .htaccess:
<FilesMatch "\.(jpg|zip|avi)$" >
ForceType application/octet-stream
</FilesMatch>
But this is not enough! Even when the MIME-Type is set to “octet-stream”, some browsers will still open the files their selfs because they have detected the .jpg or .avi file extension.
The solution to this is to add the following header:
<FilesMatch "\.(jpg|zip|avi)$" >
ForceType application/octet-stream
Header add Content-Disposition "attachment"
</FilesMatch>
With this header every browser i tested opened a download dialog, regardless of which file extension is present.
On-the-fly Picture Swapping, how to get it work in MSIE June 5th, 2009
To swap or reload a picture on the fly is easy with Javascript. Just give the img tag a unique id and execute the following command in javascript:
document.getElementById("picture").src = "/img/cool-picture.jpg";
Now comes the glitch in (guess where) Internet Explorer: If you want to reload a picture that has changed on the server (let’s say you have overwritten the picture with a php gd-lib script in the background), the Internet Explorer (i call him msie, spoken “emsy”) always keeps the cached picture instead of reloading the picture from the server like opera and firefox do.
You can fix this behaviour with a simple cache-avoiding technique: Add a random number as a parameter, as shown in the following code, that’s it.
document.getElementById("picture").src = "/img/cool-picture.jpg?r=" + Math.floor(Math.random() * 1000);
Posted in Programming | No Comments »
TimeWaster’s Banking Script for CS:S Eventscripts February 7th, 2009
TimeWaster’s Banking Script is an advanced bank based on Eventscripts v1.5 and a SQLite database which makes it incredibly fast.
There’s an converter included to convert and copy “EternalBank” bank accounts for your easy switching pleasure.
Features:
- Multi language capable (atm English and German)
- Display of balance and interest rate within the main menu
- Automatic deposit
- Automatic withdraw
- Transfer money within a menu structure (no need to type silly commands)
- Manual deposit
- Manual withdraw
- Top10 List
- Every round will bear an interest
- Ability to turn off messages send on player spawn
- customizable name, interest rate, info rate and language (English and German atm)
- Included is a converter to copy bank accounts from an existing EternalBank.
This script is released under the GPL: http://www.opensource.org/licenses/gpl-license.php
You’ll find a list of servers running this script here: Game-Monitor.com
Installation:
1. The plugin “Eventscripts” has to be installed on your server: http://www.mattie.info/cs/ (both versions are fine). If you are using ES 1.5, please make sure you have the latest version installed (v1.5.0.171b), otherwise the money transfer will not work.
2. Extract this script inside your MOD folder /cstrike/
4. Configure the Banking script regarding your wishes in the script file itself
5. Add the following line to THE END of your autoexec.cfg
es_load banking
6. Restart your server
7. If you want to copy the bank accounts from an existing EternalBank database, you have to do the following:
7.1 Open your server console and type in: “BankConvert”. this will start the automatic conversion process. there’s nothing more to do.
7.2 After the conversion has successfully finished, remove your EternalBank completely and remove the loading command for EternalBank from your autoexec.cfg.
7.3 Restart your server.
PLEASE NOTE FIRST: the conversion process WILL COMPLETELY STOP your server from responding for the time the conversion is running. do not kill the server process, this is normal. Afterwards a short status message will be displayed in the server console.
In general it is not a bad idea to run this conversion on a local test server. (Recommended)
There’s also a glitch which is ES_Tools related: ES_Tools wants to kill and restart the server process when it’s detecting the server has stopped responding. it is a good idea to deactive ES_Tools by moving away the “es_tools.vdf” file temporarily and restarting the server before starting the conversion process.
Download:
TimeWaster’s Banking Script
Posted in Plugins, Programming | 19 Comments »
TimeWaster’s Happy Hour Script for CS:S Eventscripts December 28th, 2008
TimeWaster’s Happy Hour Script v0.6a for Counter Strike Source
This script will give every player weapons and equipment for free at the period you define.
Requirements: EventScripts 2.0 or higher
UPDATERS PLEASE NOTICE:
Version 0.6 is not compatible with any previous version since it is a complete rewrite in python. Please remove every old Happy Hour related config you might have left in your server.cfg or autoexec.cfg.
Features:
- Translation file system (Atm English and German, please send me your translations for other languages)
- Decide which primary and secondary weapons as well as equipment will be given to the player (disengageable for every weapon type)
- The timeslots are freely configurable, one slot can run over several weekdays
- Advert system announcing start and end times for Happy Hour (disengageable)
- Warmup timer to stop Happy Hour as long as a warmup script is running
- Can play a sound at start and end of Happy Hour
- Can run any command at start and end of Happy Hour
- Fun stuff: Endless grenades (default: off), multiple bombs (default: off)
- You can start the Happy Hour anytime you wish using the following rcon command: “rcon happy_on 1″
If you want to playtest this script you can do so on our public clan server: 83.142.84.182:27015
There’s every day from 8 PM to 9 PM (CET/GMT+1/UTC+1) (20 bis 21 Uhr) Happy Hour.
Download: Happy Hour Script
Installation:
- Make sure you have installed EventScripts 2.0 250i Beta 2 or higher.
- Unzip happyhour_v0.6a_python.zip inside your /cstrike/ folder
- Configure this script in “/addons/eventscripts/happyhour/happyhour.cfg”
- Add the following line to THE END of your autoexec.cfg:
es_load happyhour - Restart your server.
Version Notes:
v 0.6a:
- Some code cleanup and minor bug fixing
v 0.6:
- A complete rewrite for ES 2.0 Python
- Added feature: Timeslots can be configured freely
- Added feature: Bombs and defuser will only be given on de_ (bomb) maps
- Added feature: HH can be started via console command
v 0.5:
- Fixed Bug: On spawn, when weapons will be replaced the old weapons will lay around
- Fixed Bug: On spawn, when weapons will be handed, some weird one after the other weapon delivery effect happens
v 0.4:
- Changed loading method
- Fixed Bug: Welcome message meant for joining player is seen by everyone
- Added feature: Abandoned Weapons will be removed after spawn
v 0.3:
- Documentary cleanup
- Added feature: Multilanguage support (now i need your translations!)
- Added feature: Display of predefined text (start and ending times) instead of calculated values
- Added feature: Warmup timer to avoid screwing Mani Admin warmup time
- Added feature: Play a sound when the HH starts or ends
- Added feature: Execute a server command when the HH starts or ends
- Added feature: Prevent block hh_time from being run twice (e.g. after server restart)
- Added feature: Weapons and equipment are now configurable
v 0.2:
- (2nd) Initial version
Posted in Plugins, Programming | No Comments »