Blockmaker - Adding Blocks (12 Step) In-Depth | Updated 12/24/2013!
Posted: Fri Oct 09, 2026 10:03 pm
This tutorial assumes you already know the basics of coding, or at least know what it is, and that you have a copy of the original Blockmaker.
Blockmaker v4.01
I suggest using Notepad++ because of the user friendly basic look it has, but you can (obviously) use your favorite coding program.
Step 1
The first step is creating a data holder for the deagle, as shown below.
new DeagleUsed[33]; is the data holder. Typically for player data, there are 33 cells, 32 for the maximum number of players in a server and an extra cell for the data itself.
Step 2
These allocate each constant a model path, that way, if in any further code, we need to define a blocks model path, we remove the need to rinse and repeat.
Step 3
What you really want to pay attention to here is "const gBlockMax = 25;." This describes the maximum number of blocks allowed. If you don't change this every time you add a new block, you might get a few errors. Unfortunately, many of those being none that I will help you with because you chose to be oblivious. I suggest you check this integer every time you get an error that you don't understand.
Step 4
(Note that all of the letters you see in this code will differ from yours; I've organized mine and altered the original code, you may do so as well if you'd like.)
The two forward slashes that follow all of these block definitions are comments and render anything after it useless to the server, these are notes for personal use and future reference.
Step 5
(Note again that this has been re-organized by me.)
This is what shows up in the menu, so here we're just adding "Deagle" to the menu.
Note: When editing this, do not forgot to place a comma after the last item in the list to let the plugin know that there is more to the menu. For example, incorrect use:
correct use:
Failing to do so will give you a compiling error.
Step 6
This should be in order of Step 4, remember how we made a comment after the Deagle, and we used //Y?
This is in order, look up and down the list we used for the menu (the code before this). A = Platform, B = Bunnyhop, so on so forth. Again, your code will differ from mine, and again, you may organize it. If you've already begun organizing, I suggest you continue to do so.
Note: These ARE case sensitive, so when you're done with capital letters, you can move onto lower case, and then numbers or characters such as !@#$% etc.
Step 7
Remember how we defined gszBlockModelDeagle to the model path? This coordinates all of the blocks within Steps 2 and 4, adjust your code to this snippet.
Step 8
All this is saying, is that if the block created is a DEAGLE, give it the properties of BM_DEAGLE.
Step 9
Now we're coordinating BM_DEAGLE (which we coordinated with the block model path for the deagle block), to an action that will activate once you step on the block.
Step 10
public eventRoundRestart is just a list of what resets when the round restarts, in the action "actionDeagle(id);", it is set to make "DeagleUsed[id] = true;" which means that you have used a deagle block and you cant use it again, but, since I placed "DeagleUsed[id] = false;" under public eventRoundRestart, it lets the server know at the beginning of each round that I can use the deagle block again.
Step 11
This is what we made BM_DEAGLE refer to when the player steps on the block specified. Most of this is self explanatory, and you may change to fit your needs. This will give the player a deagle with one bullet to use.
Step 12
Refer to Step 4 and place in the order that you've organized your blocks. This tells the server what block to create when you choose the selected item in the menu.
Other actions for more blocks.
Awp:
Damage Bhop:
Frost Grenade:
Flash Grenade:
He Grenade:
Money:
Low Trampoline:
High Trampoline:
USP
If you have any other actions for other weapons, just post them and I will add them to this section. Hope this was useful for you guys!
Blockmaker v4.01
I suggest using Notepad++ because of the user friendly basic look it has, but you can (obviously) use your favorite coding program.
Step 1
The first step is creating a data holder for the deagle, as shown below.
Code: Select all
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fun>
#include <cstrike>
#include <fakemeta>
#pragma semicolon 1;
#define PLUGIN "blockmaker"
#define VERSION "4.01"
#define AUTHOR "Necro"
#define BM_ADMIN_LEVEL ADMIN_MENU //admin access level to use this plugin. ADMIN_MENU = flag 'u'
new DeagleUsed[33]; Step 2
Code: Select all
new const gszBlockModelDefault[] = "models/blockmaker/bm_block_default.mdl";
new const gszBlockModelPlatform[] = "models/blockmaker/bm_block_platform.mdl";
new const gszBlockModelBhop[] = "models/blockmaker/bm_block_bhop.mdl";
new const gszBlockModelDamage[] = "models/blockmaker/bm_block_damage.mdl";
new const gszBlockModelHealer[] = "models/blockmaker/bm_block_healer.mdl";
new const gszBlockModelInvincibility[] = "models/blockmaker/bm_block_invincibility.mdl";
new const gszBlockModelStealth[] = "models/blockmaker/bm_block_stealth.mdl";
new const gszBlockModelSpeedBoost[] = "models/blockmaker/bm_block_speedboost.mdl";
new const gszBlockModelNoFallDamage[] = "models/blockmaker/bm_block_nofalldamage.mdl";
new const gszBlockModelIce[] = "models/blockmaker/bm_block_ice.mdl";
new const gszBlockModelDeath[] = "models/blockmaker/bm_block_death.mdl";
new const gszBlockModelNuke[] = "models/blockmaker/bm_block_nuke.mdl";
new const gszBlockModelCamouflage[] = "models/blockmaker/bm_block_camouflage.mdl";
new const gszBlockModelLowGravity[] = "models/blockmaker/bm_block_lowgravity.mdl";
new const gszBlockModelFire[] = "models/blockmaker/bm_block_fire.mdl";
new const gszBlockModelRandom[] = "models/blockmaker/bm_block_random.mdl";
new const gszBlockModelSlap[] = "models/blockmaker/bm_block_slap.mdl";
new const gszBlockModelHoney[] = "models/blockmaker/bm_block_honey.mdl";
new const gszBlockModelBarrierCT[] = "models/blockmaker/bm_block_barrier_ct.mdl";
new const gszBlockModelBarrierT[] = "models/blockmaker/bm_block_barrier_t.mdl";
new const gszBlockModelBootsOfSpeed[] = "models/blockmaker/bm_block_bootsofspeed.mdl";
new const gszBlockModelGlass[] = "models/blockmaker/bm_block_glass.mdl";
new const gszBlockModelBhopNoSlow[] = "models/blockmaker/bm_block_bhop_noslow.mdl";
new const gszBlockModelAutoBhop[] = "models/blockmaker/bm_block_autobhop.mdl";
new const gszBlockModelDeagle[] = "models/blockmaker/bm_block_default.mdl"; Step 3
Code: Select all
// block & teleport types
const gBlockMax = 25;
new gSelectedBlockType[gBlockMax];
new gRender[gBlockMax];
new gRed[gBlockMax];
new gGreen[gBlockMax];
new gBlue[gBlockMax];
new gAlpha[gBlockMax]; Step 4
(Note that all of the letters you see in this code will differ from yours; I've organized mine and altered the original code, you may do so as well if you'd like.)
Code: Select all
BM_PLATFORM, //A
BM_BHOP, //B
BM_DAMAGE, //C
BM_HEALER, //D
BM_NOFALLDAMAGE, //E
BM_ICE, //F
BM_TRAMPOLINE, //G
BM_SPEEDBOOST, //H
BM_INVINCIBILITY, //I
BM_STEALTH, //J
BM_DEATH, //K
BM_NUKE, //L
BM_CAMOUFLAGE, //M
BM_LOWGRAVITY, //N
BM_FIRE, //O
BM_SLAP, //P
BM_RANDOM, //Q
BM_HONEY, //R
BM_BARRIER_CT, //S
BM_BARRIER_T, //T
BM_BOOTSOFSPEED, //U
BM_GLASS, //V
BM_BHOP_NOSLOW, //W
BM_AUTO_BHOP, //X
BM_DEAGLE, //Y Step 5
(Note again that this has been re-organized by me.)
Code: Select all
"Platform",
"Bunnyhop",
"Damage",
"Healer",
"No Fall Damage",
"Ice",
"Trampoline",
"Speed Boost",
"Invincibility",
"Stealth",
"Death",
"Nuke",
"Camouflage",
"Low Gravity",
"Fire",
"Slap",
"Random",
"Honey",
"CT Barrier",
"T Barrier",
"Boots Of Speed",
"Glass",
"Bunnyhop (No slow down)",
"Auto Bunnyhop",
"Deagle" Note: When editing this, do not forgot to place a comma after the last item in the list to let the plugin know that there is more to the menu. For example, incorrect use:
Code: Select all
"Auto Bunnyhop"
"Deagle" Code: Select all
"Auto Bunnyhop",
"Deagle" Step 6
Code: Select all
new const gBlockSaveIds[gBlockMax] =
{
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y'This should be in order of Step 4, remember how we made a comment after the Deagle, and we used //Y?
This is in order, look up and down the list we used for the menu (the code before this). A = Platform, B = Bunnyhop, so on so forth. Again, your code will differ from mine, and again, you may organize it. If you've already begun organizing, I suggest you continue to do so.
Note: These ARE case sensitive, so when you're done with capital letters, you can move onto lower case, and then numbers or characters such as !@#$% etc.
Step 7
Code: Select all
//set block models to defaults
gszBlockModels[BM_PLATFORM] = gszBlockModelPlatform;
gszBlockModels[BM_BHOP] = gszBlockModelBhop;
gszBlockModels[BM_DAMAGE] = gszBlockModelDamage;
gszBlockModels[BM_HEALER] = gszBlockModelHealer;
gszBlockModels[BM_NOFALLDAMAGE] = gszBlockModelNoFallDamage;
gszBlockModels[BM_ICE] = gszBlockModelIce;
gszBlockModels[BM_TRAMPOLINE] = gszBlockModelDefault;
gszBlockModels[BM_SPEEDBOOST] = gszBlockModelSpeedBoost;
gszBlockModels[BM_INVINCIBILITY] = gszBlockModelInvincibility;
gszBlockModels[BM_STEALTH] = gszBlockModelStealth;
gszBlockModels[BM_DEATH] = gszBlockModelDeath;
gszBlockModels[BM_NUKE] = gszBlockModelNuke;
gszBlockModels[BM_CAMOUFLAGE] = gszBlockModelCamouflage;
gszBlockModels[BM_LOWGRAVITY] = gszBlockModelLowGravity;
gszBlockModels[BM_FIRE] = gszBlockModelFire;
gszBlockModels[BM_SLAP] = gszBlockModelSlap;
gszBlockModels[BM_RANDOM] = gszBlockModelRandom;
gszBlockModels[BM_HONEY] = gszBlockModelHoney;
gszBlockModels[BM_BARRIER_CT] = gszBlockModelBarrierCT;
gszBlockModels[BM_BARRIER_T] = gszBlockModelBarrierT;
gszBlockModels[BM_BOOTSOFSPEED] = gszBlockModelBootsOfSpeed;
gszBlockModels[BM_GLASS] = gszBlockModelGlass;
gszBlockModels[BM_BHOP_NOSLOW] = gszBlockModelBhopNoSlow;
gszBlockModels[BM_AUTO_BHOP] = gszBlockModelAutoBhop;
gszBlockModels[BM_DEAGLE] = gszBlockModelDeagle; Step 8
Code: Select all
if (equal(szType, "PLATFORM")) blockType = BM_PLATFORM;
else if (equal(szType, "BHOP")) blockType = BM_BHOP;
else if (equal(szType, "DAMAGE")) blockType = BM_DAMAGE;
else if (equal(szType, "HEALER")) blockType = BM_HEALER;
else if (equal(szType, "NOFALLDAMAGE")) blockType = BM_NOFALLDAMAGE;
else if (equal(szType, "ICE")) blockType = BM_ICE;
else if (equal(szType, "TRAMPOLINE")) blockType = BM_TRAMPOLINE;
else if (equal(szType, "SPEEDBOOST")) blockType = BM_SPEEDBOOST;
else if (equal(szType, "INVINCIBILITY")) blockType = BM_INVINCIBILITY;
else if (equal(szType, "STEALTH")) blockType = BM_STEALTH;
else if (equal(szType, "DEATH")) blockType = BM_DEATH;
else if (equal(szType, "NUKE")) blockType = BM_NUKE;
else if (equal(szType, "CAMOUFLAGE")) blockType = BM_CAMOUFLAGE;
else if (equal(szType, "LOWGRAVITY")) blockType = BM_LOWGRAVITY;
else if (equal(szType, "FIRE")) blockType = BM_FIRE;
else if (equal(szType, "SLAP")) blockType = BM_SLAP;
else if (equal(szType, "RANDOM")) blockType = BM_RANDOM;
else if (equal(szType, "HONEY")) blockType = BM_HONEY;
else if (equal(szType, "BARRIER_CT")) blockType = BM_BARRIER_CT;
else if (equal(szType, "BARRIER_T")) blockType = BM_BARRIER_T;
else if (equal(szType, "BOOTSOFSPEED")) blockType = BM_BOOTSOFSPEED;
else if (equal(szType, "GLASS")) blockType = BM_GLASS;
else if (equal(szType, "BHOP_NOSLOW")) blockType = BM_BHOP_NOSLOW;
else if (equal(szType, "AUTO_BHOP")) blockType = BM_AUTO_BHOP;
else if (equal(szType, "DEAGLE")) blockType = BM_DEAGLE; Step 9
Code: Select all
case BM_HEALER: actionHeal(id);
case BM_DAMAGE: actionDamage(id);
case BM_INVINCIBILITY: actionInvincible(id, false);
case BM_STEALTH: actionStealth(id, false);
case BM_TRAMPOLINE: actionTrampoline(id);
case BM_SPEEDBOOST: actionSpeedBoost(id);
case BM_DEATH: actionDeath(id);
case BM_NUKE: actionNuke(id, false);
case BM_LOWGRAVITY: actionLowGravity(id);
case BM_CAMOUFLAGE: actionCamouflage(id, false);
case BM_FIRE: actionFire(id, ent);
case BM_SLAP: actionSlap(id);
case BM_RANDOM: actionRandom(id, ent);
case BM_HONEY: actionHoney(id);
case BM_BOOTSOFSPEED: actionBootsOfSpeed(id, false);
case BM_AUTO_BHOP: actionAutoBhop(id, false);
case BM_DEAGLE: actionDeagle(id); Step 10
Code: Select all
public eventRoundRestart()
{
//iterate through all players
for (new id = 1; id <= 32; ++id)
{
//reset all players timers
resetTimers(id);
DeagleUsed[id] = false;
}
} Step 11
Code: Select all
/***** BLOCK ACTIONS *****/
actionDeagle(id)
{
if (is_user_alive(id) && !DeagleUsed[id] && get_user_team(id) == 1)
{
give_item(id, "weapon_deagle");
cs_set_weapon_ammo(find_ent_by_owner(1, "weapon_deagle", id), 1);
DeagleUsed[id] = true;
new deaglename[42];
get_user_name(id, deaglename, 32);
set_hudmessage(255, 255, 255, -1.0, -1.0, 0, 6.0, 4.0);
show_hudmessage(0, "Be careful CT! %s has a Deagle!", deaglename);
}
}
actionDamage(id)
{
if (halflife_time() >= gfNextDamageTime[id])
{
if (get_user_health(id) > 0)
{
new Float:amount = get_cvar_float("bm_damageamount");
fakedamage(id, "damage block", amount, DMG_CRUSH);
}
gfNextDamageTime[id] = halflife_time() + 0.5;
}
} Step 12
Code: Select all
case 'A': createBlock(0, BM_PLATFORM, vVec1, axis, size);
case 'B': createBlock(0, BM_BHOP, vVec1, axis, size);
case 'C': createBlock(0, BM_DAMAGE, vVec1, axis, size);
case 'D': createBlock(0, BM_HEALER, vVec1, axis, size);
case 'E': createBlock(0, BM_NOFALLDAMAGE, vVec1, axis, size);
case 'F': createBlock(0, BM_ICE, vVec1, axis, size);
case 'G': createBlock(0, BM_TRAMPOLINE, vVec1, axis, size);
case 'H': createBlock(0, BM_SPEEDBOOST, vVec1, axis, size);
case 'I': createBlock(0, BM_INVINCIBILITY, vVec1, axis, size);
case 'J': createBlock(0, BM_STEALTH, vVec1, axis, size);
case 'K': createBlock(0, BM_DEATH, vVec1, axis, size);
case 'L': createBlock(0, BM_NUKE, vVec1, axis, size);
case 'M': createBlock(0, BM_CAMOUFLAGE, vVec1, axis, size);
case 'N': createBlock(0, BM_LOWGRAVITY, vVec1, axis, size);
case 'O': createBlock(0, BM_FIRE, vVec1, axis, size);
case 'P': createBlock(0, BM_SLAP, vVec1, axis, size);
case 'Q': createBlock(0, BM_RANDOM, vVec1, axis, size);
case 'R': createBlock(0, BM_HONEY, vVec1, axis, size);
case 'S': createBlock(0, BM_BARRIER_CT, vVec1, axis, size);
case 'T': createBlock(0, BM_BARRIER_T, vVec1, axis, size);
case 'U': createBlock(0, BM_BOOTSOFSPEED, vVec1, axis, size);
case 'V': createBlock(0, BM_GLASS, vVec1, axis, size);
case 'W': createBlock(0, BM_BHOP_NOSLOW, vVec1, axis, size);
case 'X': createBlock(0, BM_AUTO_BHOP, vVec1, axis, size);
case 'Y': createBlock(0, BM_DEAGLE, vVec1, axis, size); Other actions for more blocks.
Awp:
Code: Select all
actionAwp(id)
{
if (is_user_alive(id) && !AwpUsed[id] && get_user_team(id) == 1)
{
give_item(id, "weapon_awp");
cs_set_weapon_ammo(find_ent_by_owner(1, "weapon_awp", id), 1);
AwpUsed[id] = true;
new awpname[42];
get_user_name(id, awpname, 32);
set_hudmessage(255, 255, 255, -1.0, -1.0, 0, 6.0, 4.0);
show_hudmessage(0, "Be careful CT! %s has a awp!", awpname);
}
} Code: Select all
action_DMGBhop(id, ent)
{
if ( get_gametime() >= gfDmgBhopNextUse[id] )
{
new fDamage = 10;
fakedamage(id, "Damage block", fDamage, DMG_CRUSH);
gfDmgBhopNextUse[id] = get_gametime() + 0.5;
if ( !task_exists(TASK_SOLIDNOT + ent) && !task_exists(TASK_SOLID + ent) )
{
set_task(0.1, "task_SolidNot", TASK_SOLIDNOT + ent);
}
}
} Code: Select all
actionFrostGrenade(id, OverrideTimer)
{
//get game time
new Float:fTime = halflife_time();
//make sure player is alive
if (fTime >= gfFrostGrenadeNextUse[id] || OverrideTimer)
{
if ( get_user_team ( id ) == 1 )
{
give_item(id, "weapon_smokegrenade");
}
//set the time when player can use frost grenade again
gfFrostNextUse[id] = fTime + get_cvar_float("bm_frostgrenadecooldown");
//setup hud message to show who nuked what team
set_hudmessage(255, 255, 0, -1.0, 0.35, 0, 6.0, 10.0, 1.0, 1.0);
}
else
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "FROSTNADE BLOCK NEXT USE AFTER 1 ROUND", gfFrostNextUse[id] - fTime);
}
} Code: Select all
actionFlashGrenade(id, OverrideTimer)
{
//get game time
new Float:fTime = halflife_time();
//make sure player is alive
if (fTime >= gfFlashGrenadeNextUse[id] || OverrideTimer)
{
give_item(id, "weapon_flashbang");
{
//omg
}
//set the time when player can use flash grenade again
gfFlashNextUse[id] = fTime + get_cvar_float("bm_flashgrenadecooldown");
//setup hud message to show who nuked what team
set_hudmessage(255, 255, 0, -1.0, 0.35, 0, 6.0, 10.0, 1.0, 1.0);
}
else
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "FLASH BLOCK NEXT USE AFTER 1 ROUND", gfFlashNextUse[id] - fTime);
}
} Code: Select all
actionHeGrenade(id, OverrideTimer)
{
//get game time
new Float:fTime = halflife_time();
//make sure player is alive
if (fTime >= gfHENextUse[id] || OverrideTimer)
{
//ID HE
give_item(id, "weapon_hegrenade");
{
//omg
}
//set the time when the player can use the nuke again (someone might have been invincible)
gfHENextUse[id] = fTime + get_cvar_float("bm_hecooldown");
//setup hud message to show who nuked what team
set_hudmessage(255, 255, 0, -1.0, 0.35, 0, 6.0, 10.0, 1.0, 1.0);
}
else
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "NEXT USE AFTER 1 ROUND", gfHENextUse[id] - fTime);
}
} Code: Select all
actionMoney(id, OverrideTimer)
{
//get game time
new Float:fTime = halflife_time();
//make sure player is alive
if (fTime >= gfMoneyNextUse[id] || OverrideTimer)
{
cs_set_user_money(id, cs_get_user_money (id) + 5000) ;
{
//omg
}
//set the time when the player can use the nuke again (someone might have been invincible)
gfMoneyNextUse[id] = fTime + get_cvar_float("bm_moneycooldown");
//setup hud message to show who nuked what team
set_hudmessage(255, 255, 0, -1.0, 0.35, 0, 6.0, 10.0, 1.0, 1.0);
}
else
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "MONEY NEXT USE AFTER 1 ROUND", gfMoneyNextUse[id] - fTime);
}
} Code: Select all
actionLowTrampoline(id)
{
//if trampoline timeout has exceeded (needed to prevent velocity being given multiple times)
if (halflife_time() >= gfTrampolineTimeout[id])
{
new Float:velocity[3];
//set player Z velocity to make player bounce
entity_get_vector(id, EV_VEC_velocity, velocity);
velocity[2] = 250.0; //jump velocity
entity_set_vector(id, EV_VEC_velocity, velocity);
entity_set_int(id, EV_INT_gaitsequence, 6); //play the Jump Animation
gfTrampolineTimeout[id] = halflife_time() + 0.5;
}
} Code: Select all
actionHighTrampoline(id)
{
//if trampoline timeout has exceeded (needed to prevent velocity being given multiple times)
if (halflife_time() >= gfTrampolineTimeout[id])
{
new Float:velocity[3];
//set player Z velocity to make player bounce
entity_get_vector(id, EV_VEC_velocity, velocity);
velocity[2] = 750.0; //jump velocity
entity_set_vector(id, EV_VEC_velocity, velocity);
entity_set_int(id, EV_INT_gaitsequence, 6); //play the Jump Animation
gfTrampolineTimeout[id] = halflife_time() + 0.5;
}
} Code: Select all
actionUsp(id)
{
if (is_user_alive(id) && !UspUsed[id] && get_user_team(id) == 1)
{
give_item(id, "weapon_usp");
cs_set_weapon_ammo(find_ent_by_owner(1, "weapon_usp", id), 1);
UspUsed[id] = true;
new uspname[42];
get_user_name(id, uspname, 32);
set_hudmessage(255, 255, 255, -1.0, -1.0, 0, 6.0, 4.0);
show_hudmessage(0, "All CTs Run , %s has a USP !!!!!", uspname);
}
}