#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <fun>
#pragma semicolon 1
#define PLUGIN_NAME "Blockmaker"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "wAnderFAKE"
#define PLUGIN_PREFIX "Special"
new AwpUsed[42];
new DeagleUsed[42];
new HeUsed[42];
new FlashUsed[42];
new SmokeUsed[42];
new XpUsed[43];
new ScoutUsed[42];
new GlockUsed[42];
new USPUsed[42];
new M4A1Used[42];
new M3Used[42];
new MP5Used[42];
new P90Used[42];
new GalilUsed[42];
new FamasUsed[42];
new AK47Used[42];
new AUGUsed[42];
new SG552Used[42];
new SG550Used[42];
new VestHelmUsed[42];
new g_msgSayText;
new g_MaxPlayers;
new const SERVERIP[] = "62.90.138.114:27018";
native hnsxp_get_user_xp( id );
native hnsxp_set_user_xp( id, xp );
stock hnsxp_add_user_xp( id, xp )
{
return hnsxp_set_user_xp( id, hnsxp_get_user_xp( id ) + xp );
}
new const g_blank[] = "";
new const g_a[] = "a";
new const g_b[] = "b";
new const g_block_classname[] = "SCM_Block";
new const g_start_classname[] = "SCM_TeleportStart";
new const g_destination_classname[] = "SCM_TeleportDestination";
new const g_light_classname[] = "SCM_Light";
//Hudmessage
const gHudRed = 10;
const gHudGreen = 150;
const gHudBlue = 225;
const gHudEffects = 0;
const gHudChannel = 2;
const Float:gfTextX = -1.0;
const Float:gfTextY = 0.84;
const Float:gfHudFxTime = 0.0;
const Float:gfHudHoldTime = 3.00;
const Float:gfHudFadeInTime = 0.75;
const Float:gfHudFadeOutTime = 0.75;
new const g_model_platform[] = "models/Blockmaker/Normal/igz_platform.mdl";
new const g_model_bunnyhop[] = "models/Blockmaker/Normal/igz_bhopv5.mdl";
new const g_model_damage[] = "models/Blockmaker/Normal/igz_damage.mdl";
new const g_model_healer[] = "models/Blockmaker/Normal/igz_health.mdl";
new const g_model_no_fall_damage[] = "models/Blockmaker/Normal/igz_nofalldamage.mdl";
new const g_model_ice[] = "models/Blockmaker/Normal/igz_ice.mdl";
new const g_model_trampoline[] = "models/Blockmaker/Normal/igz_trampoline.mdl";
new const g_model_speed_boost[] = "models/Blockmaker/Normal/igz_speedboost.mdl";
new const g_model_death[] = "models/Blockmaker/Normal/igz_death.mdl";
new const g_model_low_gravity[] = "models/Blockmaker/Normal/igz_gravity.mdl";
new const g_model_slap[] = "models/Blockmaker/Normal/igz_slap.mdl";
new const g_model_honey[] = "models/Blockmaker/Normal/igz_honey.mdl";
new const g_model_ct_barrier[] = "models/Blockmaker/Normal/igz_ct_barrier.mdl";
new const g_model_t_barrier[] = "models/Blockmaker/Normal/igz_t_barrier.mdl";
new const g_model_glass[] = "models/Blockmaker/Normal/igz_platform.mdl";
new const g_model_delayed_bunnyhop[] = "models/Blockmaker/Normal/igz_delay_bhop.mdl";
new const g_model_invincibility[] = "models/Blockmaker/Normal/igz_invincibility.mdl";
new const g_model_stealth[] = "models/Blockmaker/Normal/igz_stealth.mdl";
new const g_model_boots_of_speed[] = "models/Blockmaker/Normal/igz_boostofspeed.mdl";
new const g_model_duck[] = "models/Blockmaker/Normal/igz_duck.mdl";
new const g_model_money[] = "models/Blockmaker/Normal/igz_money.mdl";
new const g_model_awp[] = "models/Blockmaker/Normal/igz_awp.mdl";
new const g_model_deagle[] = "models/Blockmaker/Normal/igz_deagle.mdl";
new const g_model_he[] = "models/Blockmaker/Normal/igz_grenade.mdl";
new const g_model_flash[] = "models/Blockmaker/Normal/igz_flashbang.mdl";
new const g_model_smoke[] = "models/Blockmaker/Normal/igz_frost.mdl";
new const g_model_xp[] = "models/Blockmaker/Normal/igz_xp.mdl";
new const g_model_scout[] = "models/Blockmaker/Normal/SFU_SCOUT.mdl";
new const g_model_glock[] = "models/Blockmaker/Normal/SFU_GLOCK.mdl";
new const g_model_usp[] = "models/Blockmaker/Normal/SFU_USP.mdl";
new const g_model_m4a1[] = "models/Blockmaker/Normal/SFU_M4A1.mdl";
new const g_model_m3[] = "models/Blockmaker/Normal/SFU_M3.mdl";
new const g_model_blind[] = "models/Blockmaker/Normal/igz_blind.mdl";
new const g_model_p90[] = "models/Blockmaker/Normal/SFU_P90.mdl";
new const g_model_galil[] = "models/Blockmaker/Normal/SFU_GALIL.mdl";
new const g_model_famas[] = "models/Blockmaker/Normal/SFU_FAMAS.mdl";
new const g_model_ak47[] = "models/Blockmaker/Normal/SFU_AK47.mdl";
new const g_model_AUG[] = "models/Blockmaker/Normal/SFU_AUG.mdl";
new const g_model_SG552[] = "models/Blockmaker/Normal/SFU_SG552.mdl";
new const g_model_SG550[] = "models/Blockmaker/Normal/SFU_SG550.mdl";
new const g_model_VestHelm[] = "models/Blockmaker/Normal/SFU_VESTHELM.mdl";
new const g_model_IceBhop[] = "models/Blockmaker/Normal/igz_bhopv5.mdl";
new const g_model_cam[] = "models/Blockmaker/Normal/igz_camouflage.mdl";
new const g_model_superman[] = "models/Blockmaker/Normal/igz_superman.mdl";
new const g_model_magic[] = "models/Blockmaker/Normal/pg_magiccarpet.mdl";
new const g_sprite_light[] = "sprites/Blockmaker/light.spr";
new const g_sprite_teleport_start[] = "sprites/Blockmaker/teleport_start.spr";
new const g_sprite_teleport_destination[] = "sprites/Blockmaker/teleport_end.spr";
new const g_sound_invincibility[] = "warcraft3/divineshield.wav";
new const g_sound_stealth[] = "warcraft3/Stealth.wav";
new const g_sound_boots_of_speed[] = "warcraft3/BootsOfSpeed.wav";
new const g_sound_money[] = "warcraft3/money.wav";
new const g_sound_cam[] = "warcraft3/antend.wav";
new const g_sound_teleport[] = "warcraft3/blinkarrival.wav";
new g_sprite_beam;
enum ( <<= 1 )
{
B1 = 1,
B2,
B3,
B4,
B5,
B6,
B7,
B8,
B9,
B0
};
enum
{
K1,
K2,
K3,
K4,
K5,
K6,
K7,
K8,
K9,
K0
};
enum
{
CHOICE_DELETE,
CHOICE_LOAD
};
enum
{
X,
Y,
Z
};
enum ( += 1000 )
{
TASK_SPRITE = 1000,
TASK_SOLID,
TASK_SOLIDNOT,
TASK_ICE,
TASK_HONEY,
TASK_NOSLOWDOWN,
TASK_INVINCIBLE,
TASK_STEALTH,
TASK_BOOTSOFSPEED,
TASK_CAM,
TASK_SUPER,
};
new g_file[64];
new g_keys_main_menu;
new g_keys_block_menu;
new g_keys_block_selection_menu;
new g_keys_properties_menu;
new g_keys_move_menu;
new g_keys_teleport_menu;
new g_keys_light_menu;
new g_keys_light_properties_menu;
new g_keys_options_menu;
new g_keys_choice_menu;
new g_keys_commands_menu;
new g_main_menu[256];
new g_block_menu[256];
new g_move_menu[256];
new g_teleport_menu[256];
new g_light_menu[128];
new g_light_properties_menu[256];
new g_options_menu[256];
new g_choice_menu[128];
new g_commands_menu[256];
new g_viewmodel[33][32];
new bool:g_connected[33];
new bool:g_alive[33];
new bool:g_admin[33];
new bool:g_gived_access[33];
new bool:g_snapping[33];
new bool:g_viewing_properties_menu[33];
new bool:g_viewing_light_properties_menu[33];
new bool:g_viewing_commands_menu[33];
new bool:g_no_fall_damage[33];
new bool:g_ice[33];
new bool:g_low_gravity[33];
new bool:g_no_slow_down[33];
new bool:g_has_hud_text[33];
new bool:g_block_status[33];
new bool:g_noclip[33];
new bool:g_godmode[33];
new bool:g_all_godmode;
new bool:g_has_checkpoint[33];
new bool:g_checkpoint_duck[33];
new bool:g_reseted[33];
new bool:gbLowGravity[42];
new g_selected_block_size[33];
new g_choice_option[33];
new g_block_selection_page[33];
new g_teleport_start[33];
new g_grabbed[33];
new g_grouped_blocks[33][256];
new g_group_count[33];
new g_property_info[33][2];
new g_light_property_info[33][2];
new g_slap_times[33];
new g_honey[33];
new g_boots_of_speed[33];
new Float:g_grid_size[33];
new Float:g_snapping_gap[33];
new Float:g_grab_offset[33][3];
new Float:g_grab_length[33];
new Float:g_next_damage_time[33];
new Float:g_next_heal_time[33];
new Float:g_invincibility_time_out[33];
new Float:g_invincibility_next_use[33];
new Float:g_stealth_time_out[33];
new Float:g_stealth_next_use[33];
new Float:g_cam_time_out[33];
new Float:g_cam_next_use[33];
new Float:g_super_time_out[33];
new Float:g_super_next_use[33];
new Float:g_boots_of_speed_time_out[33];
new Float:g_boots_of_speed_next_use[33];
new Float:g_next_xp_time[33];
new Float:g_set_velocity[33][3];
new Float:g_checkpoint_position[33][3];
new bool:g_money_used[33];
new g_cvar_textures;
new gmsgScreenFade;
new g_max_players;
enum
{
PLATFORM,
BUNNYHOP,
DAMAGE,
HEALER,
NO_FALL_DAMAGE,
ICE,
TRAMPOLINE,
SPEED_BOOST,
DEATH,
LOW_GRAVITY,
SLAP,
HONEY,
CT_BARRIER,
T_BARRIER,
GLASS,
DELAYED_BUNNYHOP,
INVINCIBILITY,
STEALTH,
BOOTS_OF_SPEED,
DUCK,
MONEY,
AWP,
DEAGLE,
HE,
FLASH,
SMOKE,
XP,
SCOUT,
GLOCK,
USP,
M4A1,
M3,
BLIND,
P90,
GALIL,
FAMAS,
AK47,
AUG,
SG552,
SG550,
VESTHELM,
ICEBHOP,
CAM,
SUPER,
MAGIC,
TOTAL_BLOCKS
};
enum
{
TELEPORT_START,
TELEPORT_DESTINATION
};
enum
{
NORMAL,
TINY,
LARGE,
POLE
};
enum
{
NORMAL,
GLOWSHELL,
TRANSCOLOR,
TRANSALPHA,
TRANSWHITE
};
new g_selected_block_type[TOTAL_BLOCKS];
new g_render[TOTAL_BLOCKS];
new g_red[TOTAL_BLOCKS];
new g_green[TOTAL_BLOCKS];
new g_blue[TOTAL_BLOCKS];
new g_alpha[TOTAL_BLOCKS];
new const g_block_names[TOTAL_BLOCKS][] =
{
"Platform",
"Bunnyhop",
"Damage",
"Healer",
"No Fall Damage",
"Ice",
"Trampoline",
"Speed Boost",
"Death",
"Low Gravity",
"Slap",
"Honey",
"CT Barrier",
"T Barrier",
"Glass",
"Delayed Bhop",
"Invincibility",
"Stealth",
"Boots Of Speed",
"Duck",
"Money Block",
"Awp",
"Deagle",
"High Explosive",
"Flash",
"Smoke",
"Xp Block",
"Scout",
"Glock",
"USP",
"M4A1",
"M3",
"Blind",
"P90",
"Galil",
"Famas",
"AK47",
"AUG",
"SG552",
"SG550",
"vesthelm",
"Ice Bhop",
"Camouflage",
"Super Man",
"Magic Carpet"
};
new const g_property1_name[TOTAL_BLOCKS][] =
{
"",
"No Fall Damage",
"Damage Per Interval",
"Health Per Interval",
"",
"",
"Upward Speed",
"Forward Speed",
"",
"Gravity",
"Hardness",
"Speed In Honey",
"",
"",
"",
"Delay Before Dissapear",
"Invincibility Time",
"Stealth Time",
"Boots Of Speed Time",
"",
"Money",
"Ammo Amount",
"Ammo Amount",
"",
"",
"",
"XP Amount",
"Ammo Amount",
"Ammo Amount",
"Ammo Amount",
"Ammo Amount",
"Ammo Amount",
"",
"Ammo Amount",
"Ammo Amount",
"Ammo Amount",
"Ammo Amount",
"Ammo Amount",
"Ammo Amount",
"Ammo Amount",
"",
"",
"Camouflage Time",
"Gravity Time",
"Time To Back"
};
new const g_property1_default_value[TOTAL_BLOCKS][] =
{
"",
"0",
"5",
"1",
"",
"",
"500",
"750",
"",
"200",
"2",
"75",
"",
"",
"",
"1",
"10",
"10",
"10",
"",
"2000",
"1",
"1",
"",
"",
"",
"2",
"1",
"1",
"1",
"1",
"1",
"",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"",
"15",
"10",
"10"
};
new const g_property2_name[TOTAL_BLOCKS][] =
{
"",
"",
"Interval Between Damage",
"Interval Between Heals",
"",
"",
"",
"Upward Speed",
"",
"",
"",
"",
"",
"",
"",
"",
"Delay After Usage",
"Delay After Usage",
"Delay After Usage",
"",
"",
"",
"",
"",
"",
"",
"Delay After Usage",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"Delay After Usage",
"Delay After Usage",
"Delay After Usage"
};
new const g_property2_default_value[TOTAL_BLOCKS][] =
{
"",
"",
"0.5",
"0.5",
"",
"",
"",
"250",
"",
"",
"",
"",
"",
"",
"",
"",
"60",
"60",
"60",
"",
"",
"",
"",
"",
"",
"",
"999",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"60",
"60",
"60"
};
new const g_property3_name[TOTAL_BLOCKS][] =
{
"Transparency",
"Transparency",
"Transparency",
"Transparency",
"Transparency",
"Transparency",
"Transparency",
"Transparency",
"Transparency",
"Transparency",
"Transparency",
"Transparency",
"Transparency",
"Transparency",
"",
"Transparency",
"",
"",
"Speed",
"Transparency",
"Transparency",
"Transparency",
"Transparency",
"Transparency",
"Transparency",
"Transparency",
"",
"Transparency",
"Transparency",
"Transparency",
"Transparency",
"Transparency",
"Transparency",
"Transparency",
"Transparency",
"Transparency",
"Transparency",
"Transparency",
"Transparency",
"Transparency",
"Transparency",
"Transparency",
"Transparency",
"Gravity",
""
};
new const g_property3_default_value[TOTAL_BLOCKS][] =
{
"255",
"255",
"255",
"255",
"255",
"255",
"255",
"255",
"255",
"255",
"255",
"255",
"255",
"255",
"",
"255",
"255",
"",
"",
"400",
"255",
"255",
"255",
"255",
"255",
"255",
"",
"255",
"255",
"255",
"255",
"255",
"255",
"255",
"255",
"255",
"255",
"255",
"255",
"255",
"255",
"255",
"255",
"500",
""
};
new const g_property4_name[TOTAL_BLOCKS][] =
{
"",
"On Top Only",
"On Top Only",
"On Top Only",
"",
"",
"On Top Only",
"On Top Only",
"On Top Only",
"On Top Only",
"On Top Only",
"On Top Only",
"On Top Only",
"On Top Only",
"",
"On Top Only",
"On Top Only",
"On Top Only",
"On Top Only",
"On Top Only",
"On Top Only",
"On Top Only",
"On Top Only",
"On Top Only",
"On Top Only",
"On Top Only",
"On Top Only",
"On Top Only",
"On Top Only",
"On Top Only",
"On Top Only",
"On Top Only",
"On Top Only",
"On Top Only",
"On Top Only",
"On Top Only",
"On Top Only",
"On Top Only",
"On Top Only",
"On Top Only",
"On Top Only",
"On Top Only",
"On Top Only",
"On Top Only",
"On Top Only"
};
new const g_property4_default_value[TOTAL_BLOCKS][] =
{
"",
"0",
"1",
"1",
"",
"",
"0",
"0",
"1",
"0",
"1",
"0",
"0",
"0",
"",
"0",
"0",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"0",
"1",
"1",
"1"
};
new const g_block_save_ids[TOTAL_BLOCKS] =
{
'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',
'Z',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
'@',
'#',
'$',
'%',
'(',
'&',
')',
'|',
'>',
'<'
};
new g_block_models[TOTAL_BLOCKS][256];
new g_block_selection_pages_max;
public plugin_precache()
{
g_block_models[PLATFORM] = g_model_platform;
g_block_models[BUNNYHOP] = g_model_bunnyhop;
g_block_models[DAMAGE] = g_model_damage;
g_block_models[HEALER] = g_model_healer;
g_block_models[NO_FALL_DAMAGE] = g_model_no_fall_damage;
g_block_models[ICE] = g_model_ice;
g_block_models[TRAMPOLINE] = g_model_trampoline;
g_block_models[SPEED_BOOST] = g_model_speed_boost;
g_block_models[DEATH] = g_model_death;
g_block_models[LOW_GRAVITY] = g_model_low_gravity;
g_block_models[SLAP] = g_model_slap;
g_block_models[HONEY] = g_model_honey;
g_block_models[CT_BARRIER] = g_model_ct_barrier;
g_block_models[T_BARRIER] = g_model_t_barrier;
g_block_models[GLASS] = g_model_glass;
g_block_models[DELAYED_BUNNYHOP] = g_model_delayed_bunnyhop;
g_block_models[INVINCIBILITY] = g_model_invincibility;
g_block_models[STEALTH] = g_model_stealth;
g_block_models[BOOTS_OF_SPEED] = g_model_boots_of_speed;
g_block_models[DUCK] = g_model_duck;
g_block_models[MONEY] = g_model_money;
g_block_models[AWP] = g_model_awp;
g_block_models[DEAGLE] = g_model_deagle;
g_block_models[HE] = g_model_he;
g_block_models[FLASH] = g_model_flash;
g_block_models[SMOKE] = g_model_smoke;
g_block_models[XP] = g_model_xp;
g_block_models[SCOUT] = g_model_scout;
g_block_models[GLOCK] = g_model_glock;
g_block_models[USP] = g_model_usp;
g_block_models[M4A1] = g_model_m4a1;
g_block_models[M3] = g_model_m3;
g_block_models[BLIND] = g_model_blind;
g_block_models[P90] = g_model_p90;
g_block_models[GALIL] = g_model_galil;
g_block_models[FAMAS] = g_model_famas;
g_block_models[AK47] = g_model_ak47;
g_block_models[AUG] = g_model_AUG;
g_block_models[SG552] = g_model_SG552;
g_block_models[SG550] = g_model_SG550;
g_block_models[VESTHELM] = g_model_VestHelm;
g_block_models[ICEBHOP] = g_model_IceBhop;
g_block_models[CAM] = g_model_cam;
g_block_models[SUPER] = g_model_superman;
g_block_models[MAGIC] = g_model_magic;
SetupBlockRendering(GLASS, TRANSWHITE, 255, 255, 255, 100);
SetupBlockRendering(INVINCIBILITY, GLOWSHELL, 255, 255, 255, 16);
SetupBlockRendering(STEALTH, TRANSWHITE, 255, 255, 255, 100);
new block_model[256];
for ( new i = 0; i < TOTAL_BLOCKS; ++i )
{
precache_model(g_block_models[i]);
SetBlockModelName(block_model, g_block_models[i], "Tiny");
precache_model(block_model);
SetBlockModelName(block_model, g_block_models[i], "Large");
precache_model(block_model);
SetBlockModelName(block_model, g_block_models[i], "Pole");
precache_model(block_model);
}
precache_model(g_sprite_light);
precache_model(g_sprite_teleport_start);
precache_model(g_sprite_teleport_destination);
g_sprite_beam = precache_model("sprites/zbeam4.spr");
precache_sound(g_sound_invincibility);
precache_sound(g_sound_stealth);
precache_sound(g_sound_boots_of_speed);
precache_sound(g_sound_money);
precache_sound(g_sound_cam);
precache_sound(g_sound_teleport);
}
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
RegisterSayCmd("/bm", "CmdMainMenu");
register_clcmd("bm", "CmdMainMenu");
register_clcmd("smg", "SlayUser");
register_cvar("bm_telefrag", "1");
register_cvar("bm_awpcooldown", "999.0");
register_cvar("bm_deaglecooldown", "999.0");
register_cvar("bm_scoutcooldown", "999.0");
register_cvar("bm_glockcooldown", "999.0");
register_cvar("bm_uspcooldown", "999.0");
register_cvar("bm_m4a1cooldown", "999.0");
register_cvar("bm_m3cooldown", "999.0");
register_cvar("bm_mp5cooldown", "999.0");
register_cvar("bm_p90cooldown", "999.0");
register_cvar("bm_galilcooldown", "999.0");
register_cvar("bm_famascooldown", "999.0");
register_cvar("bm_ak47cooldown", "999.0");
register_cvar("bm_augcooldown", "999.0");
register_cvar("bm_sg552cooldown", "999.0");
register_cvar("bm_sg550cooldown", "999.0");
register_cvar("bm_vesthelmcooldown", "999.0");
new command[32] = "CmdShowInfo";
RegisterSayCmd("BM", command);
RegisterSayCmd("Info", command);
RegisterSayCmd("Help", command);
command = "CmdSaveCheckpoint";
RegisterSayCmd("cp", command);
RegisterSayCmd("savecp", command);
RegisterSayCmd("checkpoint", command);
RegisterSayCmd("savecheckpoint", command);
command = "CmdLoadCheckpoint";
RegisterSayCmd("tp", command);
RegisterSayCmd("gocheck", command);
RegisterSayCmd("teleport", command);
RegisterSayCmd("loadcheck", command);
RegisterSayCmd("teleportcp", command);
RegisterSayCmd("gocheckpoint", command);
RegisterSayCmd("loadcheckpoint", command);
command = "CmdReviveYourself";
RegisterSayCmd("rs", command);
RegisterSayCmd("spawn", command);
RegisterSayCmd("revive", command);
RegisterSayCmd("respawn", command);
RegisterSayCmd("restart", command);
register_clcmd("SCM_SetProperty", "SetPropertyBlock", -1);
register_clcmd("SCM_SetLightProperty", "SetPropertyLight", -1);
register_clcmd("SCM_Revive", "RevivePlayer", -1);
register_clcmd("SCM_GiveAccess", "GiveAccess", -1);
command = "CmdGrab";
register_clcmd("+bmgrab", command, -1, g_blank);
register_clcmd("+bmgrab", command, -1, g_blank);
command = "CmdRelease";
register_clcmd("-bmgrab", command, -1, g_blank);
register_clcmd("-bmgrab", command, -1, g_blank);
CreateMenus();
register_menucmd(register_menuid("SCMMainMenu"), g_keys_main_menu, "HandleMainMenu");
register_menucmd(register_menuid("SCMBlockMenu"), g_keys_block_menu, "HandleBlockMenu");
register_menucmd(register_menuid("SCMBlockSelectionMenu"), g_keys_block_selection_menu, "HandleBlockSelectionMenu");
register_menucmd(register_menuid("SCMPropertiesMenu"), g_keys_properties_menu, "HandlePropertiesMenu");
register_menucmd(register_menuid("SCMMoveMenu"), g_keys_move_menu, "HandleMoveMenu");
register_menucmd(register_menuid("SCMTeleportMenu"), g_keys_teleport_menu, "HandleTeleportMenu");
register_menucmd(register_menuid("SCMLightMenu"), g_keys_light_menu, "HandleLightMenu");
register_menucmd(register_menuid("SCMLightPropertiesMenu"), g_keys_light_properties_menu, "HandleLightPropertiesMenu");
register_menucmd(register_menuid("SCMOptionsMenu"), g_keys_options_menu, "HandleOptionsMenu");
register_menucmd(register_menuid("SCMChoiceMenu"), g_keys_choice_menu, "HandleChoiceMenu");
register_menucmd(register_menuid("SCMCommandsMenu"), g_keys_commands_menu, "HandleCommandsMenu");
RegisterHam(Ham_Spawn, "player", "FwdPlayerSpawn", 1);
RegisterHam(Ham_Killed, "player", "FwdPlayerKilled", 1);
register_forward(FM_CmdStart, "FwdCmdStart");
register_think(g_light_classname, "LightThink");
register_event("CurWeapon", "EventCurWeapon", "be");
register_event("HLTV", "eventNewRound", "a", "1=0", "2=0");
register_message(get_user_msgid("StatusValue"), "MsgStatusValue");
g_cvar_textures = register_cvar("SCM_Textures", "wAnderFAKE", 0, 0.0);
g_max_players = get_maxplayers();
gmsgScreenFade = get_user_msgid("ScreenFade");
g_msgSayText = get_user_msgid("SayText");
g_MaxPlayers = global_get(glb_maxClients);
new dir[64];
get_datadir(dir, charsmax(dir));
new folder[64];
formatex(folder, charsmax(folder), "/%s", PLUGIN_PREFIX);
add(dir, charsmax(dir), folder);
if ( !dir_exists(dir) ) mkdir(dir);
new map[32];
get_mapname(map, charsmax(map));
formatex(g_file, charsmax(g_file), "%s/%s.%s", dir, map, PLUGIN_PREFIX);
set_task( 120.0, "TASK_Advertise", _, _, _, "b" );
}
public plugin_cfg()
{
LoadBlocks(0);
}
public client_putinserver(id)
{
g_connected[id] = bool:!is_user_hltv(id);
g_alive[id] = false;
g_admin[id] = bool:access(id, ADMIN_MENU);
g_gived_access[id] = false;
g_viewing_properties_menu[id] = false;
g_viewing_light_properties_menu[id] = false;
g_viewing_commands_menu[id] = false;
g_snapping[id] = true;
g_grid_size[id] = 1.0;
g_snapping_gap[id] = 0.0;
g_group_count[id] = 0;
g_noclip[id] = false;
g_godmode[id] = false;
g_has_checkpoint[id] = false;
g_checkpoint_duck[id] = false;
g_reseted[id] = false;
ResetPlayer(id);
}
public client_disconnect(id)
{
g_connected[id] = false;
g_alive[id] = false;
ClearGroup(id);
if ( g_grabbed[id] )
{
if ( is_valid_ent(g_grabbed[id]) )
{
entity_set_int(g_grabbed[id], EV_INT_iuser2, 0);
}
g_grabbed[id] = 0;
}
}
public eventNewRound()
{
new iEnt, Float:fOrigin[3];
while( (iEnt = find_ent_by_class(iEnt, g_block_classname)) )
{
new blockType = pev(iEnt, pev_body);
if( blockType == MAGIC )
{
pev(iEnt, pev_v_angle, fOrigin);
set_pev(iEnt, pev_velocity, Float:{0.0, 0.0, 0.0});
engfunc(EngFunc_SetOrigin, iEnt, fOrigin);
}
}
}
RegisterSayCmd(const command[], const handle[])
{
static temp[64];
register_clcmd(command, handle, -1, g_blank);
formatex(temp, charsmax(temp), "say /bm", command);
register_clcmd(temp, handle, -1, g_blank);
formatex(temp, charsmax(temp), "say_team /bm", command);
register_clcmd(temp, handle, -1, g_blank);
}
CreateMenus()
{
g_block_selection_pages_max = floatround((float(TOTAL_BLOCKS) / 8.0), floatround_ceil);
new size = charsmax(g_main_menu);
add(g_main_menu, size, "\r[%s] \y%s \rv%s^n^n");
add(g_main_menu, size, "\r1. \wBlock Menu^n");
add(g_main_menu, size, "\r2. \wTeleport Menu^n");
add(g_main_menu, size, "\r3. \wLight Menu^n");
add(g_main_menu, size, "\r4. \wAdmin Menu^n");
add(g_main_menu, size, "\r5. \wMove Menu^n^n");
add(g_main_menu, size, "%s6. %sNoclip: %s^n");
add(g_main_menu, size, "%s7. %sGodmode: %s^n^n");
add(g_main_menu, size, "\r9. \wHelp^n");
add(g_main_menu, size, "\r0. \wClose");
g_keys_main_menu = B1 | B2 | B3 | B4 | B5 | B6 | B7 | B9 | B0;
size = charsmax(g_block_menu);
add(g_block_menu, size, "\r[%s] \yBlock Menu^n^n");
add(g_block_menu, size, "\r1. \wBlock Type: \y%s^n");
add(g_block_menu, size, "%s2. %s\wCreate^n");
add(g_block_menu, size, "%s3. %s\wConvert^n");
add(g_block_menu, size, "%s4. %s\wDelete^n");
add(g_block_menu, size, "%s5. %s\wRotate^n");
add(g_block_menu, size, "\r6. \wNoclip: %s^n^n");
add(g_block_menu, size, "%s7. %s\wSet Properties^n");
add(g_block_menu, size, "\r8. \wBlock Size: \y%s^n");
add(g_block_menu, size, "\r9. \wOptions Menu^n");
add(g_block_menu, size, "\r0. \wBack");
g_keys_block_menu = B1 | B2 | B3 | B4 | B5 | B6 | B7 | B8 | B9 | B0;
g_keys_block_selection_menu = B1 | B2 | B3 | B4 | B5 | B6 | B7 | B8 | B9 | B0;
g_keys_properties_menu = B1 | B2 | B3 | B4 | B0;
size = charsmax(g_move_menu);
add(g_move_menu, size, "\r[%s] \yMove Menu^n^n");
add(g_move_menu, size, "\r1. \wGrid Size: \y%.1f^n^n");
add(g_move_menu, size, "\r2. \wZ\y+^n");
add(g_move_menu, size, "\r3. \wZ\r-^n");
add(g_move_menu, size, "\r4. \wX\y+^n");
add(g_move_menu, size, "\r5. \wX\r-^n");
add(g_move_menu, size, "\r6. \wY\y+^n");
add(g_move_menu, size, "\r7. \wY\r-^n^n^n");
add(g_move_menu, size, "\r0. \wBack");
g_keys_move_menu = B1 | B2 | B3 | B4 | B5 | B6 | B7 | B0;
size = charsmax(g_teleport_menu);
add(g_teleport_menu, size, "\r[%s] \yTeleport Menu^n^n");
add(g_teleport_menu, size, "%s1. %sCreate Start^n");
add(g_teleport_menu, size, "%s2. %sCreate Destination^n^n");
add(g_teleport_menu, size, "%s3. %sDelete Teleport^n^n");
add(g_teleport_menu, size, "%s4. %sSwap Start/Destination^n^n");
add(g_teleport_menu, size, "%s5. %sShow Teleport Path^n^n^n");
add(g_teleport_menu, size, "\r0. \wBack");
g_keys_teleport_menu = B1 | B2 | B3 | B4 | B5 | B0;
size = charsmax(g_light_menu);
add(g_light_menu, size, "\r[%s] \yLights Menu^n^n");
add(g_light_menu, size, "%s1. %sCreate Light^n");
add(g_light_menu, size, "%s2. %sDelete Light^n^n");
add(g_light_menu, size, "%s3. %sChange Color^n^n^n^n^n^n^n");
add(g_light_menu, size, "\r0. \wBack");
g_keys_light_menu = B1 | B2 | B3 | B0;
size = charsmax(g_light_properties_menu);
add(g_light_properties_menu, size, "\r[%s] \ySet Properties^n^n");
add(g_light_properties_menu, size, "\r1. \wRadius: \y%s^n");
add(g_light_properties_menu, size, "\r2. \wColor Red: \y%s^n");
add(g_light_properties_menu, size, "\r3. \wColor Green: \y%s^n");
add(g_light_properties_menu, size, "\r4. \wColor Blue: \y%s^n^n^n^n^n^n^n");
add(g_light_properties_menu, size, "\r0. \wBack");
g_keys_light_properties_menu = B1 | B2 | B3 | B4 | B0;
size = charsmax(g_options_menu);
add(g_options_menu, size, "\r[%s] \yOptions Menu^n^n");
add(g_options_menu, size, "%s1. %sSnapping: %s^n");
add(g_options_menu, size, "%s2. %sSnapping Gap: \y%.1f^n^n");
add(g_options_menu, size, "%s3. %sAdd to Group^n");
add(g_options_menu, size, "%s4. %sClear Group^n^n");
add(g_options_menu, size, "%s5. %sDelete All^n");
add(g_options_menu, size, "%s6. %sSave^n");
add(g_options_menu, size, "%s7. %sLoad^n^n");
add(g_options_menu, size, "\r0. \wBack");
g_keys_options_menu = B1 | B2 | B3 | B4 | B5 | B6 | B7 | B0;
size = charsmax(g_choice_menu);
add(g_choice_menu, size, "\y%s^n^n");
add(g_choice_menu, size, "\r1. \wYes^n");
add(g_choice_menu, size, "\r2. \wNo^n^n^n^n^n^n^n^n^n");
g_keys_choice_menu = B1 | B2;
size = charsmax(g_commands_menu);
add(g_commands_menu, size, "\r[%s] \yAdmin Menu^n^n");
add(g_commands_menu, size, "%s1. %sSave Checkpoint^n");
add(g_commands_menu, size, "%s2. %sLoad Checkpoint^n^n");
add(g_commands_menu, size, "%s3. %sRevive Yourself^n");
add(g_commands_menu, size, "%s4. %sRevive Player^n");
add(g_commands_menu, size, "%s5. %sRevive Everyone^n^n");
add(g_commands_menu, size, "%s6. %s%s Godmode %s Everyone^n");
add(g_commands_menu, size, "%s7. %sGive Access to %s^n^n");
add(g_commands_menu, size, "\r0. \wBack");
g_keys_commands_menu = B1 | B2 | B3 | B4 | B5 | B6 | B7 | B0;
}
SetupBlockRendering(block_type, render_type, red, green, blue, alpha)
{
g_render[block_type] = render_type;
g_red[block_type] = red;
g_green[block_type] = green;
g_blue[block_type] = blue;
g_alpha[block_type] = alpha;
}
SetBlockModelName(model_target[256], model_source[256], const new_name[])
{
model_target = model_source;
replace(model_target, charsmax(model_target), "Normal", new_name);
}
public FwdPlayerSpawn(id)
{
if ( !is_user_alive(id) ) return HAM_IGNORED;
g_alive[id] = true;
if ( g_noclip[id] ) set_user_noclip(id, 1);
if ( g_godmode[id] ) set_user_godmode(id, 1);
if ( g_all_godmode )
{
for ( new i = 1; i <= g_max_players; i++ )
{
if ( !g_alive[i]
|| g_admin[i]
|| g_gived_access[i] ) continue;
entity_set_float(i, EV_FL_takedamage, DAMAGE_NO);
}
}
if ( g_viewing_commands_menu[id] ) ShowCommandsMenu(id);
if ( !g_reseted[id] )
{
ResetPlayer(id);
}
g_reseted[id] = false;
AwpUsed[id] = false;
DeagleUsed[id] = false;
ScoutUsed[id] = false;
GlockUsed[id] = false;
USPUsed[id] = false;
M4A1Used[id] = false;
M3Used[id] = false;
MP5Used[id] = false;
P90Used[id] = false;
GalilUsed[id] = false;
FamasUsed[id] = false;
AK47Used[id] = false;
AUGUsed[id] = false;
SG552Used[id] = false;
SG550Used[id] = false;
VestHelmUsed[id] = false;
HeUsed[id] = false;
FlashUsed[id] = false;
SmokeUsed[id] = false;
return HAM_IGNORED;
}
public FwdPlayerKilled(id)
{
g_alive[id] = bool:is_user_alive(id);
ResetPlayer(id);
if ( g_viewing_commands_menu[id] ) ShowCommandsMenu(id);
}
public FwdCmdStart(id, handle)
{
if ( !g_connected[id] ) return FMRES_IGNORED;
static buttons, oldbuttons;
buttons = get_uc(handle, UC_Buttons);
oldbuttons = entity_get_int(id, EV_INT_oldbuttons);
if ( g_alive[id]
&& ( buttons & IN_USE )
&& !( oldbuttons & IN_USE )
&& !g_has_hud_text[id] )
{
static ent, body;
get_user_aiming(id, ent, body, 9999);
if ( IsBlock(ent) )
{
static block_type;
block_type = entity_get_int(ent, EV_INT_body);
static property[5];
static message[512], len;
len = format(message, charsmax(message), "Type: %s", g_block_names[block_type]);
if ( g_property1_name[block_type][0] )
{
GetProperty(ent, 1, property);
if ( ( block_type == BUNNYHOP )
&& property[0] == '1' )
{
len += format(message[len], charsmax(message) - len, "^n%s", g_property1_name[block_type]);
}
else if ( block_type == SLAP )
{
len += format(message[len], charsmax(message) - len, "^n%s: %s", g_property1_name[block_type], property[0] == '3' ? "High" : property[0] == '2' ? "Medium" : "Low");
}
else if ( block_type != BUNNYHOP )
{
len += format(message[len], charsmax(message) - len, "^n%s: %s", g_property1_name[block_type], property);
}
}
if ( g_property2_name[block_type][0] )
{
GetProperty(ent, 2, property);
len += format(message[len], charsmax(message) - len, "^n%s: %s", g_property2_name[block_type], property);
}
if ( g_property3_name[block_type][0] )
{
GetProperty(ent, 3, property);
if ( block_type == BOOTS_OF_SPEED
|| property[0] != '0'
&& !( property[0] == '2' && property[1] == '5' && property[2] == '5' ) )
{
len += format(message[len], charsmax(message) - len, "^n%s: %s", g_property3_name[block_type], property);
}
}
if ( g_property4_name[block_type][0] )
{
GetProperty(ent, 4, property);
len += format(message[len], charsmax(message) - len, "^n%s: %s", g_property4_name[block_type], property[0] == '1' ? "Yes" : "No");
}
new szCreator[32];
pev(ent, pev_targetname, szCreator, 31);
replace_all(szCreator, 31, "_", " ");
len += format(message[len], charsmax(message) - len, "^nCreator: %s", szCreator);
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, message);
}
else if ( IsLight(ent) )
{
static property1[5], property2[5], property3[5], property4[5];
GetProperty(ent, 1, property1);
GetProperty(ent, 2, property2);
GetProperty(ent, 3, property3);
GetProperty(ent, 4, property4);
new szCreator[32];
pev(ent, pev_targetname, szCreator, 31);
replace_all(szCreator, 31, "_", " ");
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "Type: Light^nRadius: %s^nColor Red: %s^nColor Green: %s^nColor Blue: %s^nCreator: %s", property1, property2, property3, property4, szCreator);
}
}
if ( !g_grabbed[id] ) return FMRES_IGNORED;
if ( ( buttons & IN_JUMP )
&& !( oldbuttons & IN_JUMP ) ) if ( g_grab_length[id] > 72.0 ) g_grab_length[id] -= 16.0;
if ( ( buttons & IN_DUCK )
&& !( oldbuttons & IN_DUCK ) ) g_grab_length[id] += 16.0;
if ( ( buttons & IN_ATTACK )
&& !( oldbuttons & IN_ATTACK ) ) CmdAttack(id);
if ( ( buttons & IN_ATTACK2 )
&& !( oldbuttons & IN_ATTACK2 ) ) CmdAttack2(id);
if ( ( buttons & IN_RELOAD )
&& !( oldbuttons & IN_RELOAD ) )
{
CmdRotate(id);
set_uc(handle, UC_Buttons, buttons & ~IN_RELOAD);
}
if ( !is_valid_ent(g_grabbed[id]) )
{
CmdRelease(id);
return FMRES_IGNORED;
}
if ( !IsBlockInGroup(id, g_grabbed[id])
|| g_group_count[id] < 1 )
{
MoveGrabbedEntity(id);
return FMRES_IGNORED;
}
static block;
static Float:move_to[3];
static Float:offset[3];
static Float:origin[3];
MoveGrabbedEntity(id, move_to);
for ( new i = 0; i <= g_group_count[id]; ++i )
{
block = g_grouped_blocks[id][i];
if ( !IsBlockInGroup(id, block) ) continue;
entity_get_vector(block, EV_VEC_vuser1, offset);
origin[0] = move_to[0] - offset[0];
origin[1] = move_to[1] - offset[1];
origin[2] = move_to[2] - offset[2];
MoveEntity(id, block, origin, false);
}
return FMRES_IGNORED;
}
public EventCurWeapon(id)
{
static block, property[5];
if ( g_boots_of_speed[id] )
{
block = g_boots_of_speed[id];
GetProperty(block, 3, property);
entity_set_float(id, EV_FL_maxspeed, str_to_float(property));
}
else if ( g_ice[id] )
{
entity_set_float(id, EV_FL_maxspeed, 400.0);
}
else if ( g_honey[id] )
{
block = g_honey[id];
GetProperty(block, 1, property);
entity_set_float(id, EV_FL_maxspeed, str_to_float(property));
}
}
public pfn_touch(ent, id)
{
if ( !( 1 <= id <= g_max_players )
|| !g_alive[id]
|| !IsBlock(ent) ) return PLUGIN_CONTINUE;
new block_type = entity_get_int(ent, EV_INT_body);
if ( block_type == PLATFORM
|| block_type == GLASS ) return PLUGIN_CONTINUE;
new flags = entity_get_int(id, EV_INT_flags);
new groundentity = entity_get_edict(id, EV_ENT_groundentity);
static property[5];
GetProperty(ent, 4, property);
if ( property[0] == '0'
|| ( ( !property[0]
|| property[0] == '1'
|| property[0] == '/' )
&& ( flags & FL_ONGROUND )
&& groundentity == ent ) )
{
switch ( block_type )
{
case BUNNYHOP: ActionBhop(ent);
case DAMAGE: ActionDamage(id, ent);
case HEALER: ActionHeal(id, ent);
case TRAMPOLINE: ActionTrampoline(id, ent);
case SPEED_BOOST: ActionSpeedBoost(id, ent);
case DEATH:
{
if ( !get_user_godmode(id) )
{
fakedamage(id, "The Block of Death", 10000.0, DMG_GENERIC);
}
}
case SLAP:
{
GetProperty(ent, 1, property);
g_slap_times[id] = str_to_num(property) * 2;
}
case LOW_GRAVITY: ActionLowGravity(id, ent);
case HONEY: ActionHoney(id, ent);
case CT_BARRIER: ActionBarrier(id, ent, true);
case T_BARRIER: ActionBarrier(id, ent, false);
case DELAYED_BUNNYHOP: ActionDelayedBhop(ent);
case STEALTH: ActionStealth(id, ent);
case INVINCIBILITY: ActionInvincibility(id, ent);
case BOOTS_OF_SPEED: ActionBootsOfSpeed(id, ent);
case DUCK: ActionDuck(id, ent);
case MONEY: ActionMoney(id, ent);
case AWP: ActionAwp(id, ent);
case DEAGLE: ActionDeagle(id, ent);
case SCOUT: ActionScout(id, ent);
case GLOCK: ActionGlock(id, ent);
case USP: ActionUSP(id, ent);
case M4A1: ActionM4A1(id, ent);
case M3: ActionM3(id, ent);
case BLIND: ActionBlind(id);
case P90: ActionP90(id, ent);
case GALIL: ActionGalil(id, ent);
case FAMAS: ActionFamas(id, ent);
case AK47: ActionAK47(id, ent);
case AUG: ActionAUG(id, ent);
case SG552: ActionSG552(id, ent);
case SG550: ActionSG550(id, ent);
case VESTHELM: ActionVestHelm(id, ent);
case HE: ActionHe(id, ent);
case FLASH: ActionFlash(id, ent);
case SMOKE: ActionSmoke(id, ent);
case XP: ActionXp(id, ent);
case ICEBHOP: ActionIceBhop(id, ent);
case CAM: ActionCam(id, ent);
case SUPER: ActionSuper(id, ent);
case MAGIC: ActionMagic(id, ent);
}
}
if ( ( flags & FL_ONGROUND )
&& groundentity == ent )
{
switch ( block_type )
{
case BUNNYHOP:
{
GetProperty(ent, 1, property);
if ( property[0] == '1' )
{
g_no_fall_damage[id] = true;
}
}
case NO_FALL_DAMAGE: g_no_fall_damage[id] = true;
case ICE: ActionIce(id);
}
}
return PLUGIN_CONTINUE;
}
public server_frame()
{
for ( new id = 1; id <= g_max_players; ++id )
{
if ( !g_alive[id] ) continue;
if ( g_ice[id] || g_no_slow_down[id] )
{
entity_set_float(id, EV_FL_fuser2, 0.0);
}
if ( g_set_velocity[id][0] != 0.0
|| g_set_velocity[id][1] != 0.0
|| g_set_velocity[id][2] != 0.0 )
{
entity_set_vector(id, EV_VEC_velocity, g_set_velocity[id]);
g_set_velocity[id][0] = 0.0;
g_set_velocity[id][1] = 0.0;
g_set_velocity[id][2] = 0.0;
}
if ( g_low_gravity[id] )
{
if ( entity_get_int(id, EV_INT_flags) & FL_ONGROUND )
{
entity_set_float(id, EV_FL_gravity, 1.0);
g_low_gravity[id] = false;
}
}
if ( g_honey[id] )
{
if ( entity_get_int(id, EV_INT_flags) & FL_ONGROUND )
{
entity_set_float(id, EV_FL_speed, 250.0);
g_honey[id] = false;
}
}
while ( g_slap_times[id] )
{
user_slap(id, 0);
g_slap_times[id]--;
}
}
static ent;
static entinsphere;
static Float:origin[3];
while ( ( ent = find_ent_by_class(ent, g_start_classname) ) )
{
entity_get_vector(ent, EV_VEC_origin, origin);
entinsphere = -1;
while ( ( entinsphere = find_ent_in_sphere(entinsphere, origin, 40.0) ) )
{
static classname[32];
entity_get_string(entinsphere, EV_SZ_classname, classname, charsmax(classname));
if ( 1 <= entinsphere <= g_max_players && g_alive[entinsphere] )
{
ActionTeleport(entinsphere, ent);
}
else if ( equal(classname, "grenade") )
{
entity_set_int(ent, EV_INT_solid, SOLID_NOT);
entity_set_float(ent, EV_FL_ltime, get_gametime() + 2.0);
}
else if ( get_gametime() >= entity_get_float(ent, EV_FL_ltime) )
{
entity_set_int(ent, EV_INT_solid, SOLID_BBOX);
}
}
}
static bool:ent_near;
ent_near = false;
while ( ( ent = find_ent_by_class(ent, g_destination_classname) ) )
{
entity_get_vector(ent, EV_VEC_origin, origin);
entinsphere = -1;
while ( ( entinsphere = find_ent_in_sphere(entinsphere, origin, 64.0) ) )
{
static classname[32];
entity_get_string(entinsphere, EV_SZ_classname, classname, charsmax(classname));
if ( 1 <= entinsphere <= g_max_players && g_alive[entinsphere]
|| equal(classname, "grenade") )
{
ent_near = true;
break;
}
}
if ( ent_near )
{
if ( !entity_get_int(ent, EV_INT_iuser2) )
{
entity_set_int(ent, EV_INT_solid, SOLID_NOT);
}
}
else
{
entity_set_int(ent, EV_INT_solid, SOLID_BBOX);
}
}
}
public client_PreThink(id)
{
if ( !g_alive[id] ) return PLUGIN_CONTINUE;
new Float:gametime = get_gametime();
new Float:timeleft_invincibility = g_invincibility_time_out[id] - gametime;
new Float:timeleft_stealth = g_stealth_time_out[id] - gametime;
new Float:timeleft_boots_of_speed = g_boots_of_speed_time_out[id] - gametime;
new Float:timeleft_cam = g_cam_time_out[id] - gametime;
new Float:timeleft_super = g_super_time_out[id] - gametime;
if ( timeleft_invincibility >= 0.0
|| timeleft_stealth >= 0.0
|| timeleft_boots_of_speed >= 0.0
|| timeleft_cam >= 0.0
|| timeleft_super >= 0.0 )
{
new text[48], text_to_show[256];
format(text, charsmax(text), "");
add(text_to_show, charsmax(text_to_show), text);
if ( timeleft_invincibility >= 0.0 )
{
format(text, charsmax(text), "^nInvincible %.1f", timeleft_invincibility);
add(text_to_show, charsmax(text_to_show), text);
}
if ( timeleft_stealth >= 0.0 )
{
format(text, charsmax(text), "^nStealth %.1f", timeleft_stealth);
add(text_to_show, charsmax(text_to_show), text);
}
if ( timeleft_boots_of_speed >= 0.0 )
{
format(text, charsmax(text), "^nBoots Of Speed %.1f", timeleft_boots_of_speed);
add(text_to_show, charsmax(text_to_show), text);
}
if ( timeleft_cam >= 0.0 )
{
format(text, charsmax(text), "^nCamouflage %.1f", timeleft_cam);
add(text_to_show, charsmax(text_to_show), text);
}
if ( timeleft_super >= 0.0 )
{
format(text, charsmax(text), "^nSuper Man %.1f", timeleft_super);
add(text_to_show, charsmax(text_to_show), text);
}
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, text_to_show);
g_has_hud_text[id] = true;
}
else
{
g_has_hud_text[id] = false;
}
if (is_user_alive(id))
{
//if player has low gravity
if (gbLowGravity[id])
{
//get players flags
new flags = entity_get_int(id, EV_INT_flags);
//if player has feet on the ground, set gravity to normal
if (flags & FL_ONGROUND)
{
set_user_gravity(id);
gbLowGravity[id] = false;
}
}
}
return PLUGIN_HANDLED;
}
public client_PostThink(id)
{
if ( !g_alive[id] ) return PLUGIN_CONTINUE;
if ( g_no_fall_damage[id] )
{
entity_set_int(id, EV_INT_watertype, -3);
g_no_fall_damage[id] = false;
}
return PLUGIN_CONTINUE;
}
ActionBhop(ent)
{
if ( task_exists(TASK_SOLIDNOT + ent)
|| task_exists(TASK_SOLID + ent) ) return PLUGIN_HANDLED;
set_task(0.1, "TaskSolidNot", TASK_SOLIDNOT + ent);
return PLUGIN_HANDLED;
}
ActionDamage(id, ent)
{
new Float:gametime = get_gametime();
if ( !( gametime >= g_next_damage_time[id] )
|| get_user_health(id) <= 0
|| get_user_godmode(id) ) return PLUGIN_HANDLED;
static property[5];
GetProperty(ent, 1, property);
fakedamage(id, "Damage Block", str_to_float(property), DMG_CRUSH);
GetProperty(ent, 2, property);
g_next_damage_time[id] = gametime + str_to_float(property);
return PLUGIN_HANDLED;
}
ActionIceBhop(id, ent)
{
if ( !g_ice[id] )
{
entity_set_float(id, EV_FL_friction, 0.15);
entity_set_float(id, EV_FL_maxspeed, 400.0);
g_ice[id] = true;
}
new task_id = TASK_ICE + id;
if ( task_exists(task_id) ) remove_task(task_id);
set_task(0.1, "TaskNotOnIce", task_id);
if ( task_exists(TASK_SOLIDNOT + ent)
|| task_exists(TASK_SOLID + ent) ) return PLUGIN_HANDLED;
set_task(0.1, "TaskSolidNot", TASK_SOLIDNOT + ent);
return PLUGIN_HANDLED;
}
ActionHeal(id, ent)
{
new Float:gametime = get_gametime();
if ( !( gametime >= g_next_heal_time[id] ) ) return PLUGIN_HANDLED;
new health = get_user_health(id);
if ( health >= 100 ) return PLUGIN_HANDLED;
static property[5];
GetProperty(ent, 1, property);
health += str_to_num(property);
set_user_health(id, min(100, health));
GetProperty(ent, 2, property);
g_next_heal_time[id] = gametime + str_to_float(property);
return PLUGIN_HANDLED;
}
ActionIce(id)
{
if ( !g_ice[id] )
{
entity_set_float(id, EV_FL_friction, 0.15);
entity_set_float(id, EV_FL_maxspeed, 400.0);
g_ice[id] = true;
}
new task_id = TASK_ICE + id;
if ( task_exists(task_id) ) remove_task(task_id);
set_task(0.1, "TaskNotOnIce", task_id);
}
ActionTrampoline(id, ent)
{
static property1[5];
GetProperty(ent, 1, property1);
entity_get_vector(id, EV_VEC_velocity, g_set_velocity[id]);
g_set_velocity[id][2] = str_to_float(property1);
entity_set_int(id, EV_INT_gaitsequence, 6);
g_no_fall_damage[id] = true;
}
ActionSpeedBoost(id, ent)
{
static property[5];
GetProperty(ent, 1, property);
velocity_by_aim(id, str_to_num(property), g_set_velocity[id]);
GetProperty(ent, 2, property);
g_set_velocity[id][2] = str_to_float(property);
entity_set_int(id, EV_INT_gaitsequence, 6);
}
ActionLowGravity(id, ent)
{
if (gbLowGravity[id]) return PLUGIN_HANDLED;
static property1[5];
GetProperty(ent, 1, property1);
entity_set_float(id, EV_FL_gravity, str_to_float(property1) / 800);
gbLowGravity[id] = true;
return PLUGIN_HANDLED;
}
ActionHoney(id, ent)
{
if ( g_honey[id] != ent)
{
static property1[5];
GetProperty(ent, 1, property1);
new Float:speed = str_to_float(property1);
entity_set_float(id, EV_FL_maxspeed, speed == 0 ? 450.0 : speed);
g_honey[id] = ent;
}
new task_id = TASK_HONEY + id;
if ( task_exists(task_id) )
{
remove_task(task_id);
}
else
{
static Float:velocity[3];
entity_get_vector(id, EV_VEC_velocity, velocity);
velocity[0] /= 2.0;
velocity[1] /= 2.0;
entity_set_vector(id, EV_VEC_velocity, velocity);
}
set_task(0.1, "TaskNotInHoney", task_id);
return PLUGIN_HANDLED;
}
ActionBarrier(id, ent, bool:block_terrorists)
{
if ( task_exists(TASK_SOLIDNOT + ent)
|| task_exists(TASK_SOLID + ent) ) return PLUGIN_HANDLED;
new CsTeams:team = block_terrorists ? CS_TEAM_T : CS_TEAM_CT;
if ( cs_get_user_team(id) == team ) TaskSolidNot(TASK_SOLIDNOT + ent);
return PLUGIN_HANDLED;
}
ActionDelayedBhop(ent)
{
if ( task_exists(TASK_SOLIDNOT + ent)
|| task_exists(TASK_SOLID + ent) ) return PLUGIN_HANDLED;
static property1[5];
GetProperty(ent, 1, property1);
set_task(str_to_float(property1), "TaskSolidNot", TASK_SOLIDNOT + ent);
return PLUGIN_HANDLED;
}
ActionInvincibility(id, ent)
{
new Float:gametime = get_gametime();
if ( !( gametime >= g_invincibility_next_use[id] ) )
{
if ( !g_has_hud_text[id] )
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "^nInvincibility^nNext Use %.1f",g_invincibility_next_use[id] - gametime);
}
return PLUGIN_HANDLED;
}
static property[5];
entity_set_float(id, EV_FL_takedamage, DAMAGE_NO);
if ( gametime >= g_stealth_time_out[id] )
{
set_user_rendering(id, kRenderFxGlowShell, 255, 255, 255, kRenderNormal, 16);
}
emit_sound(id, CHAN_STATIC, g_sound_invincibility, 1.0, ATTN_NORM, 0, PITCH_NORM);
static Float:time_out;
GetProperty(ent, 1, property);
time_out = str_to_float(property);
set_task(time_out, "TaskRemoveInvincibility", TASK_INVINCIBLE + id, g_blank, 0, g_a, 1);
GetProperty(ent, 2, property);
g_invincibility_time_out[id] = gametime + time_out;
g_invincibility_next_use[id] = gametime + time_out + str_to_float(property);
return PLUGIN_HANDLED;
}
ActionStealth(id, ent)
{
new Float:gametime = get_gametime();
if ( !( gametime >= g_stealth_next_use[id] ) )
{
if ( !g_has_hud_text[id] )
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "^nStealth^nNext Use %.1f", g_stealth_next_use[id] - gametime);
}
return PLUGIN_HANDLED;
}
static property[5];
set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransColor, 0);
emit_sound(id, CHAN_STATIC, g_sound_stealth, 1.0, ATTN_NORM, 0, PITCH_NORM);
g_block_status[id] = true;
static Float:time_out;
GetProperty(ent, 1, property);
time_out = str_to_float(property);
set_task(time_out, "TaskRemoveStealth", TASK_STEALTH + id, g_blank, 0, g_a, 1);
set_task(time_out + 1.0, "TaskRemoveStealth", TASK_STEALTH + id, g_blank, 0, g_a, 1);
GetProperty(ent, 2, property);
g_stealth_time_out[id] = gametime + time_out;
g_stealth_next_use[id] = gametime + time_out + str_to_float(property);
return PLUGIN_HANDLED;
}
ActionBootsOfSpeed(id, ent)
{
new Float:gametime = get_gametime();
if ( !( gametime >= g_boots_of_speed_next_use[id] ) )
{
if ( !g_has_hud_text[id] )
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "^nBoots Of Speed^nNext Use %.1f", g_boots_of_speed_next_use[id] - gametime);
}
return PLUGIN_HANDLED;
}
static property[5];
GetProperty(ent, 3, property);
entity_set_float(id, EV_FL_maxspeed, str_to_float(property));
g_boots_of_speed[id] = ent;
emit_sound(id, CHAN_STATIC, g_sound_boots_of_speed, 1.0, ATTN_NORM, 0, PITCH_NORM);
static Float:time_out;
GetProperty(ent, 1, property);
time_out = str_to_float(property);
set_task(time_out, "TaskRemoveBootsOfSpeed", TASK_BOOTSOFSPEED + id, g_blank, 0, g_a, 1);
GetProperty(ent, 2, property);
g_boots_of_speed_time_out[id] = gametime + time_out;
g_boots_of_speed_next_use[id] = gametime + time_out + str_to_float(property);
return PLUGIN_HANDLED;
}
ActionDuck(id, ent)
{
if (is_user_alive(id)) {
static property[5];
GetProperty(ent, 1, property);
entity_set_int(id, EV_INT_bInDuck, 15);
}
}
ActionMoney(id, ent)
{
if(g_money_used[id])
{
static property[5];
new AddValue, playerMoney;
GetProperty(ent, 1, property);
playerMoney = cs_get_user_money(id);
AddValue = str_to_num(property) + playerMoney;
cs_set_user_money(id, AddValue);
g_money_used[id] = false;
emit_sound(id, CHAN_STATIC, g_sound_money, 1.0, ATTN_NORM, 0, PITCH_NORM);
SCM_Print(id, "You have been given %s $!", property);
}
else{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "Next Use: Next Round");
}
if (is_user_alive(id) && get_user_team(id) == 2)
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "This block is for Terrorists Only !");
}
}
ActionAwp(id, ent)
{
if(user_has_weapon(id, CSW_AWP))
return PLUGIN_HANDLED;
if (is_user_alive(id) && !AwpUsed[id] && get_user_team(id) == 1)
{
static property[5];
GetProperty(ent, 1, property);
give_item(id, "weapon_awp");
cs_set_weapon_ammo(find_ent_by_owner(1, "weapon_awp", id), str_to_num(property));
AwpUsed[id] = true;
new name[42];
get_user_name(id, name, 32);
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(0, "%s has picked up an Awp!", name);
SCM_Print(0, "^1%s^3 has picked up an^4 Awp!", name);
}
else
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "Next Use: Next Round");
}
if (is_user_alive(id) && get_user_team(id) == 2)
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "This block is for Terrorists Only !");
}
return PLUGIN_HANDLED;
}
ActionDeagle(id, ent)
{
if(user_has_weapon(id, CSW_DEAGLE))
return PLUGIN_HANDLED;
if (is_user_alive(id) && !DeagleUsed[id] && get_user_team(id) == 1)
{
static property[5];
GetProperty(ent, 1, property);
give_item(id, "weapon_deagle");
cs_set_weapon_ammo(find_ent_by_owner(1, "weapon_deagle", id), str_to_num(property));
DeagleUsed[id] = true;
new name[42];
get_user_name(id, name, 32);
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(0, "%s has picked up an Deagle!", name);
SCM_Print(0, "^1%s^3 has picked up an^4 Deagle!", name);
}
else
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "Next Use: Next Round");
}
if (is_user_alive(id) && get_user_team(id) == 2)
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "This block is for Terrorists Only !");
}
return PLUGIN_HANDLED;
}
ActionHe(id, ent)
{
if (HeUsed[id])
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "Next Use: Next Round");
}
else if (user_has_weapon( id, CSW_HEGRENADE ))
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "Use Your HE Grenade before you take another one ..");
}
else if (get_user_team(id) == 1 && !HeUsed[id] && !user_has_weapon( id, CSW_HEGRENADE ))
{
static property[5];
GetProperty(ent, 1, property);
give_item(id, "weapon_hegrenade");
HeUsed[id] = true;
}
if (is_user_alive(id) && get_user_team(id) == 2)
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "This block is for Terrorists Only !");
}
return PLUGIN_HANDLED;
}
ActionFlash(id, ent)
{
if (FlashUsed[id])
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "Next Use: Next Round");
}
else if (user_has_weapon( id, CSW_FLASHBANG ))
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "Use Your Flashbang before you take another one ..");
}
if(cs_get_user_bpammo(id, CSW_FLASHBANG) < 2 && !FlashUsed[id] && get_user_team(id) == 1)
{
static property[5];
GetProperty(ent, 1, property);
give_item(id, "weapon_flashbang");
FlashUsed[id] = true;
}
if (is_user_alive(id) && get_user_team(id) == 2)
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "This block is for Terrorists Only !");
}
return PLUGIN_HANDLED;
}
ActionScout(id, ent)
{
if (is_user_alive(id) && !ScoutUsed[id] && get_user_team(id) == 1)
{
static property[5];
GetProperty(ent, 1, property);
give_item(id, "weapon_scout");
cs_set_weapon_ammo(find_ent_by_owner(1, "weapon_scout", id), str_to_num(property));
ScoutUsed[id] = true;
new name[42];
get_user_name(id, name, 32);
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(0, "%s has picked up a Scout!", name);
SCM_Print(0, "^1%s^3 has picked up a^4 Scout!", name);
}
else
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "Next Use: Next Round");
}
if (is_user_alive(id) && get_user_team(id) == 2)
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "This block is for Terrorists Only !");
}
return PLUGIN_HANDLED;
}
ActionGlock(id, ent)
{
if (is_user_alive(id) && !GlockUsed[id] && get_user_team(id) == 1)
{
static property[5];
GetProperty(ent, 1, property);
give_item(id, "weapon_glock18");
cs_set_weapon_ammo(find_ent_by_owner(3, "weapon_glock18", id), str_to_num(property));
GlockUsed[id] = true;
new name[42];
get_user_name(id, name, 32);
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(0, "%s has picked up a Glock!", name);
SCM_Print(0, "^1%s^3 has picked up a^4 Glock!", name);
}
else
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "Next Use: Next Round");
}
if (is_user_alive(id) && get_user_team(id) == 2)
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "This block is for Terrorists Only !");
}
return PLUGIN_HANDLED;
}
ActionUSP(id, ent)
{
if (is_user_alive(id) && !USPUsed[id] && get_user_team(id) == 1)
{
static property[5];
GetProperty(ent, 1, property);
give_item(id, "weapon_usp");
cs_set_weapon_ammo(find_ent_by_owner(3, "weapon_usp", id), str_to_num(property));
USPUsed[id] = true;
new name[42];
get_user_name(id, name, 32);
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(0, "%s has picked up an USP!", name);
SCM_Print(0, "^1%s^3 has picked up an^4 USP!", name);
}
else
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "Next Use: Next Round");
}
if (is_user_alive(id) && get_user_team(id) == 2)
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "This block is for Terrorists Only !");
}
return PLUGIN_HANDLED;
}
ActionM4A1(id, ent)
{
if (is_user_alive(id) && !M4A1Used[id] && get_user_team(id) == 1)
{
static property[5];
GetProperty(ent, 1, property);
give_item(id, "weapon_m4a1");
cs_set_weapon_ammo(find_ent_by_owner(1, "weapon_m4a1", id), str_to_num(property));
M4A1Used[id] = true;
new name[42];
get_user_name(id, name, 32);
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(0, "%s has picked up a M4A1!", name);
SCM_Print(0, "^1%s^3 has picked up a^4 M4A1!", name);
}
else
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "Next Use: Next Round");
}
if (is_user_alive(id) && get_user_team(id) == 2)
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "This block is for Terrorists Only !");
}
return PLUGIN_HANDLED;
}
ActionM3(id, ent)
{
if (is_user_alive(id) && !M3Used[id] && get_user_team(id) == 1)
{
static property[5];
GetProperty(ent, 1, property);
give_item(id, "weapon_m3");
cs_set_weapon_ammo(find_ent_by_owner(1, "weapon_m3", id), str_to_num(property));
M3Used[id] = true;
new name[42];
get_user_name(id, name, 32);
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(0, "%s has picked up a M3!", name);
SCM_Print(0, "^1%s^3 has picked up a^4 M3!", name);
}
else
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "Next Use: Next Round");
}
if (is_user_alive(id) && get_user_team(id) == 2)
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "This block is for Terrorists Only !");
}
return PLUGIN_HANDLED;
}
ActionBlind(id)
{
message_begin(MSG_ONE, gmsgScreenFade, {0,0,0}, id);
write_short(4096*1); // Duration
write_short(4096*1); // Hold time
write_short(4096); // Fade type
write_byte(0); // Red
write_byte(0); // Green
write_byte(0); // Blue
write_byte(255); // Alpha
message_end();
}
ActionP90(id, ent)
{
if (is_user_alive(id) && !P90Used[id] && get_user_team(id) == 1)
{
static property[5];
GetProperty(ent, 1, property);
give_item(id, "weapon_p90");
cs_set_weapon_ammo(find_ent_by_owner(3, "weapon_p90", id), str_to_num(property));
P90Used[id] = true;
new name[42];
get_user_name(id, name, 32);
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(0, "%s has picked up a P90!", name);
SCM_Print(0, "^1%s^3 has picked up a^4 P90!", name);
}
else
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "Next Use: Next Round");
}
if (is_user_alive(id) && get_user_team(id) == 2)
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "This block is for Terrorists Only !");
}
return PLUGIN_HANDLED;
}
ActionGalil(id, ent)
{
if (is_user_alive(id) && !GalilUsed[id] && get_user_team(id) == 1)
{
static property[5];
GetProperty(ent, 1, property);
give_item(id, "weapon_galil");
cs_set_weapon_ammo(find_ent_by_owner(3, "weapon_galil", id), str_to_num(property));
GalilUsed[id] = true;
new name[42];
get_user_name(id, name, 32);
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(0, "%s has picked up a Galil!", name);
SCM_Print(0, "^1%s^3 has picked up a^4 Galil!", name);
}
else
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "Next Use: Next Round");
}
if (is_user_alive(id) && get_user_team(id) == 2)
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "This block is for Terrorists Only !");
}
return PLUGIN_HANDLED;
}
ActionFamas(id, ent)
{
if (is_user_alive(id) && !FamasUsed[id] && get_user_team(id) == 1)
{
static property[5];
GetProperty(ent, 1, property);
give_item(id, "weapon_famas");
cs_set_weapon_ammo(find_ent_by_owner(3, "weapon_famas", id), str_to_num(property));
FamasUsed[id] = true;
new name[42];
get_user_name(id, name, 32);
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(0, "%s has picked up a Famas!", name);
SCM_Print(0, "^1%s^3 has picked up a^4 Famas!", name);
}
else
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "Next Use: Next Round");
}
if (is_user_alive(id) && get_user_team(id) == 2)
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "This block is for Terrorists Only !");
}
return PLUGIN_HANDLED;
}
ActionAK47(id, ent)
{
if (is_user_alive(id) && !AK47Used[id] && get_user_team(id) == 1)
{
static property[5];
GetProperty(ent, 1, property);
give_item(id, "weapon_ak47");
cs_set_weapon_ammo(find_ent_by_owner(3, "weapon_ak47", id), str_to_num(property));
AK47Used[id] = true;
new name[42];
get_user_name(id, name, 32);
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(0, "%s has picked up a AK47!", name);
SCM_Print(0, "^1%s^3 has picked up a^4 AK47!", name);
}
else
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "Next Use: Next Round");
}
if (is_user_alive(id) && get_user_team(id) == 2)
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "This block is for Terrorists Only !");
}
return PLUGIN_HANDLED;
}
ActionAUG(id, ent)
{
if (is_user_alive(id) && !AUGUsed[id] && get_user_team(id) == 1)
{
static property[5];
GetProperty(ent, 1, property);
give_item(id, "weapon_aug");
cs_set_weapon_ammo(find_ent_by_owner(3, "weapon_aug", id), str_to_num(property));
AUGUsed[id] = true;
new name[42];
get_user_name(id, name, 32);
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(0, "%s has picked up a AUG!", name);
SCM_Print(0, "^1%s^3 has picked up a^4 AUG!", name);
}
else
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "Next Use: Next Round");
}
if (is_user_alive(id) && get_user_team(id) == 2)
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "This block is for Terrorists Only !");
}
return PLUGIN_HANDLED;
}
ActionSG552(id, ent)
{
if (is_user_alive(id) && !SG552Used[id] && get_user_team(id) == 1)
{
static property[5];
GetProperty(ent, 1, property);
give_item(id, "weapon_sg552");
cs_set_weapon_ammo(find_ent_by_owner(3, "weapon_sg552", id), str_to_num(property));
SG552Used[id] = true;
new name[42];
get_user_name(id, name, 32);
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(0, "%s has picked up a SG552!", name);
SCM_Print(0, "^1%s^3 has picked up a^4 SG552!", name);
}
else
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "Next Use: Next Round");
}
if (is_user_alive(id) && get_user_team(id) == 2)
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "This block is for Terrorists Only !");
}
return PLUGIN_HANDLED;
}
ActionSG550(id, ent)
{
if (is_user_alive(id) && !SG550Used[id] && get_user_team(id) == 1)
{
static property[5];
GetProperty(ent, 1, property);
give_item(id, "weapon_sg550");
cs_set_weapon_ammo(find_ent_by_owner(2, "weapon_sg550", id), str_to_num(property));
SG550Used[id] = true;
new name[42];
get_user_name(id, name, 32);
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(0, "%s has picked up a SG550!", name);
SCM_Print(0, "^1%s^3 has picked up a^4 SG550!", name);
}
else
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "Next Use: Next Round");
}
if (is_user_alive(id) && get_user_team(id) == 2)
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "This block is for Terrorists Only !");
}
return PLUGIN_HANDLED;
}
ActionVestHelm(id, ent)
{
if (is_user_alive(id) && !VestHelmUsed[id] && get_user_team(id) == 1)
{
static property[5];
GetProperty(ent, 1, property);
give_item(id, "item_vesthelm");
VestHelmUsed[id] = true;
new name[42];
get_user_name(id, name, 32);
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(0, "%s has picked up a Vest+Helm!", name);
SCM_Print(0, "^1%s^3 has picked up a^4 Vest+Helm!", name);
}
else
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "Next Use: Next Round");
}
if (is_user_alive(id) && get_user_team(id) == 2)
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "This block is for Terrorists Only !");
}
return PLUGIN_HANDLED;
}
ActionSmoke(id, ent)
{
if (SmokeUsed[id])
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "Next Use: Next Round");
}
else if (user_has_weapon( id, CSW_SMOKEGRENADE ))
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "Use Your Frostnade before you take another one ..");
}
else if (get_user_team(id) == 1 && !SmokeUsed[id] && !user_has_weapon( id, CSW_SMOKEGRENADE ))
{
static property[5];
GetProperty(ent, 1, property);
give_item(id, "weapon_smokegrenade");
SmokeUsed[id] = true;
}
if (is_user_alive(id) && get_user_team(id) == 2)
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "This block is for Terrorists Only !");
}
return PLUGIN_HANDLED;
}
ActionXp(id, ent)
{
new Float:gametime = get_gametime();
if ( !( gametime >= g_next_xp_time[id] ) )
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "Xp Block^nNext Use: %.1f", g_next_xp_time[id] - gametime);
return PLUGIN_HANDLED;
}
static property[5];
GetProperty(ent, 1, property);
if (cs_get_user_team(id) == CS_TEAM_CT)
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "This Block is for Terrorists Only");
}
if (cs_get_user_team(id) == CS_TEAM_T && !XpUsed[id])
{
new xp = str_to_num(property);
hnsxp_add_user_xp( id, xp );
SCM_Print(id, "^3 Youve Gaind^4 %s^3 Xp", property);
}
GetProperty(ent, 2, property);
g_next_xp_time[id] = gametime + str_to_float(property);
return PLUGIN_HANDLED;
}
ActionCam(id, ent)
{
new Float:gametime = get_gametime();
if ( !( gametime >= g_cam_next_use[id] ) )
{
if ( !g_has_hud_text[id] )
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "^nCamouflage^nNext Use %.1f", g_cam_next_use[id] - gametime);
}
return PLUGIN_HANDLED;
}
static property[5];
new team;
team = get_user_team(id);
if (team == 1)
{
cs_set_user_model(id, "gsg9");
}
else
{
cs_set_user_model(id, "leet");
}
emit_sound(id, CHAN_STATIC, g_sound_cam, 1.0, ATTN_NORM, 0, PITCH_NORM);
g_block_status[id] = true;
static Float:time_out;
GetProperty(ent, 1, property);
time_out = str_to_float(property);
set_task(time_out, "TaskRemoveCam", TASK_CAM + id, g_blank, 0, g_a, 1);
GetProperty(ent, 2, property);
g_cam_time_out[id] = gametime + time_out;
g_cam_next_use[id] = gametime + time_out + str_to_float(property);
return PLUGIN_HANDLED;
}
ActionSuper(id, ent)
{
new Float:gametime = get_gametime();
if ( !( gametime >= g_super_next_use[id] ) )
{
if ( !g_has_hud_text[id] )
{
set_hudmessage(gHudRed, gHudGreen, gHudBlue, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
show_hudmessage(id, "^nSuper Man^nNext Use %.1f", g_super_next_use[id] - gametime);
}
return PLUGIN_HANDLED;
}
static property[5];
GetProperty(ent, 3, property);
entity_set_float(id, EV_FL_gravity, str_to_float(property) / 800);
g_boots_of_speed[id] = ent;
static Float:time_out;
GetProperty(ent, 1, property);
time_out = str_to_float(property);
set_task(time_out, "TaskRemoveSuper", TASK_SUPER + id, g_blank, 0, g_a, 1);
GetProperty(ent, 2, property);
g_super_time_out[id] = gametime + time_out;
g_super_next_use[id] = gametime + time_out + str_to_float(property);
return PLUGIN_HANDLED;
}
ActionMagic(id, ent)
{
new szProperty[5], Float:vVelocity[3];
GetProperty(ent, 1, szProperty);
pev(id, pev_velocity, vVelocity);
vVelocity[2] = 0.0;
set_pev(ent, pev_velocity, vVelocity);
static Float:time_out2;
static property[20];
GetProperty(ent, 1, property);
time_out2 = str_to_float(property);
set_task(time_out2, "remove_magic");
return PLUGIN_HANDLED;
}
ActionTeleport(id, ent)
{
//get end entity id
new tele = entity_get_int(ent, EV_INT_iuser1);
//if teleport end id is valid
if (tele)
{
//get end entity origin
new Float:vTele[3];
entity_get_vector(tele, EV_VEC_origin, vTele);
//if id of entity being teleported is a player and telefrags CVAR is set then kill any nearby players
if ((id > 0 && id <= 32) && get_cvar_num("bm_telefrags") > 0)
{
new player = -1;
do
{
player = find_ent_in_sphere(player, vTele, 16.0);
//if entity found is a player
if (player > 0 && player <= 32)
{
//if player is alive, and is not the player that went through the teleport
if (is_user_alive(player) && player != id)
{
//kill the player
user_kill(player, 1);
}
}
}while(player);
}
//get origin of the start of the teleport
new Float:vOrigin[3];
new origin[3];
entity_get_vector(ent, EV_VEC_origin, vOrigin);
FVecIVec(vOrigin, origin);
//show some teleporting effects
message_begin(MSG_PVS, SVC_TEMPENTITY, origin);
write_byte(TE_IMPLOSION);
write_coord(origin[0]);
write_coord(origin[1]);
write_coord(origin[2]);
write_byte(64); // radius
write_byte(100); // count
write_byte(6); // life
message_end();
//teleport player
entity_set_vector(id, EV_VEC_origin, vTele);
//reverse players Z velocity
new Float:vVelocity[3];
entity_get_vector(id, EV_VEC_velocity, vVelocity);
vVelocity[2] = floatabs(vVelocity[2]);
entity_set_vector(id, EV_VEC_velocity, vVelocity);
emit_sound(id, CHAN_STATIC, g_sound_teleport, 1.0, ATTN_NORM, 0, PITCH_NORM);
}
}
public TaskSolidNot(ent)
{
ent -= TASK_SOLIDNOT;
if ( !is_valid_ent(ent)
|| entity_get_int(ent, EV_INT_iuser2) ) return PLUGIN_HANDLED;
entity_set_int(ent, EV_INT_solid, SOLID_NOT);
set_rendering(ent, kRenderFxNone, 255, 255, 255, kRenderTransAdd, 25);
set_task(1.0, "TaskSolid", TASK_SOLID + ent);
return PLUGIN_HANDLED;
}
public TaskSolid(ent)
{
ent -= TASK_SOLID;
if ( !IsBlock(ent) ) return PLUGIN_HANDLED;
entity_set_int(ent, EV_INT_solid, SOLID_BBOX);
if ( entity_get_int(ent, EV_INT_iuser1) > 0 )
{
GroupBlock(0, ent);
}
else
{
static property3[5];
GetProperty(ent, 3, property3);
new transparency = str_to_num(property3);
if ( !transparency
|| transparency == 255 )
{
new block_type = entity_get_int(ent, EV_INT_body);
SetBlockRendering(ent, g_render[block_type], g_red[block_type], g_green[block_type], g_blue[block_type], g_alpha[block_type]);
}
else
{
SetBlockRendering(ent, TRANSALPHA, 255, 255, 255, transparency);
}
}
return PLUGIN_HANDLED;
}
public TaskNotOnIce(id)
{
id -= TASK_ICE;
g_ice[id] = false;
if ( !g_alive[id] ) return PLUGIN_HANDLED;
if ( g_boots_of_speed[id] )
{
static block, property3[5];
block = g_boots_of_speed[id];
GetProperty(block, 3, property3);
entity_set_float(id, EV_FL_maxspeed, str_to_float(property3));
}
else
{
ResetMaxspeed(id);
}
entity_set_float(id, EV_FL_friction, 1.0);
return PLUGIN_HANDLED;
}
public TaskNotInHoney(id)
{
id -= TASK_HONEY;
g_honey[id] = 0;
if ( !g_alive[id] ) return PLUGIN_HANDLED;
if ( g_boots_of_speed[id] )
{
static block, property3[5];
block = g_boots_of_speed[id];
GetProperty(block, 3, property3);
entity_set_float(id, EV_FL_maxspeed, str_to_float(property3));
}
else
{
ResetMaxspeed(id);
}
return PLUGIN_HANDLED;
}
public TaskRemoveCam(id)
{
id -= TASK_CAM;
if ( g_connected[id] )
{
cs_reset_user_model(id);
}
}
public TaskRemoveInvincibility(id)
{
id -= TASK_INVINCIBLE;
if ( !g_alive[id] ) return PLUGIN_HANDLED;
if ( ( g_admin[id] || g_gived_access[id] ) && !g_godmode[id]
|| ( !g_admin[id] && !g_gived_access[id] ) && !g_all_godmode )
{
set_user_godmode(id, 0);
}
if ( get_gametime() >= g_stealth_time_out[id] )
{
set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 16);
}
return PLUGIN_HANDLED;
}
public TaskRemoveStealth(id)
{
id -= TASK_STEALTH;
if ( g_connected[id] )
{
if ( get_gametime() <= g_stealth_time_out[id] )
{
set_user_rendering(id, kRenderFxGlowShell, 255, 255, 255, kRenderTransColor, 16);
}
else
{
set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 255);
}
}
g_block_status[id] = false;
}
public TaskRemoveBootsOfSpeed(id)
{
id -= TASK_BOOTSOFSPEED;
g_boots_of_speed[id] = 0;
if ( !g_alive[id] ) return PLUGIN_HANDLED;
if ( g_ice[id] )
{
entity_set_float(id, EV_FL_maxspeed, 400.0);
}
else if ( g_honey[id] )
{
static block, property1[5];
block = g_honey[id];
GetProperty(block, 1, property1);
entity_set_float(id, EV_FL_maxspeed, str_to_float(property1));
}
else
{
ResetMaxspeed(id);
}
return PLUGIN_HANDLED;
}
public TaskRemoveSuper(id)
{
id -= TASK_SUPER;
if ( g_connected[id] )
{
if ( get_gametime() <= g_super_time_out[id] )
{
entity_set_float(id, EV_FL_gravity, 800.0 / 800.0);
}
else
{
static property[5];
new ent;
GetProperty(ent, 3, property);
entity_set_float(id, EV_FL_gravity, str_to_float(property) / 800);
}
}
}
public TaskSpriteNextFrame(params[])
{
new ent = params[0];
if ( !is_valid_ent(ent) )
{
remove_task(TASK_SPRITE + ent);
return PLUGIN_HANDLED;
}
new frames = params[1];
new Float:current_frame = entity_get_float(ent, EV_FL_frame);
if ( current_frame < 0.0
|| current_frame >= frames )
{
entity_set_float(ent, EV_FL_frame, 1.0);
}
else
{
entity_set_float(ent, EV_FL_frame, current_frame + 1.0);
}
return PLUGIN_HANDLED;
}
public remove_magic( id )
{
new iEnt, Float:fOrigin[3];
while( (iEnt = find_ent_by_class(iEnt, g_block_classname)) )
{
new blockType = pev(iEnt, pev_body);
if( blockType == MAGIC )
{
pev(iEnt, pev_v_angle, fOrigin);
set_pev(iEnt, pev_velocity, Float:{0.0, 0.0, 0.0});
engfunc(EngFunc_SetOrigin, iEnt, fOrigin);
}
}
}
public MsgStatusValue()
{
if ( get_msg_arg_int(1) == 2
&& g_block_status[get_msg_arg_int(2)] )
{
set_msg_arg_int(1, get_msg_argtype(1), 1);
set_msg_arg_int(2, get_msg_argtype(2), 0);
}
}
public CmdAttack(id)
{
if ( !IsBlock(g_grabbed[id]) ) return PLUGIN_HANDLED;
if ( IsBlockInGroup(id, g_grabbed[id]) && g_group_count[id] > 1 )
{
static block;
for ( new i = 0; i <= g_group_count[id]; ++i )
{
block = g_grouped_blocks[id][i];
if ( !IsBlockInGroup(id, block) ) continue;
if ( !IsBlockStuck(block) )
{
CopyBlock(id, block);
}
}
}
else
{
if ( IsBlockStuck(g_grabbed[id]) )
{
SCM_Print(id, "You cannot copy a block that is in a stuck position!");
return PLUGIN_HANDLED;
}
new new_block = CopyBlock(id, g_grabbed[id]);
if ( !new_block ) return PLUGIN_HANDLED;
entity_set_int(g_grabbed[id], EV_INT_iuser2, 0);
entity_set_int(new_block, EV_INT_iuser2, id);
g_grabbed[id] = new_block;
}
return PLUGIN_HANDLED;
}
public CmdAttack2(id)
{
if ( !IsBlock(g_grabbed[id]) )
{
DeleteTeleport(id, g_grabbed[id]);
return PLUGIN_HANDLED;
}
if ( !IsBlockInGroup(id, g_grabbed[id])
|| g_group_count[id] < 2 )
{
DeleteBlock(g_grabbed[id]);
return PLUGIN_HANDLED;
}
static block;
for ( new i = 0; i <= g_group_count[id]; ++i )
{
block = g_grouped_blocks[id][i];
if ( !is_valid_ent(block)
|| !IsBlockInGroup(id, block) ) continue;
DeleteBlock(block);
}
return PLUGIN_HANDLED;
}
public CmdRotate(id)
{
if ( !IsBlock(g_grabbed[id]) ) return PLUGIN_HANDLED;
if ( !IsBlockInGroup(id, g_grabbed[id])
|| g_group_count[id] < 2 )
{
RotateBlock(g_grabbed[id]);
return PLUGIN_HANDLED;
}
static block;
for ( new i = 0; i <= g_group_count[id]; ++i )
{
block = g_grouped_blocks[id][i];
if ( !is_valid_ent(block)
|| !IsBlockInGroup(id, block) ) continue;
RotateBlock(block);
}
return PLUGIN_HANDLED;
}
public CmdGrab(id)
{
if ( !g_admin[id] && !g_gived_access[id] )
{
console_print(id, "You have no access to that command");
return PLUGIN_HANDLED;
}
static ent, body;
g_grab_length[id] = get_user_aiming(id, ent, body);
new bool:is_block = IsBlock(ent);
if ( !is_block && !IsTeleport(ent) && !IsLight(ent) ) return PLUGIN_HANDLED;
new grabber = entity_get_int(ent, EV_INT_iuser2);
if ( grabber && grabber != id ) return PLUGIN_HANDLED;
if ( !is_block )
{
SetGrabbed(id, ent);
return PLUGIN_HANDLED;
}
new player = entity_get_int(ent, EV_INT_iuser1);
if ( player && player != id )
{
new player_name[32];
get_user_name(player, player_name, charsmax(player_name));
SCM_Print(id, "^1%s3 currently has this block in their group!", player_name);
return PLUGIN_HANDLED;
}
SetGrabbed(id, ent);
if ( g_group_count[id] < 2 ) return PLUGIN_HANDLED;
static Float:grabbed_origin[3];
entity_get_vector(ent, EV_VEC_origin, grabbed_origin);
static block, Float:origin[3], Float:offset[3];
for ( new i = 0; i <= g_group_count[id]; ++i )
{
block = g_grouped_blocks[id][i];
if ( !is_valid_ent(block) ) continue;
entity_get_vector(block, EV_VEC_origin, origin);
offset[0] = grabbed_origin[0] - origin[0];
offset[1] = grabbed_origin[1] - origin[1];
offset[2] = grabbed_origin[2] - origin[2];
entity_set_vector(block, EV_VEC_vuser1, offset);
entity_set_int(block, EV_INT_iuser2, id);
}
return PLUGIN_HANDLED;
}
SetGrabbed(id, ent)
{
entity_get_string(id, EV_SZ_viewmodel, g_viewmodel[id], charsmax(g_viewmodel));
entity_set_string(id, EV_SZ_viewmodel, g_blank);
static aiming[3], Float:origin[3];
get_user_origin(id, aiming, 3);
entity_get_vector(ent, EV_VEC_origin, origin);
g_grabbed[id] = ent;
g_grab_offset[id][0] = origin[0] - aiming[0];
g_grab_offset[id][1] = origin[1] - aiming[1];
g_grab_offset[id][2] = origin[2] - aiming[2];
entity_set_int(ent, EV_INT_iuser2, id);
}
public CmdRelease(id)
{
if ( !g_admin[id] && !g_gived_access[id] )
{
console_print(id, "You have no access to that command");
return PLUGIN_HANDLED;
}
else if ( !g_grabbed[id] )
{
return PLUGIN_HANDLED;
}
if ( IsBlock(g_grabbed[id]) )
{
if ( IsBlockInGroup(id, g_grabbed[id]) && g_group_count[id] > 1 )
{
static i, block;
new bool:group_is_stuck = true;
for ( i = 0; i <= g_group_count[id]; ++i )
{
block = g_grouped_blocks[id][i];
if ( IsBlockInGroup(id, block) )
{
entity_set_int(block, EV_INT_iuser2, 0);
if ( group_is_stuck && !IsBlockStuck(block) )
{
group_is_stuck = false;
break;
}
}
}
if ( group_is_stuck )
{
for ( i = 0; i <= g_group_count[id]; ++i )
{
block = g_grouped_blocks[id][i];
if ( IsBlockInGroup(id, block) ) DeleteBlock(block);
}
SCM_Print(id, "Group deleted because all the blocks were stuck!");
}
}
else
{
if ( is_valid_ent(g_grabbed[id]) )
{
if ( IsBlockStuck(g_grabbed[id]) )
{
new bool:deleted = DeleteBlock(g_grabbed[id]);
if ( deleted ) SCM_Print(id, "Block deleted because it was stuck!");
}
else
{
entity_set_int(g_grabbed[id], EV_INT_iuser2, 0);
}
}
}
}
else if ( IsTeleport(g_grabbed[id]) )
{
entity_set_int(g_grabbed[id], EV_INT_iuser2, 0);
}
entity_get_string(id, EV_SZ_viewmodel, g_viewmodel[id], charsmax(g_viewmodel));
entity_set_string(id, EV_SZ_viewmodel, g_blank);
g_grabbed[id] = 0;
return PLUGIN_HANDLED;
}
public CmdMainMenu(id)
{
ShowMainMenu(id);
return PLUGIN_HANDLED;
}
ShowMainMenu(id)
{
new menu[256], col1[3], col2[3];
col1 = g_admin[id] || g_gived_access[id] ? "\r" : "\d";
col2 = g_admin[id] || g_gived_access[id] ? "\w" : "\d";
format(menu, charsmax(menu),\
g_main_menu,\
PLUGIN_PREFIX,\
PLUGIN_NAME,\
PLUGIN_VERSION,\
col1,\
col2,\
g_noclip[id] ? "\yOn" : "\rOff",\
col1,\
col2,\
g_godmode[id] ? "\yOn" : "\rOff"
);
show_menu(id, g_keys_main_menu, menu, -1, "SCMMainMenu");
}
ShowBlockMenu(id)
{
new menu[256], col1[3], col2[3], size[8];
col1 = g_admin[id] || g_gived_access[id] ? "\r" : "\d";
col2 = g_admin[id] || g_gived_access[id] ? "\w" : "\d";
switch ( g_selected_block_size[id] )
{
case TINY: size = "Small";
case NORMAL: size = "Normal";
case LARGE: size = "Large";
case POLE: size = "Pole";
}
format(menu, charsmax(menu),\
g_block_menu,\
PLUGIN_PREFIX,\
g_block_names[g_selected_block_type[id]],\
col1,\
col2,\
col1,\
col2,\
col1,\
col2,\
col1,\
col2,\
g_noclip[id] ? "\yOn" : "\rOff",\
col1,\
col2,\
size,\
col1,\
col2
);
show_menu(id, g_keys_block_menu, menu, -1, "SCMBlockMenu");
}
ShowBlockSelectionMenu(id)
{
new menu[256], title[32], entry[32], num;
format(title, charsmax(title), "\r[Ex BM] \yBlock Selection %d^n^n", g_block_selection_page[id]);
add(menu, charsmax(menu), title);
new start_block = ( g_block_selection_page[id] - 1 ) * 8;
for ( new i = start_block; i < start_block + 8; ++i )
{
if ( i < TOTAL_BLOCKS )
{
num = ( i - start_block ) + 1;
format(entry, charsmax(entry), "\r%d. \w%s^n", num, g_block_names[i]);
}
else
{
format(entry, charsmax(entry), "^n");
}
add(menu, charsmax(menu), entry);
}
if ( g_block_selection_page[id] < g_block_selection_pages_max )
{
add(menu, charsmax(menu), "^n\r9. \wMore");
}
else
{
add(menu, charsmax(menu), "^n");
}
add(menu, charsmax(menu), "^n\r0. \wBack");
show_menu(id, g_keys_block_selection_menu, menu, -1, "SCMBlockSelectionMenu");
}
ShowPropertiesMenu(id, ent)
{
new menu[256], title[32], entry[64], property[5], line1[3], line2[3], line3[3], line4[3], num, block_type;
block_type = entity_get_int(ent, EV_INT_body);
format(title, charsmax(title), "\r[%s] \ySet Properties^n^n", PLUGIN_PREFIX);
add(menu, charsmax(menu), title);
if ( g_property1_name[block_type][0] )
{
GetProperty(ent, 1, property);
if ( block_type == BUNNYHOP )
{
format(entry, charsmax(entry), "\r1. \w%s: %s^n", g_property1_name[block_type], property[0] == '1' ? "\yOn" : "\rOff");
}
else if ( block_type == SLAP )
{
format(entry, charsmax(entry), "\r1. \w%s: \y%s^n", g_property1_name[block_type], property[0] == '3' ? "High" : property[0] == '2' ? "Medium" : "Low");
}
else
{
format(entry, charsmax(entry), "\r1. \w%s: \y%s^n", g_property1_name[block_type], property);
}
add(menu, charsmax(menu), entry);
}
else
{
format(line1, charsmax(line1), "^n");
}
if ( g_property2_name[block_type][0] )
{
if ( g_property1_name[block_type][0] )
{
num = 2;
}
else
{
num = 1;
}
GetProperty(ent, 2, property);
format(entry, charsmax(entry), "\r%d. \w%s: \y%s^n", num, g_property2_name[block_type], property);
add(menu, charsmax(menu), entry);
}
else
{
format(line2, charsmax(line2), "^n");
}
if ( g_property3_name[block_type][0] )
{
if ( g_property1_name[block_type][0] && g_property2_name[block_type][0] )
{
num = 3;
}
else if ( g_property1_name[block_type][0]
|| g_property2_name[block_type][0] )
{
num = 2;
}
else
{
num = 1;
}
GetProperty(ent, 3, property);
if ( block_type == BOOTS_OF_SPEED
|| property[0] != '0' && !( property[0] == '2' && property[1] == '5' && property[2] == '5' ) )
{
format(entry, charsmax(entry), "\r%d. \w%s: \y%s^n", num, g_property3_name[block_type], property);
}
else
{
format(entry, charsmax(entry), "\r%d. \w%s: \rOff^n", num, g_property3_name[block_type]);
}
add(menu, charsmax(menu), entry);
}
else
{
format(line3, charsmax(line3), "^n");
}
if ( g_property4_name[block_type][0] )
{
if ( g_property1_name[block_type][0] && g_property2_name[block_type][0] && g_property3_name[block_type][0] )
{
num = 4;
}
else if ( g_property1_name[block_type][0] && g_property2_name[block_type][0]
|| g_property1_name[block_type][0] && g_property3_name[block_type][0]
|| g_property2_name[block_type][0] && g_property3_name[block_type][0] )
{
num = 3;
}
else if ( g_property1_name[block_type][0]
|| g_property2_name[block_type][0]
|| g_property3_name[block_type][0] )
{
num = 2;
}
else
{
num = 1;
}
GetProperty(ent, 4, property);
format(entry, charsmax(entry), "\r%d. \w%s: %s^n", num, g_property4_name[block_type], property[0] == '1' ? "\yYes" : "\rNo");
add(menu, charsmax(menu), entry);
}
else
{
format(line4, charsmax(line4), "^n");
}
g_property_info[id][1] = ent;
add(menu, charsmax(menu), line1);
add(menu, charsmax(menu), line2);
add(menu, charsmax(menu), line3);
add(menu, charsmax(menu), line4);
add(menu, charsmax(menu), "^n^n^n^n^n^n\r0. \wBack");
show_menu(id, g_keys_properties_menu, menu, -1, "SCMPropertiesMenu");
}
ShowMoveMenu(id)
{
if ( !g_admin[id] && !g_gived_access[id] )
{
ShowBlockMenu(id);
return PLUGIN_HANDLED;
}
new menu[256];
format(menu, charsmax(menu), g_move_menu, PLUGIN_PREFIX, g_grid_size[id]);
show_menu(id, g_keys_move_menu, menu, -1, "SCMMoveMenu");
return PLUGIN_HANDLED;
}
ShowTeleportMenu(id)
{
new menu[256], col1[3], col2[3];
col1 = g_admin[id] || g_gived_access[id] ? "\r" : "\d";
col2 = g_admin[id] || g_gived_access[id] ? "\w" : "\d";
format(menu, charsmax(menu),\
g_teleport_menu,\
PLUGIN_PREFIX,\
col1,\
col2,\
g_teleport_start[id] ? "\r" : "\d",\
g_teleport_start[id] ? "\w" : "\d",\
col1,\
col2,\
col1,\
col2,\
col1,\
col2
);
show_menu(id, g_keys_teleport_menu, menu, -1, "SCMTeleportMenu");
}
ShowLightMenu(id)
{
new menu[256], col1[3], col2[3];
col1 = g_admin[id] || g_gived_access[id] ? "\r" : "\d";
col2 = g_admin[id] || g_gived_access[id] ? "\w" : "\d";
format(menu, charsmax(menu),\
g_light_menu,\
PLUGIN_PREFIX,\
col1,\
col2,\
col1,\
col2,\
col1,\
col2
);
show_menu(id, g_keys_light_menu, menu, -1, "SCMLightMenu");
}
ShowLightPropertiesMenu(id, ent)
{
new menu[256], radius[5], color_red[5], color_green[5], color_blue[5];
GetProperty(ent, 1, radius);
GetProperty(ent, 2, color_red);
GetProperty(ent, 3, color_green);
GetProperty(ent, 4, color_blue);
format(menu, charsmax(menu),\
g_light_properties_menu,\
PLUGIN_PREFIX,\
radius,\
color_red,\
color_green,\
color_blue
);
g_light_property_info[id][1] = ent;
show_menu(id, g_keys_light_properties_menu, menu, -1, "SCMLightPropertiesMenu");
}
ShowOptionsMenu(id)
{
new menu[256], col1[3], col2[3], col3[3], col4[3];
col1 = g_admin[id] || g_gived_access[id] ? "\r" : "\d";
col2 = g_admin[id] || g_gived_access[id] ? "\w" : "\d";
col3 = g_admin[id] ? "\r" : "\d";
col4 = g_admin[id] ? "\w" : "\d";
format(menu, charsmax(menu),\
g_options_menu,\
PLUGIN_PREFIX,\
col1,\
col2,\
g_snapping[id] ? "\yOn" : "\rOff",\
col1,\
col2,\
g_snapping_gap[id],\
col1,\
col2,\
col1,\
col2,\
col3,\
col4,\
col3,\
col4,\
col3,\
col4
);
show_menu(id, g_keys_options_menu, menu, -1, "SCMOptionsMenu");
}
ShowChoiceMenu(id, choice, const title[96])
{
new menu[128];
g_choice_option[id] = choice;
format(menu, charsmax(menu), g_choice_menu, title);
show_menu(id, g_keys_choice_menu, menu, -1, "SCMChoiceMenu");
}
ShowCommandsMenu(id)
{
new menu[256], col1[3], col2[3], col3[3], col4[3];
col1 = g_admin[id] ? "\r" : "\d";
col2 = g_admin[id] ? "\w" : "\d";
col3 = ( g_admin[id] || g_gived_access[id] ) && g_alive[id] ? "\r" : "\d";
col4 = ( g_admin[id] || g_gived_access[id] ) && g_alive[id] ? "\w" : "\d";
format(menu, charsmax(menu),\
g_commands_menu,\
PLUGIN_PREFIX,\
col3,\
col4,\
g_alive[id] && g_has_checkpoint[id] ? "\r" : "\d",\
g_alive[id] && g_has_checkpoint[id] ? "\w" : "\d",\
( g_admin[id] || g_gived_access[id] ) && !g_alive[id] ? "\r" : "\d",\
( g_admin[id] || g_gived_access[id] ) && !g_alive[id] ? "\w" : "\d",\
col1,\
col2,\
col1,\
col2,\
col1,\
col2,\
g_all_godmode ? "Remove" : "Set",\
g_all_godmode ? "from" : "on",\
col1,\
col2,\
PLUGIN_PREFIX
);
show_menu(id, g_keys_commands_menu, menu, -1, "SCMCommandsMenu");
}
public HandleMainMenu(id, key)
{
switch ( key )
{
case K1: ShowBlockMenu(id);
case K2: ShowTeleportMenu(id);
case K3: ShowLightMenu(id);
case K4:
{
g_viewing_commands_menu[id] = true;
ShowCommandsMenu(id);
}
case K5: ShowMoveMenu(id);
case K6: ToggleNoclip(id);
case K7: ToggleGodmode(id);
case K9: CmdShowInfo(id);
case K0: return;
}
if ( key == K6 || key == K7 || key == K9 ) ShowMainMenu(id);
}
public HandleBlockMenu(id, key)
{
switch ( key )
{
case K1:
{
g_block_selection_page[id] = 1;
ShowBlockSelectionMenu(id);
}
case K2: CreateBlockAiming(id, g_selected_block_type[id]);
case K3: ConvertBlockAiming(id, g_selected_block_type[id]);
case K4: DeleteBlockAiming(id);
case K5: RotateBlockAiming(id);
case K6: ToggleNoclip(id);
case K7: SetPropertiesBlockAiming(id);
case K8: ChangeBlockSize(id);
case K9: ShowOptionsMenu(id);
case K0: ShowMainMenu(id);
}
if ( key != K1 && key != K6 && key != K7 && key != K9 && key != K0 ) ShowBlockMenu(id);
}
public HandleBlockSelectionMenu(id, key)
{
switch ( key )
{
case K9:
{
++g_block_selection_page[id];
if ( g_block_selection_page[id] > g_block_selection_pages_max )
{
g_block_selection_page[id] = g_block_selection_pages_max;
}
ShowBlockSelectionMenu(id);
}
case K0:
{
--g_block_selection_page[id];
if ( g_block_selection_page[id] < 1 )
{
ShowBlockMenu(id);
}
else
{
ShowBlockSelectionMenu(id);
}
}
default:
{
key += ( g_block_selection_page[id] - 1 ) * 8;
if ( key < TOTAL_BLOCKS )
{
g_selected_block_type[id] = key;
ShowBlockMenu(id);
}
else
{
ShowBlockSelectionMenu(id);
}
}
}
}
public HandlePropertiesMenu(id, key)
{
new ent = g_property_info[id][1];
if ( !is_valid_ent(ent) )
{
SCM_Print(id, "That block has been deleted!");
g_viewing_properties_menu[id] = false;
ShowBlockMenu(id);
return PLUGIN_HANDLED;
}
new block_type = entity_get_int(ent, EV_INT_body);
switch ( key )
{
case K1:
{
if ( g_property1_name[block_type][0] )
{
g_property_info[id][0] = 1;
}
else if ( g_property2_name[block_type][0] )
{
g_property_info[id][0] = 2;
}
else if ( g_property3_name[block_type][0] )
{
g_property_info[id][0] = 3;
}
else
{
g_property_info[id][0] = 4;
}
if ( g_property_info[id][0] == 1
&& ( block_type == BUNNYHOP
|| block_type == SLAP ) )
{
ToggleProperty(id, 1);
}
else if ( g_property_info[id][0] == 4 )
{
ToggleProperty(id, 4);
}
else
{
SCM_Print(id, "Type the new property value for the block.%s", g_property_info[id][0] == 3 && block_type != BOOTS_OF_SPEED ? "^1 0^3 and^1 255^3 will turn transparency off." : g_blank);
client_cmd(id, "messagemode SCM_SetProperty");
}
}
case K2:
{
if ( g_property1_name[block_type][0] && g_property2_name[block_type][0]
|| g_property1_name[block_type][0] && g_property3_name[block_type][0]
|| g_property1_name[block_type][0] && g_property4_name[block_type][0]
|| g_property2_name[block_type][0] && g_property3_name[block_type][0]
|| g_property2_name[block_type][0] && g_property4_name[block_type][0]
|| g_property3_name[block_type][0] && g_property4_name[block_type][0] )
{
if ( g_property1_name[block_type][0] && g_property2_name[block_type][0] )
{
g_property_info[id][0] = 2;
}
else if ( g_property1_name[block_type][0] && g_property3_name[block_type][0]
|| g_property2_name[block_type][0] && g_property3_name[block_type][0] )
{
g_property_info[id][0] = 3;
}
else
{
g_property_info[id][0] = 4;
}
if ( g_property_info[id][0] == 4 )
{
ToggleProperty(id, 4);
}
else
{
SCM_Print(id, "Type the new property value for the block.%s", g_property_info[id][0] == 3 && block_type != BOOTS_OF_SPEED ? "^1 0^3 and^1 255^3 will turn transparency off." : g_blank);
client_cmd(id, "messagemode SCM_SetProperty");
}
}
}
case K3:
{
if ( g_property1_name[block_type][0] && g_property2_name[block_type][0] && g_property3_name[block_type][0]
|| g_property1_name[block_type][0] && g_property2_name[block_type][0] && g_property4_name[block_type][0]
|| g_property1_name[block_type][0] && g_property3_name[block_type][0] && g_property4_name[block_type][0]
|| g_property2_name[block_type][0] && g_property3_name[block_type][0] && g_property4_name[block_type][0] )
{
if ( g_property1_name[block_type][0] && g_property2_name[block_type][0] && g_property3_name[block_type][0] )
{
g_property_info[id][0] = 3;
}
else
{
g_property_info[id][0] = 4;
}
if ( g_property_info[id][0] == 4 )
{
ToggleProperty(id, 4);
}
else
{
SCM_Print(id, "Type the new property value for the block.%s", g_property_info[id][0] == 3 && block_type != BOOTS_OF_SPEED && block_type != SUPER ? "^1 0^3 and^1 255^3 will turn transparency off." : g_blank);
client_cmd(id, "messagemode SCM_SetProperty");
}
}
}
case K4:
{
if ( g_property1_name[block_type][0] && g_property2_name[block_type][0] && g_property3_name[block_type][0] && g_property4_name[block_type][0] )
{
ToggleProperty(id, 4);
}
}
case K0:
{
g_viewing_properties_menu[id] = false;
ShowBlockMenu(id);
}
}
if ( key != K0 ) ShowPropertiesMenu(id, ent);
return PLUGIN_HANDLED;
}
public HandleMoveMenu(id, key)
{
switch ( key )
{
case K1: ToggleGridSize(id);
case K0: ShowMainMenu(id);
default:
{
static ent, body;
get_user_aiming(id, ent, body);
if ( !IsBlock(ent) ) return PLUGIN_HANDLED;
static Float:origin[3];
if ( IsBlockInGroup(id, ent) && g_group_count[id] > 1 )
{
static i, block;
new bool:group_is_stuck = true;
for ( i = 0; i <= g_group_count[id]; ++i )
{
block = g_grouped_blocks[id][i];
if ( IsBlockInGroup(id, block) )
{
entity_get_vector(block, EV_VEC_origin, origin);
switch ( key )
{
case K2: origin[2] += g_grid_size[id];
case K3: origin[2] -= g_grid_size[id];
case K4: origin[0] += g_grid_size[id];
case K5: origin[0] -= g_grid_size[id];
case K6: origin[1] += g_grid_size[id];
case K7: origin[1] -= g_grid_size[id];
}
MoveEntity(id, block, origin, false);
if ( group_is_stuck && !IsBlockStuck(block) )
{
group_is_stuck = false;
break;
}
}
}
if ( group_is_stuck )
{
for ( i = 0; i <= g_group_count[id]; ++i )
{
block = g_grouped_blocks[id][i];
if ( IsBlockInGroup(id, block) )
{
DeleteBlock(block);
}
}
SCM_Print(id, "Group deleted because all the blocks were stuck!");
}
}
else
{
entity_get_vector(ent, EV_VEC_origin, origin);
switch ( key )
{
case K2: origin[2] += g_grid_size[id];
case K3: origin[2] -= g_grid_size[id];
case K4: origin[0] += g_grid_size[id];
case K5: origin[0] -= g_grid_size[id];
case K6: origin[1] += g_grid_size[id];
case K7: origin[1] -= g_grid_size[id];
}
MoveEntity(id, ent, origin, false);
if ( IsBlockStuck(ent) )
{
new bool:deleted = DeleteBlock(ent);
if ( deleted ) SCM_Print(id, "Block deleted because it was stuck!");
}
}
}
}
if ( key != K0 ) ShowMoveMenu(id);
return PLUGIN_HANDLED;
}
public HandleTeleportMenu(id, key)
{
switch ( key )
{
case K1: CreateTeleportAiming(id, TELEPORT_START);
case K2: CreateTeleportAiming(id, TELEPORT_DESTINATION);
case K3: DeleteTeleportAiming(id);
case K4: SwapTeleportAiming(id);
case K5: ShowTeleportPath(id);
case K0: ShowMainMenu(id);
}
if ( key != K9 && key != K0 ) ShowTeleportMenu(id);
}
public HandleLightMenu(id, key)
{
switch ( key )
{
case K1: CreateLightAiming(id);
case K2: DeleteLightAiming(id);
case K3: SetPropertiesLightAiming(id);
case K0: ShowMainMenu(id);
}
if ( key != K3 && key != K0 ) ShowLightMenu(id);
}
public HandleLightPropertiesMenu(id, key)
{
new ent = g_light_property_info[id][1];
if ( !is_valid_ent(ent) )
{
SCM_Print(id, "That light has been deleted!");
g_viewing_light_properties_menu[id] = false;
ShowLightMenu(id);
return PLUGIN_HANDLED;
}
switch ( key )
{
case K1: g_light_property_info[id][0] = 1;
case K2: g_light_property_info[id][0] = 2;
case K3: g_light_property_info[id][0] = 3;
case K4: g_light_property_info[id][0] = 4;
case K0:
{
g_viewing_light_properties_menu[id] = false;
ShowLightMenu(id);
}
}
if ( key != K0 )
{
SCM_Print(id, "Type the new property value for the light.");
client_cmd(id, "messagemode SCM_SetLightProperty");
ShowLightPropertiesMenu(id, ent);
}
return PLUGIN_HANDLED;
}
public HandleOptionsMenu(id, key)
{
switch ( key )
{
case K1: ToggleSnapping(id);
case K2: ToggleSnappingGap(id);
case K3: GroupBlockAiming(id);
case K4: ClearGroup(id);
case K5:
{
if ( g_admin[id] ) ShowChoiceMenu(id, CHOICE_DELETE, "Are you sure you want to delete all blocks and teleports?");
else ShowOptionsMenu(id);
}
case K6: SaveBlocks(id);
case K7:
{
if ( g_admin[id] ) ShowChoiceMenu(id, CHOICE_LOAD, "Loading will delete all blocks and teleports, do you want to continue?");
else ShowOptionsMenu(id);
}
case K0: ShowBlockMenu(id);
}
if ( key != K5 && key != K7 && key != K0 ) ShowOptionsMenu(id);
}
public HandleChoiceMenu(id, key)
{
switch ( key )
{
case K1:
{
switch ( g_choice_option[id] )
{
case CHOICE_DELETE: DeleteAll(id, true);
case CHOICE_LOAD: LoadBlocks(id);
}
}
case K2: ShowOptionsMenu(id);
}
ShowOptionsMenu(id);
}
public HandleCommandsMenu(id, key)
{
switch ( key )
{
case K1: CmdSaveCheckpoint(id);
case K2: CmdLoadCheckpoint(id);
case K3: CmdReviveYourself(id);
case K4: CmdRevivePlayer(id);
case K5: CmdReviveEveryone(id);
case K6: ToggleAllGodmode(id);
case K7: CmdGiveAccess(id);
case K0:
{
g_viewing_commands_menu[id] = false;
ShowMainMenu(id);
}
}
if ( key != K0 ) ShowCommandsMenu(id);
}
ToggleNoclip(id)
{
if ( g_admin[id] || g_gived_access[id] )
{
set_user_noclip(id, g_noclip[id] ? 0 : 1);
g_noclip[id] = !g_noclip[id];
ShowBlockMenu(id);
}
}
ToggleGodmode(id)
{
if ( g_admin[id] || g_gived_access[id] )
{
set_user_godmode(id, g_godmode[id] ? 0 : 1);
g_godmode[id] = !g_godmode[id];
}
}
ToggleGridSize(id)
{
if ( g_admin[id] || g_gived_access[id] )
g_grid_size[id] *= 1;
{
g_grid_size[id] += 1.0;
if ( g_grid_size[id] > 15.0 )
{
g_grid_size[id] = 1.0;
}
}
}
ToggleSnapping(id)
{
if ( g_admin[id] || g_gived_access[id] )
{
g_snapping[id] = !g_snapping[id];
}
}
ToggleSnappingGap(id)
{
if ( g_admin[id] || g_gived_access[id] )
{
g_snapping_gap[id] += 4.0;
if ( g_snapping_gap[id] > 40.0 )
{
g_snapping_gap[id] = 0.0;
}
}
}
public CmdSaveCheckpoint(id)
{
if ( !g_admin[id] && !g_gived_access[id] )
{
console_print(id, "You have no access to that command");
return PLUGIN_HANDLED;
}
else if ( !g_alive[id] )
{
SCM_Print(id, "You have to be alive to save a checkpoint!");
return PLUGIN_HANDLED;
}
else if ( g_noclip[id] )
{
SCM_Print(id, "You can't save a checkpoint while using noclip!");
return PLUGIN_HANDLED;
}
static Float:velocity[3];
get_user_velocity(id, velocity);
new button = entity_get_int(id, EV_INT_button);
new flags = entity_get_int(id, EV_INT_flags);
if ( !( ( velocity[2] >= 0.0 || ( flags & FL_INWATER ) ) && !( button & IN_JUMP ) && velocity[2] <= 0.0 ) )
{
SCM_Print(id, "You can't save a checkpoint while moving up or down!");
return PLUGIN_HANDLED;
}
if ( flags & FL_DUCKING ) g_checkpoint_duck[id] = true;
else g_checkpoint_duck[id] = false;
entity_get_vector(id, EV_VEC_origin, g_checkpoint_position[id]);
SCM_Print(id, "Checkpoint saved!");
if ( !g_has_checkpoint[id] ) g_has_checkpoint[id] = true;
if ( g_viewing_commands_menu[id] ) ShowCommandsMenu(id);
return PLUGIN_HANDLED;
}
public CmdLoadCheckpoint(id)
{
if ( !g_admin[id] && !g_gived_access[id] )
{
console_print(id, "You have no access to that command");
return PLUGIN_HANDLED;
}
else if ( !g_alive[id] )
{
SCM_Print(id, "You have to be alive to load a checkpoint!");
return PLUGIN_HANDLED;
}
else if ( !g_has_checkpoint[id] )
{
SCM_Print(id, "You don't have a checkpoint!");
return PLUGIN_HANDLED;
}
static Float:origin[3];
for ( new i = 1; i <= g_max_players; i++ )
{
if ( i == id
|| !g_alive[i] ) continue;
entity_get_vector(id, EV_VEC_origin, origin);
if ( get_distance_f(g_checkpoint_position[id], origin) <= 35.0 )
{
if ( cs_get_user_team(i) == cs_get_user_team(id) ) continue;
SCM_Print(id, "Somebody is too close to your checkpoint!");
return PLUGIN_HANDLED;
}
}
entity_set_vector(id, EV_VEC_origin, g_checkpoint_position[id]);
entity_set_vector(id, EV_VEC_velocity, Float:{ 0.0, 0.0, 0.0 });
if ( g_checkpoint_duck[id] )
{
entity_set_int(id, EV_INT_flags, entity_get_int(id, EV_INT_flags) | FL_DUCKING);
}
return PLUGIN_HANDLED;
}
public CmdReviveYourself(id)
{
if ( !g_admin[id] && !g_gived_access[id] )
{
console_print(id, "You have no access to that command");
return PLUGIN_HANDLED;
}
else if ( g_alive[id] )
{
SCM_Print(id, "You are already alive!");
return PLUGIN_HANDLED;
}
ExecuteHam(Ham_CS_RoundRespawn, id);
SCM_Print(id, "You have revived yourself!");
static name[32];
get_user_name(id, name, charsmax(name));
for ( new i = 1; i <= g_max_players; i++ )
{
if ( !g_connected[i]
|| i == id ) continue;
SCM_Print(i, "^1%s^3 revived himself!", name);
}
return PLUGIN_HANDLED;
}
CmdRevivePlayer(id)
{
if ( !g_admin[id] && !g_gived_access[id] )
{
console_print(id, "You have no access to that command");
return PLUGIN_HANDLED;
}
client_cmd(id, "messagemode SCM_Revive");
SCM_Print(id, "Type the name of the client that you want to revive.");
return PLUGIN_HANDLED;
}
public RevivePlayer(id)
{
if ( !g_admin[id] && !g_gived_access[id] )
{
console_print(id, "You have no access to that command");
return PLUGIN_HANDLED;
}
static arg[32], target;
read_argv(1, arg, charsmax(arg));
target = cmd_target(id, arg, CMDTARGET_NO_BOTS);
if ( !target ) return PLUGIN_HANDLED;
else if ( id == target )
{
CmdReviveYourself(id);
return PLUGIN_HANDLED;
}
static target_name[32];
get_user_name(target, target_name, charsmax(target_name));
if ( g_admin[target]
|| g_gived_access[target] )
{
SCM_Print(id, "^1%s^3 is admin, he can revive himself!", target_name);
return PLUGIN_HANDLED;
}
else if ( g_alive[target] )
{
SCM_Print(id, "^1%s^3 is already alive!", target_name);
return PLUGIN_HANDLED;
}
ExecuteHam(Ham_CS_RoundRespawn, target);
static admin_name[32];
get_user_name(id, admin_name, charsmax(admin_name));
SCM_Print(id, "You revived^1 %s^3!", target_name);
for ( new i = 1; i <= g_max_players; i++ )
{
if ( !g_connected[i]
|| i == id
|| i == target ) continue;
SCM_Print(i, "^1%s^3 revived^1 %s^3!", admin_name, target_name);
}
SCM_Print(target, "You have been revived by^1 %s^3!", admin_name);
return PLUGIN_HANDLED;
}
CmdReviveEveryone(id)
{
if ( !g_admin[id] )
{
console_print(id, "You have no access to that command");
return PLUGIN_HANDLED;
}
for ( new i = 1; i <= g_max_players; i++ )
{
if ( !g_connected[i]
|| g_admin[i]
|| g_gived_access[i]
|| g_alive[i] ) continue;
ExecuteHam(Ham_CS_RoundRespawn, i);
}
static admin_name[32];
get_user_name(id, admin_name, charsmax(admin_name));
SCM_Print(0, "^1%s^3 revived everyone!", admin_name);
return PLUGIN_HANDLED;
}
ToggleAllGodmode(id)
{
if ( !g_admin[id] )
{
console_print(id, "You have no access to that command");
return PLUGIN_HANDLED;
}
for ( new i = 1; i <= g_max_players; i++ )
{
if ( !g_connected[i] ) continue;
if ( g_alive[i]
&& !g_admin[i]
&& !g_gived_access[i] )
{
entity_set_float(i, EV_FL_takedamage, g_all_godmode ? DAMAGE_AIM : DAMAGE_NO);
}
if ( g_viewing_commands_menu[i] ) ShowCommandsMenu(i);
}
g_all_godmode = !g_all_godmode;
static admin_name[32];
get_user_name(id, admin_name, charsmax(admin_name));
if ( g_all_godmode ) SCM_Print(0, "^1%s^3 set godmode on everyone!", admin_name);
else SCM_Print(0, "^1%s^3 removed godmode from everyone!", admin_name);
return PLUGIN_HANDLED;
}
CmdGiveAccess(id)
{
if ( !g_admin[id] )
{
console_print(id, "You have no access to that command");
return PLUGIN_HANDLED;
}
client_cmd(id, "messagemode SCM_GiveAccess");
SCM_Print(id, "Type the name of the client that you want to give access to %s.", PLUGIN_PREFIX);
return PLUGIN_HANDLED;
}
public GiveAccess(id)
{
if ( !g_admin[id] )
{
console_print(id, "You have no access to that command");
return PLUGIN_HANDLED;
}
static arg[32], target;
read_argv(1, arg, charsmax(arg));
target = cmd_target(id, arg, CMDTARGET_NO_BOTS);
if ( !target ) return PLUGIN_HANDLED;
static target_name[32];
get_user_name(target, target_name, charsmax(target_name));
if ( g_admin[target] || g_gived_access[target] )
{
SCM_Print(id, "^1%s^3 already have access to %s!", target_name, PLUGIN_PREFIX);
return PLUGIN_HANDLED;
}
g_gived_access[target] = true;
SCM_Print(id, "You gived^1 %s^3 access to %s!", target_name, PLUGIN_PREFIX);
static admin_name[32];
get_user_name(id, admin_name, charsmax(admin_name));
SCM_Print(target, "^1%s^3 has gived you access to %s! Type^1 /%s^3 to bring up the Main Menu.", admin_name, PLUGIN_PREFIX, PLUGIN_PREFIX);
for ( new i = 1; i <= g_max_players; i++ )
{
if ( i == id
|| i == target
|| !g_connected[i] ) continue;
SCM_Print(i, "^1%s^3 gived^1 %s^3 access to %s!", admin_name, target_name, PLUGIN_PREFIX);
}
return PLUGIN_HANDLED;
}
public CmdShowInfo(id)
{
static text[1120], len, textures[32], title[64];
get_pcvar_string(g_cvar_textures, textures, charsmax(textures));
len += format(text[len], charsmax(text) - len, "<html>");
len += format(text[len], charsmax(text) - len, "<style type = ^"text/css^">");
len += format(text[len], charsmax(text) - len, "body");
len += format(text[len], charsmax(text) - len, "{");
len += format(text[len], charsmax(text) - len, "background-color:#000000;");
len += format(text[len], charsmax(text) - len, "font-family:Comic Sans MS;");
len += format(text[len], charsmax(text) - len, "font-weight:bold;");
len += format(text[len], charsmax(text) - len, "}");
len += format(text[len], charsmax(text) - len, "h1");
len += format(text[len], charsmax(text) - len, "{");
len += format(text[len], charsmax(text) - len, "color:#00FF00;");
len += format(text[len], charsmax(text) - len, "font-size:large;");
len += format(text[len], charsmax(text) - len, "}");
len += format(text[len], charsmax(text) - len, "h2");
len += format(text[len], charsmax(text) - len, "{");
len += format(text[len], charsmax(text) - len, "color:#00FF00;");
len += format(text[len], charsmax(text) - len, "font-size:medium;");
len += format(text[len], charsmax(text) - len, "}");
len += format(text[len], charsmax(text) - len, "h3");
len += format(text[len], charsmax(text) - len, "{");
len += format(text[len], charsmax(text) - len, "color:#0096FF;");
len += format(text[len], charsmax(text) - len, "font-size:medium;");
len += format(text[len], charsmax(text) - len, "}");
len += format(text[len], charsmax(text) - len, "h4");
len += format(text[len], charsmax(text) - len, "{");
len += format(text[len], charsmax(text) - len, "color:#FFFFFF;");
len += format(text[len], charsmax(text) - len, "font-size:medium;");
len += format(text[len], charsmax(text) - len, "}");
len += format(text[len], charsmax(text) - len, "h5");
len += format(text[len], charsmax(text) - len, "{");
len += format(text[len], charsmax(text) - len, "color:#FFFFFF;");
len += format(text[len], charsmax(text) - len, "font-size:x-small;");
len += format(text[len], charsmax(text) - len, "}");
len += format(text[len], charsmax(text) - len, "</style>");
len += format(text[len], charsmax(text) - len, "<body>");
len += format(text[len], charsmax(text) - len, "<div align = ^"center^">");
len += format(text[len], charsmax(text) - len, "<h1>");
len += format(text[len], charsmax(text) - len, "%s v%s", PLUGIN_NAME, PLUGIN_VERSION);
len += format(text[len], charsmax(text) - len, "</h1>");
len += format(text[len], charsmax(text) - len, "<h4>");
len += format(text[len], charsmax(text) - len, "by %s", PLUGIN_AUTHOR);
len += format(text[len], charsmax(text) - len, "</h4>");
len += format(text[len], charsmax(text) - len, "<h2>");
len += format(text[len], charsmax(text) - len, "Grabbing Blocks:");
len += format(text[len], charsmax(text) - len, "</h3>");
len += format(text[len], charsmax(text) - len, "<h5>");
len += format(text[len], charsmax(text) - len, "Bind a key to +bmgrab to move the blocks around.<br />");
len += format(text[len], charsmax(text) - len, "Eg: <I>Bind F +bmgrab.</I>");
len += format(text[len], charsmax(text) - len, "</h5>");
len += format(text[len], charsmax(text) - len, "<h2>");
len += format(text[len], charsmax(text) - len, "Commands while grabbing a block:");
len += format(text[len], charsmax(text) - len, "</h2>");
len += format(text[len], charsmax(text) - len, "<h5>");
len += format(text[len], charsmax(text) - len, "<I>+Attack</I>: Copies the block.<br />");
len += format(text[len], charsmax(text) - len, "<I>+Attack2</I>: Deletes the block.<br />");
len += format(text[len], charsmax(text) - len, "<I>+Reload</I>: Rotates the block.<br />");
len += format(text[len], charsmax(text) - len, "<I>+Jump</I>: Moves the block closer to you.<br />");
len += format(text[len], charsmax(text) - len, "<I>+Duck</I>: Moves the block further away from you.");
len += format(text[len], charsmax(text) - len, "</h5>");
len += format(text[len], charsmax(text) - len, "<h3>");
len += format(text[len], charsmax(text) - len, "Press <I>+Use</I> to see what block you are aiming at.<br />");
len += format(text[len], charsmax(text) - len, "Type /bm to bring up the %s Main Menu.", PLUGIN_NAME);
len += format(text[len], charsmax(text) - len, "</h3>");
len += format(text[len], charsmax(text) - len, "</div>");
len += format(text[len], charsmax(text) - len, "</body>");
len += format(text[len], charsmax(text) - len, "</html>");
format(title, charsmax(title) - 1, "Blockmaker Help");
show_motd(id, text, title);
return PLUGIN_HANDLED;
}
MoveGrabbedEntity(id, Float:move_to[3] = { 0.0, 0.0, 0.0 })
{
static aiming[3];
static look[3];
static Float:float_aiming[3];
static Float:float_look[3];
static Float:direction[3];
static Float:length;
get_user_origin(id, aiming, 1);
get_user_origin(id, look, 3);
IVecFVec(aiming, float_aiming);
IVecFVec(look, float_look);
direction[0] = float_look[0] - float_aiming[0];
direction[1] = float_look[1] - float_aiming[1];
direction[2] = float_look[2] - float_aiming[2];
length = get_distance_f(float_look, float_aiming);
if ( length == 0.0 ) length = 1.0;
move_to[0] = ( float_aiming[0] + direction[0] * g_grab_length[id] / length ) + g_grab_offset[id][0];
move_to[1] = ( float_aiming[1] + direction[1] * g_grab_length[id] / length ) + g_grab_offset[id][1];
move_to[2] = ( float_aiming[2] + direction[2] * g_grab_length[id] / length ) + g_grab_offset[id][2];
move_to[2] = float(floatround(move_to[2], floatround_floor));
MoveEntity(id, g_grabbed[id], move_to, true);
}
MoveEntity(id, ent, Float:move_to[3], bool:do_snapping)
{
if ( do_snapping ) DoSnapping(id, ent, move_to);
entity_set_origin(ent, move_to);
}
CreateBlockAiming(const id, const block_type)
{
if ( !g_admin[id] && !g_gived_access[id] )
{
console_print(id, "You have no access to that command");
return PLUGIN_HANDLED;
}
static origin[3];
static Float:float_origin[3];
new szCreator[32];
get_user_name(id, szCreator, 31);
replace_all(szCreator, 31, " ", "_");
get_user_origin(id, origin, 3);
IVecFVec(origin, float_origin);
float_origin[2] += 4.0;
CreateBlock(id, block_type, float_origin, Z, g_selected_block_size[id], g_property1_default_value[block_type], g_property2_default_value[block_type], g_property3_default_value[block_type], g_property4_default_value[block_type], szCreator);
return PLUGIN_HANDLED;
}
CreateBlock(const id, const block_type, Float:origin[3], const axis, const size, const property1[], const property2[], const property3[], const property4[], szCreator[] = "Unknown")
{
new ent = create_entity("info_target");
if ( !is_valid_ent(ent) ) return 0;
entity_set_string(ent, EV_SZ_classname, g_block_classname);
entity_set_int(ent, EV_INT_solid, SOLID_BBOX);
entity_set_int(ent, EV_INT_movetype, MOVETYPE_NONE);
new block_model[256];
new Float:size_min[3];
new Float:size_max[3];
new Float:angles[3];
new Float:scale;
switch ( axis )
{
case X:
{
if( size == POLE )
{
size_min[0] = -32.0;
size_min[1] = -4.0;
size_min[2] = -4.0;
size_max[0] = 32.0;
size_max[1] = 4.0;
size_max[2] = 4.0;
}
else
{
size_min[0] = -4.0;
size_min[1] = -32.0;
size_min[2] = -32.0;
size_max[0] = 4.0;
size_max[1] = 32.0;
size_max[2] = 32.0;
}
angles[0] = 90.0;
}
case Y:
{
if( size == POLE )
{
size_min[0] = -4.0;
size_min[1] = -32.0;
size_min[2] = -4.0;
size_max[0] = 4.0;
size_max[1] = 32.0;
size_max[2] = 4.0;
}
else
{
size_min[0] = -32.0;
size_min[1] = -4.0;
size_min[2] = -32.0;
size_max[0] = 32.0;
size_max[1] = 4.0;
size_max[2] = 32.0;
}
angles[0] = 90.0;
angles[2] = 90.0;
}
case Z:
{
if( size == POLE )
{
size_min[0] = -4.0;
size_min[1] = -4.0;
size_min[2] = -32.0;
size_max[0] = 4.0;
size_max[1] = 4.0;
size_max[2] = 32.0;
}
else
{
size_min[0] = -32.0;
size_min[1] = -32.0;
size_min[2] = -4.0;
size_max[0] = 32.0;
size_max[1] = 32.0;
size_max[2] = 4.0;
}
angles[0] = 0.0;
angles[1] = 0.0;
angles[2] = 0.0;
}
}
switch ( size )
{
case TINY:
{
SetBlockModelName(block_model, g_block_models[block_type], "Tiny");
scale = 0.25;
}
case NORMAL:
{
block_model = g_block_models[block_type];
scale = 1.0;
}
case LARGE:
{
SetBlockModelName(block_model, g_block_models[block_type], "Large");
scale = 2.0;
}
case POLE:
{
SetBlockModelName(block_model, g_block_models[block_type], "Pole");
scale = 1.0;
}
}
for ( new i = 0; i < 3; ++i )
{
if ( size_min[i] != 4.0 && size_min[i] != -4.0 )
{
size_min[i] *= scale;
}
if ( size_max[i] != 4.0 && size_max[i] != -4.0 )
{
size_max[i] *= scale;
}
}
entity_set_model(ent, block_model);
SetBlockRendering(ent, g_render[block_type], g_red[block_type], g_green[block_type], g_blue[block_type], g_alpha[block_type]);
entity_set_vector(ent, EV_VEC_angles, angles);
entity_set_size(ent, size_min, size_max);
entity_set_int(ent, EV_INT_body, block_type);
if ( 1 <= id <= g_max_players )
{
DoSnapping(id, ent, origin);
}
if( block_type == MAGIC )
{
set_pev(ent, pev_movetype, MOVETYPE_FLY);
set_pev(ent, pev_v_angle, origin);
}
set_pev(ent, pev_targetname, szCreator, 31);
entity_set_origin(ent, origin);
SetProperty(ent, 1, property1);
SetProperty(ent, 2, property2);
SetProperty(ent, 3, property3);
SetProperty(ent, 4, property4);
return ent;
}
ConvertBlockAiming(id, const convert_to)
{
if ( !g_admin[id] && !g_gived_access[id] )
{
console_print(id, "You have no access to that command");
return PLUGIN_HANDLED;
}
static ent, body;
get_user_aiming(id, ent, body);
if ( !IsBlock(ent) ) return PLUGIN_HANDLED;
new grabber = entity_get_int(ent, EV_INT_iuser2);
if ( grabber && grabber != id ) return PLUGIN_HANDLED;
new player = entity_get_int(ent, EV_INT_iuser1);
if ( player && player != id )
{
new player_name[32];
get_user_name(player, player_name, charsmax(player_name));
SCM_Print(id, "^1%s^3 currently has this block in their group!", player_name);
return PLUGIN_HANDLED;
}
static new_block;
if ( IsBlockInGroup(id, ent) && g_group_count[id] > 1 )
{
static i, block, block_count;
block_count = 0;
for ( i = 0; i <= g_group_count[id]; ++i )
{
block = g_grouped_blocks[id][i];
if ( !IsBlockInGroup(id, block) ) continue;
new_block = ConvertBlock(id, block, convert_to, true);
if ( new_block != 0 )
{
g_grouped_blocks[id][i] = new_block;
GroupBlock(id, new_block);
}
else
{
++block_count;
}
}
if ( block_count > 1 )
{
SCM_Print(id, "Couldn't convert^1 %d^3 blocks!", block_count);
}
}
else
{
new_block = ConvertBlock(id, ent, convert_to, false);
if ( IsBlockStuck(new_block) )
{
new bool:deleted = DeleteBlock(new_block);
if ( deleted ) SCM_Print(id, "Block deleted because it was stuck!");
}
}
return PLUGIN_HANDLED;
}
ConvertBlock(id, ent, const convert_to, const bool:preserve_size, szCreator[] = "Unknown")
{
new axis;
new block_type;
new property1[5], property2[5], property3[5], property4[5];
new Float:origin[3];
new Float:size_max[3];
get_user_name(id, szCreator, 31);
replace_all(szCreator, 31, " ", "_");
block_type = entity_get_int(ent, EV_INT_body);
entity_get_vector(ent, EV_VEC_origin, origin);
entity_get_vector(ent, EV_VEC_maxs, size_max);
for ( new i = 0; i < 3; ++i )
{
if ( size_max[i] == 4.0 )
{
axis = i;
break;
}
}
GetProperty(ent, 1, property1);
GetProperty(ent, 2, property2);
GetProperty(ent, 3, property3);
GetProperty(ent, 4, property4);
if ( block_type != convert_to )
{
copy(property1, charsmax(property1), g_property1_default_value[convert_to]);
copy(property2, charsmax(property1), g_property2_default_value[convert_to]);
copy(property3, charsmax(property1), g_property3_default_value[convert_to]);
copy(property4, charsmax(property1), g_property4_default_value[convert_to]);
}
DeleteBlock(ent);
if ( preserve_size )
{
static size, Float:max_size;
max_size = size_max[0] + size_max[1] + size_max[2];
if ( max_size > 128.0 ) size = LARGE;
else if ( max_size > 64.0 ) size = NORMAL;
else if ( max_size > 36.0 ) size = POLE;
else size = TINY;
return CreateBlock(id, convert_to, origin, axis, size, property1, property2, property3, property4, szCreator);
}
else
{
return CreateBlock(id, convert_to, origin, axis, g_selected_block_size[id], property1, property2, property3, property4, szCreator);
}
return ent;
}
DeleteBlockAiming(id)
{
if ( !g_admin[id] && !g_gived_access[id] )
{
console_print(id, "You have no access to that command");
return PLUGIN_HANDLED;
}
static ent, body;
get_user_aiming(id, ent, body);
if ( !IsBlock(ent) ) return PLUGIN_HANDLED;
new grabber = entity_get_int(ent, EV_INT_iuser2);
if ( grabber && grabber != id ) return PLUGIN_HANDLED;
new player = entity_get_int(ent, EV_INT_iuser1);
if ( player && player != id )
{
&nb