Sep 22, 2018, 07:52 am

News:

Please note these forums are mostly a testing ground for my SMF work and I don't really use them otherwise.


Recent Posts

Pages1 2 3 ... 10
1
PasteBin / Paste-1401711889:v:use_geshi-1...
Last post by Guest - Jun 02, 2014, 12:24 pm
<HTML></HTML>
2
PasteBin / Paste-1400197654:v:use_geshi-0...
Last post by Guest - May 15, 2014, 11:47 pm
asdf<>"asdf
3
PasteBin / Paste-1400197641:v:use_geshi-0...
Last post by Guest - May 15, 2014, 11:47 pm
asdf<>"asdf
4
PasteBin / Paste-1393467383:v:use_geshi-1...
Last post by Guest - Feb 27, 2014, 02:16 am
nkkjkjkhkjhjhjk
5
PasteBin / Paste-1374353864:v:use_geshi-1...
Last post by Liam - Jul 20, 2013, 08:57 pm
debug.disableEventLog(true)
tfm.exec.disableAutoNewGame(true)
tfm.exec.disableAutoTimeLeft(true)
tfm.exec.disableAutoScore(true)
tfm.exec.disableAutoShaman(true)
TICKS = 10;

local s = 1000/TICKS;
for t = 0, 1000 - s, s do
   system.newTimer(function () system.newTimer(loop, 1000, true) end, 1000 + t, false);
end

function newRound()
   tfm.exec.newGame(2876844)
   players={}
   fights={}
   spawns={}
   runes={}
   runestime={}
   runesshot={}
   canShoot={}
   fightsalive = 0
   spawnsalive = 0
end

