Skocz do zawartości

  • Zaloguj korzystając z Facebooka Zaloguj korzystając z Twittera Zaloguj przez Steam Zaloguj poprzez Google      Logowanie »   
  • Rejestracja

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.

  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse


[ANY] Tetris (Version 1.0)


  • Nie możesz napisać tematu
  • Zaloguj się, aby dodać odpowiedź
Brak odpowiedzi do tego tematu

#1 Adminek AMXX.PL

    Admin :)

  • Bot

Reputacja: 156

  • Postów:7115
  • Lokalizacja:AMXX.PL

Napisano 13.10.2011 03:53

A tetris minigame simulation. (Because i'm bored)

This plugin ports the well known russian Tetris game to SourceMod. Players are able to play Tetris in a menu and compare their highscores.

Just type !tetris (sm_tetris) in chat and start a new game. Try to clear as many lines as possible and reach a high score until your blocks reach the top.

Controls are intuitive. Just use your walking keys. Left and right move the current tetrimino in that direction, up rotates it clockwise and down speeds up the falling.
Players may also press jump (spacebar) to hard drop the tetrimino and let it fall to the floor immediately.

There are some stats on the right, showing your current level, number of cleared lines, score and the next tetrimino.

Scoring is based on this tables. T-Spins aren't rewarded though..

There are 3 difficulties differing in the tetrimino fallingspeed. Each difficulty has it's on TOP 5 highscore list, which may be accessed from the !tetris main menu. Next to the global top5, players are able to check their own best scores for each difficulty.

This plugin uses clientprefs to save the sound settings of each player. Each player may individually enable/disable the sound effects or music.

  • sm_tetris_disableharddrop - Disable hard dropping the tetrimino instantly to the floor with the spacebar? (Default: 0)
  • sm_tetris_disablesounds - Disable all tetris sounds? (Default: 0)
  1. Upload the tetris.smx into you sourcemod/plugins folder.
  2. If you want to enable the tetris sounds, extract the into your modfolder and upload it on your fastdl, if you use one. If you don't want sounds set sm_tetris_disablesounds to 1!
  3. Edit your databases.cfg and add a "tetris" section to save the highscores in.
    1. SQLite:

              "driver"            "sqlite"
              "database"            "tetris"

    2. MySQL:

              "driver"            "mysql"
              "host"                "localhost"
              "database"            "tetris"
              "user"                "youruser"
              "pass"                "yourpass"
              //"timeout"            "0"
              "port"            "3306"

    3. If you use mysql, execute this query to create the table:
      PHP Code:

      CREATE TABLE `tetris_players` (
      steamidVARCHAR64 NOT NULL,
      nameVARCHAR64 NOT NULL,
      score_easyINT NOT NULL DEFAULT '0',
      score_normalINT NOT NULL DEFAULT '0',
      score_hardINT NOT NULL DEFAULT '0',
      PRIMARY KEY ( `steamid` )
      ENGINE InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci

  4. Change the map to load the plugin and configure it in the newly generated config file in cfg/sourcemod/plugin.tetris.cfg.
Known issues:
Some users' machines are unable to display UTF-8 chars ingame, so they won't be able to play this game as they will only see messy squares all over. It's clientside and i don't know how to fix that ;)


The include provides one native to be implemented into ALL afk managers out there!!!1
PHP Code:

 * Check if a player is currently playing tetris.
 * @param client  Client index.
 * @return        True if the player is currently playing tetris, false otherwise.
native bool:IsClientInTetrisGame(client); 

Thanks to:
  • berni/Chanz for their fabulous smlib
  • exvel for his colors include
  • twistedpanda for his time on google to find the scoring!!

Did you see...:

Sounds from

Note: This plugin won't compile on the forum due to it's custom include. Use the provided .smx or compile yourself.

Attached Files
File Type: sp Get Plugin or Get Source (tetris.sp - 42.0 KB)
File Type: smx tetris.smx (31.9 KB, N/A views)
File Type: zip (200.6 KB, N/A views)
File Type: inc (305 Bytes, N/A views)

Wyświetl pełny artykuł

Użytkownicy przeglądający ten temat: 0

0 użytkowników, 0 gości, 0 anonimowych