Veteran Member
|
07-01-2010
, 22:38
Re: Blockmaker (All-in-One Tutorial)
|
#2
|
Adding Blocks Step-By-Step
O-k, I've seen a couple tutorials around the internet, the most recent one I seen, just taught you how to change the nuke.. (Wtf?), thats not even adding anything.. Here is a more in depth tutorial. Simple, but gets you what you want.
So were gonna add a deagle block! We're gonna be using the original blockmaker: Blockmaker v4.01
(Note: everything you see in my code, thats not in yours, add to yours! Or just copy and paste.)
Open the .sma (Which I'm assuming you already have), and look at the beginning where it says:
PHP Code:
#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[42];
That is just a cvar, that tells rather or not it has been used
Now search for:
PHP Code:
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";
Thats what the block model looks like
Now search for:
PHP Code:
// block & teleport types const gBlockMax = 25; new gSelectedBlockType[gBlockMax]; new gRender[gBlockMax]; new gRed[gBlockMax]; new gGreen[gBlockMax]; new gBlue[gBlockMax]; new gAlpha[gBlockMax];
What your looking at here is really just "const gBlockMax = 25;" that describes to the blockmaker how many blocks there are, this is vital, if you dont change this every time you add a block, the server wont work.
Now search for:
(Note: All the letters in yours are different than mine, fix that!)
PHP Code:
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
This is kind of a bind (not to a key), it binds a certain tag with a letter, so if it is used again in some other portion of coding, it knows your talking about that tag.
Now search for:
PHP Code:
"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"
This is the list that shows in the game, you can rename any of these, but it will not effect the creation of the block.
Now right below it is:
PHP Code:
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'
Remember what I said before, they are binded to tags. Such as Y, Y is binded to BM_DEAGLE.
When you run out of letters, go to numbers.
Now search for:
PHP Code:
//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;
This makes the model look like what it does (confusing)
Now search for:
PHP Code:
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;
This just says: If szType is DEAGLE, the blockType that is created is BM_DEAGLE
Now search for:
PHP Code:
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);
this says what action the tag will use such as:
case BM_DEAGLE: actionDeagle(id);
this means BM_DEAGLE will use the action named "actionDeagle(id);"
Now search for:
PHP Code:
public eventRoundRestart() { //iterate through all players for (new id = 1; id <= 32; ++id) { //reset all players timers resetTimers(id); DeagleUsed[id] = false; } }
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 put "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.
Now search for:
PHP Code:
/***** 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; } }
This is the action of course
Now search for:
PHP Code:
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);
And this is the bind again!
Other actions
Awp:
PHP Code:
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); } }
Damage Bhop:
PHP Code:
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); } } }
Frost Grenade:
PHP Code:
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); } }
Flash Grenade:
PHP Code:
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); } }
He Grenade:
PHP Code:
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); } }
Money:
PHP Code:
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); } }
Low Trampoline:
PHP Code:
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; } }
High Trampoline:
PHP Code:
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; } }
USP
PHP Code:
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); } }
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!
__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.
Last edited by GXLZPGX; 07-01-2010 at 22:44.
|
|