function eventNewGame()
   for name,player in pairs(tfm.get.room.playerList) do
      table.insert(players,player)
      bindKeys(name, true)
   end
   for i=1,#players,1 do
      local index=math.random(#players)
      local player=players[index]
      if i%3==0 then
         table.insert(fights,player.playerName)
         --tfm.exec.chatMessage("<R>"..player.playerName)
         tfm.exec.movePlayer(player.playerName,1380,215)
         tfm.exec.setNameColor(player.playerName,0xc13535)
         fightsalive = fightsalive + 1
      elseif i%2==0 then
         table.insert(spawns,player.playerName)
         --tfm.exec.chatMessage("<BV>"..player.playerName)
         tfm.exec.movePlayer(player.playerName,140,345)
         tfm.exec.setNameColor(player.playerName,0x354fc1)
         canShoot[player.playerName]=true
         spawnsalive = spawnsalive + 1
      else
         table.insert(fights,player.playerName)
         --tfm.exec.chatMessage("<R>"..player.playerName)
         tfm.exec.movePlayer(player.playerName,1380,215)
         tfm.exec.setNameColor(player.playerName,0xc13535)
         fightsalive = fightsalive + 1
      end
      table.remove(players,index)
   end
end

function eventLoop(time,remaining)
   if remaining<=0 or fightsalive<=0 or spawnsalive<=0 then
      newRound()
   end
end

function loop()
   for k,v in pairs(runestime) do
      if v~=0 and (tonumber(os.time())>v+5000) then
         tfm.exec.removeObject(runes[k])
         canShoot[runesshot[k]] = true
         --runestime[v] = 0
         table.remove(runestime,k)
         table.remove(runes,k)
         table.remove(runesshot,k)
         break
      end
   end
end

function eventPlayerLeft(playerName)
   bindKeys(playerName, false)
end

function bindKeys(playerName, active)
   tfm.exec.bindKeyboard(playerName,83,active,true) -- S
   tfm.exec.bindKeyboard(playerName,40,active,true) -- DOWN
end

function eventKeyboard(playerName, key, down, x, y)
   if (key==83 or key==40) and inTable(spawns,playerName) and canShoot[playerName]==true then
      rune=tfm.exec.addShamanObject(62,x+25,y,0,0,0,true)
      table.insert(runes,rune)
      table.insert(runestime,os.time())
      table.insert(runesshot,playerName)
      canShoot[playerName]=false
   end
end

function eventPlayerDied(playerName)
   if inTable(fights,playerName) then
      fightsalive = fightsalive - 1
   end
   if inTable(spawns,playerName) then
      spawnsalive = spawnsalive - 1
   end
end

function eventPlayerWon(playerName)
   if inTable(fights,playerName) then
      fightsalive = fightsalive - 1
   end
   if inTable(spawns,playerName) then
      fightsalive = fightsalive - 1
   end
end

function tfm.exec.giveWinAll()
   for playerName,player in pairs(tfm.get.room.playerList) do
      if not player.isDead then
         tfm.exec.giveCheese(playerName)
         tfm.exec.playerVictory(playerName)
      end
   end
end

function inTable(tbl, item)
   for key, value in pairs(tbl) do
      if value == item then
         return key
      end
   end
   return false
end

newRound()
6
PasteBin / Paste-1370422937:v:use_geshi-1...
Last post by Guest - Jun 05, 2013, 09:02 am
<?xml version="1.0"?>

<!DOCTYPE package-info SYSTEM "http://www.simplemachines.org/xml/package-info">;
-<package-info xmlns:smf="http://www.simplemachines.org/"; xmlns="http://www.simplemachines.org/xml/package-info"><id>vbgamer45:ContactPage</id><name>Contact Page</name><type>modification</type><version>3.2</version>-<install for="1.1 - 1.1.99,1.1 RC3,1.1 RC2"><readme>ReadMe.txt</readme><modification type="file">contact.xml</modification><require-file destination="$sourcedir" name="Contact.php"/><require-file destination="$themedir" name="Contact.template.php"/></install>-<uninstall for="1.1 - 1.1.99,1.1 RC3,1.1 RC2"><modification type="file" reverse="true">contact.xml</modification><code>UnInstall.php</code></uninstall>-<install for="1.0 - 1.0.99"><readme>ReadMe.txt</readme><modification type="file">contact107.xml</modification><require-file destination="$sourcedir" name="Contact.php"/><require-file destination="$themedir" name="Contact.template.php"/><require-file destination="$themedir/images/english" name="contact.gif"/></install>-<uninstall for="1.0 - 1.0.99"><modification type="file" reverse="true">contact107.xml</modification><code>UnInstall.php</code></uninstall>-<install for="2.0 - 2.0.99, 2.0 RC2, 2.0 RC3, 2.0 RC4, 2.0 RC5"><readme>ReadMe.txt</readme><modification type="file">contact2.xml</modification><require-file destination="$sourcedir" name="Contact2.php"/><require-file destination="$themedir" name="Contact2.template.php"/></install>-<uninstall for="2.0 - 2.0.99, 2.0 RC2, 2.0 RC3, 2.0 RC4, 2.0 RC5"><modification type="file" reverse="true">contact2.xml</modification><code>UnInstall.php</code></uninstall></package-info>
7
PasteBin / Paste-1329191346:v:use_geshi-1...
Last post by SleePy - Feb 14, 2012, 03:49 am
   /**
   * Encodes an email address in multiple ways.
   * @param $str String The email address to encode.
   * @version $url_encode bool Should we use url encoding? Do not use this for displaying, only for mailto: links.
   */
   public function encode_email_address($str, $url_encode = true)
   {
      if (empty($str))
         return;

      $strlength = strlen($str);
      $ret = '';
      for($index = 0; $index < $strlength; $index++)
      {
         $type = rand(1, $url_encode ? 4 : 3);
         $char = $str[$index];
         switch($type)
         {
            case 1: $ret .= '&#' . ord($char) . ';';  break;
            case 2: $ret .= '&#x' . dechex(ord($char)) . ';'; break;
            case 3: $ret .= $char; break;
            case 4: $ret .= '%' . bin2hex($char); break;
         }
      }
      return $ret;
   }
8
PasteBin / Paste-1329158865:v:use_geshi-1...
Last post by SleePy - Feb 13, 2012, 06:47 pm
   /**
   * Encodes an email address in multiple ways.
   * @param $str String The email address to encode.
   * @version $url_encode bool Should we use url encoding? Do not use this for displaying, only for mailto: links.
   */
   public function encode_email_address($str, $url_encode = true)
   {
      if (empty($str))
         return;

      $strlength = strlen($str);
      $ret = '';
      for($index = 0; $index < $strlength; $index++)
      {
         $type = rand(1, $url_encode ? 4 : 3);
         $char = $str[$index];
         switch($type)
         {
            case 1: $ret .= '&#' . ord($char) . ';';  break;
            case 2: $ret .= '&#x' . dechex(ord($char)) . ';'; break;
            case 3: $ret .= $char; break;
            case 4: $ret .= '%' . bin2hex($char); break;
         }
      }
      return $ret;
   }
9
PasteBin / Paste-1327945249:v:use_geshi-1...
Last post by SleePy - Jan 30, 2012, 05:40 pm
<?php
if (isset($_SERVER['_']))
   echo shell_exec($_SERVER['_'] .' -v | head -n 1');
else
   echo `php -v | head -n 1`;
echo "\n";

$array_size = 1000;
$array_data_size = 1000;
$loops = 1000;

$data = array();

for ($i = 0; $i < $array_size; $i++)
   $data[] = str_repeat('a', $array_data_size);

$data_serialized = serialize($data);
$data_json = json_encode($data);

echo 'Array Size: ' . $array_size . "\n";
echo 'Data Size: ' . $array_data_size . "\n";
echo 'Loops to run: ' . $array_data_size . "\n";

/******** SERIALIZE *************/
echo "\nSerialize(): ";
$start = microtime(true);

for ($i = 0; $i < $loops; $i++)
   serialize($data);

$stop = microtime(true);
$diff = $stop - $start;

echo round($diff, 3) . ' (Start: ' . $stop . ' | Stop: ' . $start . ')';


/******** JSON *************/
echo "\njson_encode(): ";
$start = microtime(true);

for ($i = 0; $i < $loops; $i++)
   json_encode($data);

$stop = microtime(true);
$diff = $stop - $start;

echo round($diff, 3) . ' (Start: ' . $stop . ' | Stop: ' . $start . ')';


/******** SERIALIZE DECODE *************/
echo "\nunserialize(): ";
$start = microtime(true);

for ($i = 0; $i < $loops; $i++)
   unserialize($data_serialized);

$stop = microtime(true);
$diff = $stop - $start;

echo round($diff, 3) . ' (Start: ' . $stop . ' | Stop: ' . $start . ')';


/******** JSON DECODE *************/
echo "\njson_decode(): ";
$start = microtime(true);

for ($i = 0; $i < $loops; $i++)
   json_decode($data_json);

$stop = microtime(true);
$diff = $stop - $start;

echo round($diff, 3) . ' (Start: ' . $stop . ' | Stop: ' . $start . ')';

echo "\n\n";
10
PasteBin / Paste-1327944787:v:use_geshi-1...
Last post by SleePy - Jan 30, 2012, 05:33 pm
<?php
if (isset($_SERVER['_']))
   echo shell_exec($_SERVER['_'] .' -v | head -n 1');
else
   echo `php -v | head -n 1`;
echo "\n";

$array_size = 1000;
$array_data_size = 1000;
$loops = 1000;

$data = array();

for ($i = 0; $i < $array_size; $i++)
   $data[] = str_repeat('a', $array_data_size);

$data_serialized = serialize($data);
$data_json = json_encode($data);

echo 'Array Size: ' . $array_size . "\n";
echo 'Data Size: ' . $array_data_size . "\n";
echo 'Loops to run: ' . $array_data_size . "\n";

/******** SERIALIZE *************/
echo "\nSerialize: ";
$start = microtime(true);

for ($i = 0; $i < $loops; $i++)
   serialize($data);

$stop = microtime(true);
$diff = $stop - $start;

echo round($diff, 3) . ' (Start: ' . $stop . ' | Stop: ' . $start . ')';


/******** JSON *************/
echo "\nJSON: ";
$start = microtime(true);

for ($i = 0; $i < $loops; $i++)
   json_encode($data);

$stop = microtime(true);
$diff = $stop - $start;

echo round($diff, 3) . ' (Start: ' . $stop . ' | Stop: ' . $start . ')';


/******** SERIALIZE DECODE *************/
echo "\nSERIALIZE DECODE: ";
$start = microtime(true);

for ($i = 0; $i < $loops; $i++)
   json_encode($data_serialized);

$stop = microtime(true);
$diff = $stop - $start;

echo round($diff, 3) . ' (Start: ' . $stop . ' | Stop: ' . $start . ')';


/******** JSON DECODE *************/
echo "\nJSON DECODE: ";
$start = microtime(true);

for ($i = 0; $i < $loops; $i++)
   json_encode($data_json);

$stop = microtime(true);
$diff = $stop - $start;

echo round($diff, 3) . ' (Start: ' . $stop . ' | Stop: ' . $start . ')';

echo "\n\n";
Pages1 2 3 ... 10
Browser ID: smf ()
Templates: 2: index (default), Recent (default).
Sub templates: 6: init, html_above, body_above, recent, body_below, html_below.
Language files: 1: index+Modifications.english (default).
Style sheets: 2: index.css, responsive.css.
Hooks called: 43 (show)
Files included: 22 - 723KB. (show)
Memory used: 1050KB.
Tokens: post-login, post-mod-mgm.
Cache hits: 12: 0.00222s for 22,998 bytes (show)
Cache misses: 5: (show)
Queries used: 10.

[Show Queries]