Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <engine>
- //#include <fakemeta>
- #include <fakemeta_util>
- #include <cstrike>
- #include <hamsandwich>
- //#include <money_ul>
- #include <xs>
- #include <fun>
- #pragma semicolon 1
- #define PLUGIN_PREFIX "pG"
- #define BM_ACCESS ADMIN_MENU
- #define PLUGIN_PROTECTION
- #define MENU_PROTECTION
- //#define BUILDS_FILES_PROTECTION
- #define USE_XPBLOCK
- //#define USE_ANTI_FUNJUMP
- #define CMDTARGET_OBEY_IMMUNITY (1<<0)
- #define CMDTARGET_ALLOW_SELF (1<<1)
- #define CMDTARGET_ONLY_ALIVE (1<<2)
- #define CMDTARGET_NO_BOTS (1<<3)
- #define MOVE_ENTITY_IDENTIFIER 31435
- #if defined USE_ANTI_FUNJUMP
- new Forward_Bhop;
- new ForwardReturn;
- #endif
- /*****************************************************************************/
- /******************************** Class Names ********************************/
- /*****************************************************************************/
- new const g_block_classname[] = "Blockmaker";
- new const g_start_classname[] = "Teleport_Start";
- new const g_end_classname[] = "Teleport_End";
- new const g_light_classname[] = "Light";
- /*****************************************************************************/
- /******************************** Models *************************************/
- /*****************************************************************************/
- new const szModelPlatform[] = "models/pG_Blockmaker/pg_platform.mdl";
- new const szModelGlass[] = "models/pG_Blockmaker/pg_platform.mdl";
- new const szModelBunnyhop[] = "models/pG_Blockmaker/pg_bhopv2.mdl";
- new const szModelDelayedBunnyhop[] = "models/pG_Blockmaker/pg_delayedv2.mdl";
- new const szModelDamage[] = "models/pG_Blockmaker/pg_damage.mdl";
- new const szModelHealer[] = "models/pG_Blockmaker/pg_healer.mdl";
- new const szModelNofalldamage[] = "models/blockmaker/igz_nofalldamage.mdl";
- new const szModelIce[] = "models/pG_Blockmaker/pg_ice.mdl";
- new const szModelTrampoline[] = "models/pG_Blockmaker/pg_trampoline.mdl";
- new const szModelSpeedboost[] = "models/pG_Blockmaker/pg_speedboost.mdl";
- new const szModelDeath[] = "models/pG_Blockmaker/pg_deathv2.mdl";
- new const szModelLowgravity[] = "models/blockmaker/igz_gravity.mdl";
- new const szModelHoney[] = "models/blockmaker/igz_honey.mdl";
- new const szModelSlap[] = "models/pG_Blockmaker/pg_slap.mdl";
- new const szModelCTBarrier[] = "models/pG_Blockmaker/pg_ctbrainer.mdl";
- new const szModelTBarrier[] = "models/pG_Blockmaker/pg_tbariner.mdl";
- new const szModelInvincibility[] = "models/blockmaker/igz_invincibility.mdl";
- new const szModelStealth[] = "models/pG_Blockmaker/pg_stealth.mdl";
- new const szModelBootsofspeed[] = "models/blockmaker/igz_boostofspeed.mdl";
- new const szModelHe[] = "models/pG_Blockmaker/pg_grenade.mdl";
- new const szModelFrost[] = "models/blockmaker/igz_frost.mdl";
- new const szModelFlashbang[] = "models/pG_Blockmaker/pg_flash.mdl";
- new const szModelMoney[] = "models/pG_Blockmaker/pg_money_v2.mdl";
- #if defined USE_XPBLOCK
- new const szModelXP[] = "models/pG_Blockmaker/pg_xp_50.mdl";
- #endif
- new const szModelDuck[] = "models/pG_Blockmaker/pg_duck.mdl";
- new const szModelDeagle[] = "models/pG_Blockmaker/pg_deagle.mdl";
- new const szModelAwp[] = "models/pG_Blockmaker/pg_awpv2.mdl";
- new const szModelak[] = "models/pG_Blockmaker/pg_ak.mdl";
- new const szModelSuperman[] = "models/blockmaker/igz_superman.mdl";
- new const szModelMagiccarpet[] = "models/pG_Blockmaker/pg_magiccarpet.mdl";
- new const szModelMove[] = "models/pG_Blockmaker/pg_move.mdl";
- /*****************************************************************************/
- /******************************** Sprites ************************************/
- /*****************************************************************************/
- new const szSpriteLight[] = "sprites/pG_Blockmaker/light.spr";
- new const szSpriteTeleportStart[] = "sprites/pG_Blockmaker/teleport_start.spr";
- new const szSpriteTeleportEnd[] = "sprites/pG_Blockmaker/teleport_end.spr";
- /*****************************************************************************/
- /******************************** Sounds *************************************/
- /*****************************************************************************/
- new const g_sound_invincibility[] = "pG_Blockmaker/invincible.wav";
- new const g_sound_stealth[] = "pG_Blockmaker/stealth.wav";
- new const g_sound_boots_of_speed[] = "pG_Blockmaker/bootsofSpeed.wav";
- new const g_sound_money[] = "pG_Blockmaker/money.wav";
- /*****************************************************************************/
- /******************************** Enums **************************************/
- /*****************************************************************************/
- enum
- {
- X,
- Y,
- Z
- };
- enum
- {
- DELETE_ALL,
- LOAD_ALL
- };
- enum
- {
- TELEPORT_START,
- TELEPORT_END
- };
- enum _:BlockSize
- {
- NORMAL,
- SMALL,
- LARGE,
- POLE,
- EXTRA_LARGE,
- JUMBO
- };
- enum ( += 1000 )
- {
- TASK_SPRITE = 1000,
- TASK_SOLID,
- TASK_SOLIDNOT,
- TASK_ICE,
- TASK_HONEY,
- TASK_INVINCIBILITY,
- TASK_STEALTH,
- TASK_BOOTSOFSPEED,
- TASK_SUPERMAN,
- TASK_MOVEBACK
- };
- enum _:Total_Blocks
- {
- PLATFORM,
- GLASS,
- BUNNYHOP,
- DELAY_BHOP,
- DAMAGE,
- HEALER,
- NFD,
- ICE,
- TRAMPOLINE,
- SPEEDBOOST,
- DEATH,
- LOW_GRAVITY,
- HONEY,
- SLAP,
- CTBARRIER,
- TBARRIER,
- INVINCIBILITY,
- STEALTH,
- BOOTS_OF_SPEED,
- HE,
- FROST,
- FLASHBANG,
- MONEY,
- #if defined USE_XPBLOCK
- XP,
- #endif
- DUCK,
- DEAGLE,
- AWP,
- ak,
- SUPERMAN,
- MAGICCARPET,
- MOVE
- };
- /*****************************************************************************/
- /******************************** Consts *************************************/
- /*****************************************************************************/
- new const BlockSizeNames[BlockSize][] =
- {
- "Normal",
- "Small",
- "Large",
- "Pole",
- "Extra Large",
- "Jumbo"
- };
- new const BlockNames[Total_Blocks][] =
- {
- "Platform",
- "Glass",
- "Bunnyhop",
- "Delay Bhop",
- "Damage",
- "Healer",
- "No Fall Damage",
- "Ice",
- "Trampoline",
- "Speed Boost",
- "Death",
- "Low Gravity",
- "Honey",
- "Slap",
- "CT Barrier",
- "T Barrier",
- "Invincibility",
- "Stealth",
- "Boots Of Speed",
- "HE Nade",
- "Frostnade",
- "Flashbang",
- "Money",
- #if defined USE_XPBLOCK
- "XP Block",
- #endif
- "Duck",
- "Deagle",
- "Awp",
- "AK",
- "Superman",
- "Magic Carpet",
- "Move Block"
- };
- new const Property1Names[Total_Blocks][] =
- {
- "", // Platfrom
- "", // Glass
- "No Fall Damage", // Bunnyhop
- "No Fall Damage", // Delay Bhop_
- "Damage Per Interval", // Damage
- "Health Per Interval", // Healer
- "", // No Fall Damage
- "Friction", // Ice
- "Upward Speed", // Trampoline
- "Forward Speed", // Speedboost
- "", // Death
- "Gravity", // Low Gravity
- "Speed In Honey", // Honey
- "Hardness", // Slap
- "", // CT Barrier
- "", // T Barrier
- "Invincibility Time", // Invincibility
- "Stealth Time", // Stealth
- "Boots Of Speed Time", // Boots Of Speed
- "Delay After Usage", // HE Nade
- "Delay After Usage", // Frostnade
- "Delay After Usage", // Flashbang
- "Amount", // Money
- #if defined USE_XPBLOCK
- "Amount", // XP Block
- #endif
- "Delay Time", // Duck
- "Ammo", // Deagle
- "Ammo", // Awp
- "Ammo", // AK
- "Gravity Time", // Superman
- "Team", // Magic Carpet
- "Type" // Move Block
- };
- new const Property1DefaultValue[Total_Blocks][] =
- {
- "", // Platform
- "", // Glass
- "0", // Bunnyhop
- "0", // Delay Bhop
- "5", // Damage
- "1", // Healer
- "", // No Fall Damage
- "0.35", // Ice
- "300", // Trampoline
- "800", // Speed Boost
- "", // Death
- "200", // Low Gravity
- "50", // Honey
- "1", // Slap
- "", // Ct Barrier
- "", // T Barrier
- "10", // Invincibility
- "10", // Stealth
- "10", // Boots Of Speed
- "999", // HE Nade
- "999",// Frostnade
- "999", // Flsahbang
- "2000", // Money
- #if defined USE_XPBLOCK
- "50", // XP Block
- #endif
- "0", // Duck
- "1", // Deagle
- "1", // Awp
- "1", // AK
- "5", // Superman
- "3", // Magic Carpet
- "0" // Move Block
- };
- new const Property2Names[Total_Blocks][] =
- {
- "", // Platform
- "", // Glass
- "On Ice", // Bunnyhop
- "On Ice", // Delay Bhop
- "Interval Between Damage", // Damage
- "Interval Between Healing", // Healer
- "", // No Fall Damage
- "Delay Time", // Ice
- "Delay Time", // Trampoline
- "Upward Speed", // Speed Boost
- "", // Death
- "", // Low Gravity
- "", // Honey
- "", // Slap
- "", // CT Barrier
- "", // T Barrier
- "Delay After Usage", // Invincibility
- "Delay After Usage", // Stealth
- "Delay After Usage", // Boots Of Speed
- "", // HE Nade
- "", // Frostnade
- "", // Flashbang
- "Delay After Usage", // Money
- #if defined USE_XPBLOCK
- "Delay After Usage", // XP Block
- #endif
- "No Fall Damage", // Duck
- "Delay After Usage", // Deagle
- "Delay After Usage", // Awp
- "Delay After Usage", // AK
- "Delay After Usage", // Superman
- "Time To Reset", // Magic Carpet
- "Distance" // Move Block
- };
- new const Property2DefaultValue[Total_Blocks][] =
- {
- "", // Platform
- "", // Glass
- "0", // Bunnyhop
- "0", // Delay Bhop
- "0.5", // Damage
- "0.5", // Healer
- "", // No Fall Damage
- "0", // Ice
- "0", // Trampoline
- "250", // Speed Boost
- "", // Death
- "", // Low Gravity
- "", // Honey
- "", // Slap
- "", // CT Barrier
- "", // T Barrier
- "10", // Invincibility
- "10", // Stealth
- "10", // Boots Of Speed
- "", // HE Nade
- "", // Frostnade
- "", // Flashbang
- "999", // Money
- #if defined USE_XPBLOCK
- "999", // XP Block
- #endif
- "0", // Duck
- "999", // Deagle
- "999", // Awp
- "999", // AK
- "10", // Superman
- "10", // Magic Carpet
- "100" // Move Block
- };
- new const Property3Names[Total_Blocks][] =
- {
- "Transperancy", // Platform
- "", // Glass
- "Transperancy", // Bunnyhop
- "Transperancy", // Dealy Bhop
- "Transperancy", // Damage
- "Transperancy", // Healer
- "Transperancy", // No Fall Damage
- "Transperancy", // Ice
- "Transperancy", // Trampoline
- "Transperancy", // Speed Boost
- "Transperancy", // Death
- "Transperancy", // Low Gravity
- "Transperancy", // Honey
- "Transperancy", // Slap
- "Transperancy", // CT Barrier
- "Transperancy", // T Barrier
- "Transperancy", // Invincibility
- "Transperancy", // Stealth
- "Transperancy", // Boots Of Speed
- "Transperancy", // HE Nade
- "Transperancy", // Frostnade
- "Transperancy", // Flashbang
- "Transperancy", // Money
- #if defined USE_XPBLOCK
- "Transperancy", // XP Block
- #endif
- "Transperancy", // Duck
- "Transperancy", // Deagle
- "Transperancy", // Awp
- "Transperancy", // AK
- "Transperancy", // Superman
- "Transperancy", // Magic Carpet
- "Direction" // Move Block
- };
- new const Property3DefaultValue[Total_Blocks][] =
- {
- "255", // Platform
- "", // Glass
- "255", // Bunnyhop
- "255", // Delay Bhop
- "255", // Damage
- "255", // Helaer
- "255", // No Fall Damage
- "255", // Ice
- "255", // Trampoline
- "255", // Speed Boost
- "255", // Death
- "255", // Low Gravity
- "255", // Honey
- "255", // Slap
- "255", // CT Barrier
- "255", // T Barrier
- "255", // Invincibility
- "255", // Stealth
- "255", // Boots Of Speed
- "255", // HE Nade
- "255", // Frostnade
- "255", // Flashbang
- "255", // Money
- #if defined USE_XPBLOCK
- "255", // XP Block
- #endif
- "255", // Duck
- "255", // Deagle
- "255", // Awp
- "255", // AK
- "255", // Superman
- "255", // Magic Carpet
- "0" // Move Block
- };
- new const Property4Names[Total_Blocks][] =
- {
- "", // Platform
- "", // Glass
- "On Top Only", // Bunnyhop
- "On Top Only", // Delay Bhop
- "On Top Only", // Damage
- "On Top Only", // Helaer
- "", // No Fall Damage
- "", // Ice
- "On Top Only", // Trampoline
- "On Top Only", // Speed Boost
- "On Top Only", // Death
- "On Top Only", // Low Gravity
- "", // Honey
- "On Top Only", // Slap
- "On Top Only", // CT Barrier
- "On Top Only", // T Barrier
- "On Top Only", // Invincibility
- "On Top Only", // Stealth
- "On Top Only", // Boots Of Speed
- "On Top Only", // HE Nade
- "On Top Only", // Frostnade
- "On Top Only", // Flashbang
- "On Top Only", // Money
- #if defined USE_XPBLOCK
- "On Top Only", // XP Block
- #endif
- "", // Duck
- "On Top Only", // Deagle
- "On Top Only", // Awp
- "On Top Only", // AK
- "On Top Only", // Superman
- "On Top Only", // Magic Carpet
- "Moving" // Move Block
- };
- new const Property4DefaultValue[Total_Blocks][] =
- {
- "", // Platform
- "", // Glass
- "0", // Bunnyhop
- "0", // Delay Bhop
- "1", // Damage
- "1", // Helaer
- "", // No Fall Damage
- "", // Ice
- "1", // Trampoline
- "1", // Speed Boost
- "1", // Death
- "1", // Low Gravity
- "", // Honey
- "1", // Slap
- "0", // CT Barrier
- "0", // T Barrier
- "1", // Invincibility
- "1", // Stealth
- "1", // Boots Of Speed
- "1", // HE Nade
- "1", // Frostnade
- "1", // Flashbang
- "1", // Money
- #if defined USE_XPBLOCK
- "1", // XP Block
- #endif
- "", // Duck
- "1", // Deagle
- "1", // Awp
- "1", // AK
- "1", // Superman
- "1", // Magic Carpet
- "0" // Move Block
- };
- new const Property5Names[Total_Blocks][] =
- {
- "", // Platform
- "", // Glass
- "Honey", // Bunnyhop
- "Delay Time", // Delay Bhop
- "", // Damage
- "Armor Regeneration", // Helaer
- "", // No Fall Damage
- "No Fall Damage", // Ice
- "", // Trampoline
- "No Fall Damage", // Speed Boost
- "", // Death
- "", // Low Gravity
- "", // Honey
- "", // Slap
- "", // CT Barrier
- "", // T Barrier
- "", // Invincibility
- "", // Stealth
- "Speed", // Boots Of Speed
- "Effect", // HE Nade
- "Effect", // Frostnade
- "Effect", // Flashbang
- "", // Money
- #if defined USE_XPBLOCK
- "", // XP Block
- #endif
- "Allow Jump", // Duck
- "Effect", // Deagle
- "Effect", // Awp
- "Effect", // AK
- "Gravity", // Superman
- "Delay After Use", // Magic Carpet
- "Speed" // Move Block
- };
- new const Property5DefaultValue[Total_Blocks][] =
- {
- "", // Platform
- "", // Glass
- "0", // Bunnyhop
- "3", // Delay Bhop
- "", // Damage
- "0", // Healer
- "", // No Fall Damage
- "0", // Ice
- "", // Trampoline
- "0", // Speed Boost
- "", // Death
- "", // Low Gravity
- "", // Honey
- "", // Slap
- "", // CT Barrier
- "", // T Barrier
- "", // Invincibility
- "", // Stealth
- "400", // Boots Of Speed
- "1", // HE Nade
- "1", // Frostnade
- "1", // Flashbang
- "", // Money
- #if defined USE_XPBLOCK
- "", // XP Block
- #endif
- "1", // Duck
- "1", // Dealge
- "1", // AK
- "1", // Awp
- "200", // Superman
- "0", // Magic Carpet
- "100"
- };
- new const g_block_save_ids[Total_Blocks] =
- {
- 'A', // Platform
- 'B', // Glass
- 'C', // Bunnyhop
- 'D', // Delayed Bhop
- 'E', // Damage
- 'F', // Healer
- 'G', // No Fall Damage
- 'H', // Ice
- 'I', // Trampoline
- 'J', // Speed Boost
- 'K', // Death
- 'L', // Low Gravity
- 'M', // Honey
- 'N', // Slap
- 'O', // CT Barreir
- 'P', // T Barrier
- 'Q', // Invincibility
- 'R', // Stealth
- 'S', // Boots Of Speed
- 'T', // HE Nade
- 'U', // Frostnade
- 'V', // Flashbang
- 'W', // Money
- #if defined USE_XPBLOCK
- 'X', // XP Block
- #endif
- 'Y', // Duck
- 'Z', // Deagle
- '1', // Awp
- '5', // AK
- '2', // Superman
- '3', // Magic Carpet
- '4' // Move Block
- };
- new SpriteBeam;
- new g_block_selection_pages_max;
- new BlockModels[Total_Blocks][256];
- new g_grouped_blocks[33][256];
- new g_file[64];
- new BlockSelected[33];
- new BlockSizeSelected[33];
- new BlockGrabbed[33];
- new g_group_count[33];
- new g_teleport_start[33];
- new HaveGodmode[33];
- new HaveNoclip[33];
- new PropertyEnt[33];
- new PropertyPicked[33];
- new ChooseType[33];
- new Snapping[33];
- new g_gived_access[33];
- new g_checkpoint_duck[33];
- new g_block_selection_page[33];
- new g_low_gravity[33];
- new g_honey[33];
- new g_slap_times[33];
- new g_boots_of_speed[33];
- new g_superman[33];
- new g_szLastAction[ 33 ][ 109 ];
- new g_szUndoStat[ 33 ][ 40 ];
- new bool:g_ice[33];
- new bool:g_nfd[33];
- new bool:g_blockjump[ 33 ];
- new bool:g_all_godmode;
- //new OrpheuStruct:g_ppmove;
- new Float:ToggleSnapping[33];
- new Float:SnappingGap[33];
- new Float:gfGrabOffset[33][3];
- new Float:gfGrablength[33];
- new Float:g_next_damage_time[33];
- new Float:g_next_heal_time[33];
- new Float:LastCheckpoint[33][3];
- new Float:g_set_velocity[33][3];
- new Float:g_invincibility_next_use[33];
- new Float:g_stealth_next_use[33];
- new Float:g_boots_next_use[33];
- new Float:g_he_next_use[33];
- new Float:g_frost_next_use[33];
- new Float:g_flash_next_use[33];
- new Float:g_money_next_use[33];
- new Float:g_xp_next_use[33];
- new Float:g_deagle_next_use[33];
- new Float:g_awp_next_use[33];
- new Float:g_ak_next_use[33];
- new Float:g_superman_next_use[33];
- new Float:g_invincibility_time_out[33];
- new Float:g_stealth_time_out[33];
- new Float:g_boots_time_out[33];
- new Float:g_superman_time_out[33];
- new Float:g_magic_time_out[33];
- #if defined USE_XPBLOCK
- native hnsxp_get_user_xp(id);
- native hnsxp_set_user_xp(id, xp);
- #endif
- /*****************************************************************************/
- /****************************** Plugin Evenets *******************************/
- /*****************************************************************************/
- public plugin_cfg()
- {
- LoadBlocks(0);
- }
- public plugin_precache()
- {
- BlockModels[PLATFORM] = szModelPlatform;
- BlockModels[GLASS] = szModelGlass;
- BlockModels[BUNNYHOP] = szModelBunnyhop;
- BlockModels[DELAY_BHOP] = szModelDelayedBunnyhop;
- BlockModels[DAMAGE] = szModelDamage;
- BlockModels[HEALER] = szModelHealer;
- BlockModels[NFD] = szModelNofalldamage;
- BlockModels[ICE] = szModelIce;
- BlockModels[TRAMPOLINE] = szModelTrampoline;
- BlockModels[SPEEDBOOST] = szModelSpeedboost;
- BlockModels[DEATH] = szModelDeath;
- BlockModels[LOW_GRAVITY] = szModelLowgravity;
- BlockModels[HONEY] = szModelHoney;
- BlockModels[SLAP] = szModelSlap;
- BlockModels[CTBARRIER] = szModelCTBarrier;
- BlockModels[TBARRIER] = szModelTBarrier;
- BlockModels[INVINCIBILITY] = szModelInvincibility;
- BlockModels[STEALTH] = szModelStealth;
- BlockModels[BOOTS_OF_SPEED] = szModelBootsofspeed;
- BlockModels[HE] = szModelHe;
- BlockModels[FROST] = szModelFrost;
- BlockModels[FLASHBANG] = szModelFlashbang;
- BlockModels[MONEY] = szModelMoney;
- #if defined USE_XPBLOCK
- BlockModels[XP] = szModelXP;
- #endif
- BlockModels[DUCK] = szModelDuck;
- BlockModels[DEAGLE] = szModelDeagle;
- BlockModels[AWP] = szModelAwp;
- BlockModels[SUPERMAN] = szModelSuperman;
- BlockModels[MAGICCARPET] = szModelMagiccarpet;
- BlockModels[MOVE] = szModelMove;
- BlockModels[ak] = szModelak;
- new block_model[256];
- for ( new i = 0; i < Total_Blocks; ++i )
- {
- precache_model(BlockModels[i]);
- SetBlockModelNameSmall(block_model, BlockModels[i], 256);
- precache_model(block_model);
- SetBlockModelNameLarge(block_model, BlockModels[i], 256);
- precache_model(block_model);
- SetBlockModelNamePole(block_model, BlockModels[i], 256);
- precache_model(block_model);
- SetBlockModelNameExtraLarge(block_model, BlockModels[i], 256);
- precache_model(block_model);
- SetBlockModelNameJumbo(block_model, BlockModels[i], 256);
- precache_model(block_model);
- }
- precache_model(szSpriteTeleportStart);
- precache_model(szSpriteTeleportEnd);
- precache_model(szSpriteLight);
- precache_sound(g_sound_invincibility);
- precache_sound(g_sound_stealth);
- precache_sound(g_sound_boots_of_speed);
- precache_sound(g_sound_money);
- SpriteBeam = precache_model("sprites/laserbeam.spr");
- }
- public plugin_init( )
- {
- register_clcmd( "say /bm", "MainMenu" );
- register_clcmd( "say !bm", "MainMenu" );
- register_clcmd( "pG_SetProperty", "SetPropertyBlock", -1 );
- register_clcmd( "pG_SetLightProperty", "SetPropertyLight", -1 );
- register_clcmd( "pG_Revive", "RevivePlayer", -1 );
- register_clcmd( "pG_GiveAccess", "GiveAccess", -1 );
- register_clcmd( "+bmgrab", "cmd_Grab" );
- register_clcmd( "-bmgrab", "cmd_Release" );
- register_event( "CurWeapon", "EventCurWeapon", "be" );
- register_think( g_block_classname, "BlockThink" );
- register_think( g_light_classname, "LightThink" );
- register_forward( FM_CmdStart, "FwdCmdStart" );
- register_forward( FM_Think, "FwdThink" );
- RegisterHam(Ham_Spawn, "player", "HamPlayerSpawn", 1 );
- #if defined USE_ANTI_FUNJUMP
- Forward_Bhop = CreateMultiForward( "foword_bhop", ET_IGNORE, FP_CELL );
- #endif
- RegisterMenus( );
- SetFilePath( );
- }
- public RegisterMenus( )
- {
- register_menucmd( register_menuid( "Main Menu" ), 1023, "MainMenu_Handler" );
- register_menucmd( register_menuid( "Block Menu" ), 1023, "BlockMenu_Handler" );
- register_menucmd( register_menuid( "BlockSelectionMenu" ), 1023, "HandleBlockSelectionMenu" );
- register_menucmd( register_menuid( "Teleport Menu" ), 1023, "TeleportMenu_Handler" );
- register_menucmd( register_menuid( "Light Menu" ), 1023, "LightMenu_Handler" );
- register_menucmd( register_menuid( "Option Menu" ), 1023, "OptionsMenu_Handler" );
- register_menucmd( register_menuid( "Choose Menu" ), 1023, "ChooseMenu_Handler" );
- register_menucmd( register_menuid( "Property Menu" ), 1023, "PropertyMenu_Handler" );
- register_menucmd( register_menuid( "Light Properties Menu" ), 1023, "LightPropertyMenu_Handler" );
- register_menucmd( register_menuid( "Admin Menu" ), 1023, "AdminMenu_Handler" );
- register_menucmd( register_menuid( "Protection Menu" ), 1023, "ProtectionMenu_Handler" );
- }
- public SetFilePath( )
- {
- 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));
- strtolower( map );
- formatex(g_file, charsmax(g_file), "%s/%s.%s", dir, map, PLUGIN_PREFIX);
- }
- public HamPlayerSpawn(id)
- {
- if(!is_user_alive(id) || !is_user_connected(id))
- return PLUGIN_HANDLED;
- ResetPlayer(id);
- return PLUGIN_HANDLED;
- }
- public client_putinserver(id)
- {
- Snapping[id] = true;
- SnappingGap[id] = 0.0;
- ToggleSnapping[id] = 4.0;
- BlockGrabbed[id] = 0;
- BlockSizeSelected[id] = NORMAL;
- BlockSelected[id] = PLATFORM;
- g_gived_access[ id ] = false;
- HaveGodmode[ id ] = false;
- HaveNoclip[ id ] = false;
- set_user_godmode( id, 0 );
- set_user_noclip( id, 0 );
- copy( g_szUndoStat[ id ], 39, "No actions" );
- }
- /*****************************************************************************/
- /********************************* Menu **************************************/
- /*****************************************************************************/
- public MainMenu(id)
- {
- new szBuffer[512], iLen;
- iLen = formatex(szBuffer, sizeof szBuffer - 1, "\y[%s] BlockMaker Main Menu^n^n", PLUGIN_PREFIX);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r1. \wBlock Menu^n");
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r2. \wTeleport Menu^n");
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r3. \wLight Menu^n");
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r4. \wAdmin Menu^n");
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "%s", get_user_flags( id ) & ADMIN_RCON ? "\r5. \wProtection Menu^n^n" : "^n" );
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r6. %sNoclip: %s^n", ( get_user_flags( id ) & ADMIN_MENU || g_gived_access[id] ) ? "\w" : "\d", get_user_noclip(id) ? "\yOn" : "\rOff");
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r7. %sGodmode: %s^n", ( get_user_flags( id ) & ADMIN_MENU || g_gived_access[id] ) ? "\w" : "\d", get_user_godmode(id) ? "\yOn" : "\rOff");
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "^n\r8. \wUndo: \y%s^n", g_szUndoStat[ id ] );
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "^n\r9. \wOptions Menu^n^n");
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r0. \wExit");
- new iKeys = ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6 | 1<<7 | 1<<8 | 1<< 9);
- show_menu(id, iKeys, szBuffer, -1, "Main Menu");
- }
- public BlockMenu(id)
- {
- new szBuffer[512], iLen;
- new col1[3]; col1 = (get_user_flags(id) & BM_ACCESS) || g_gived_access[id] ? "\w" : "\d";
- new col2[3]; col2 = (get_user_flags(id) & BM_ACCESS) || g_gived_access[id] ? "\y" : "\d";
- iLen = formatex(szBuffer, sizeof szBuffer - 1, "\y[%s] Block Menu^n^n", PLUGIN_PREFIX);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r1. \wBlock Type: \y%s^n", BlockNames[BlockSelected[id]]);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r2. %sCreate^n", col1);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r3. %sConvert^n", col1);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r4. %sDelete^n", col1);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r5. %sRotate^n^n", col1);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r6. %sNoclip: %s^n", ( get_user_flags( id ) & ADMIN_MENU || g_gived_access[id] ) ? "\w" : "\d", get_user_noclip(id) ? "\yOn" : "\rOff");
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r7. %sGodmode: %s^n^n", ( get_user_flags( id ) & ADMIN_MENU || g_gived_access[id] ) ? "\w" : "\d", get_user_godmode(id) ? "\yOn" : "\rOff");
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r8. %sBlock Size: %s%s^n^n", col1, col2, BlockSizeNames[BlockSizeSelected[id]]);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r9. %sSet Properties^n^n", col1);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r0. \wBack");
- new iKeys = ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6 | 1<<7 | 1<<8 | 1<< 9);
- show_menu(id, iKeys, szBuffer, -1, "Block Menu");
- }
- public TeleportMenu(id)
- {
- new szBuffer[512], iLen;
- new col1[3]; col1 = (get_user_flags(id) & BM_ACCESS) || g_gived_access[id]? "\w" : "\d";
- iLen = formatex(szBuffer, sizeof szBuffer - 1, "\y[%s] Teleport Menu^n^n", PLUGIN_PREFIX);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r1. %sTeleport Start^n", col1);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r2. %sTeleport End^n^n", col1);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r3. %sDelete Teleport^n^n", col1);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r4. %sSwap Teleport^n^n", col1);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r5. %sShow Teleport Path^n^n", col1);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r0. \wBack");
- new iKeys = ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<< 9);
- show_menu(id, iKeys, szBuffer, -1, "Teleport Menu");
- }
- public LightMenu(id)
- {
- new szBuffer[512], iLen;
- new col1[3]; col1 = (get_user_flags(id) & BM_ACCESS) || g_gived_access[id]? "\w" : "\d";
- iLen = formatex(szBuffer, sizeof szBuffer - 1, "\y[%s] Light Menu^n^n", PLUGIN_PREFIX);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r1. %sCreate Light^n", col1);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r2. %sDelete Light^n^n", col1);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r3. %sSet Property^n^n", col1);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r0. \wBack");
- new iKeys = ( 1<<0 | 1<<1 | 1<<2 | 1<< 9);
- show_menu(id, iKeys, szBuffer, -1, "Light Menu");
- }
- public AdminMenu(id)
- {
- new szBuffer[512], iLen;
- new col1[3]; col1 = (get_user_flags(id) & BM_ACCESS) || g_gived_access[id]? "\w" : "\d";
- iLen = formatex(szBuffer, sizeof szBuffer - 1, "\y[%s] Admin Menu^n^n", PLUGIN_PREFIX);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r1. %sSave Checkpoint^n", col1);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r2. %sLoad Checkpoint^n^n", col1);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r3. %s%sRevive Your Self^n", col1, is_user_alive( id ) ? "\d" : "\w" );
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r4. %sRevive a Player^n", col1);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r5. %sRevive Everyone^n^n", col1);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r6. %sMove to Spectator & Revive^n", col1);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r7. %s%s Everyone Godmode^n^n", col1, g_all_godmode ? "Remove" : "Set");
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r8. %sGive Access^n^n", col1);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r0. \wBack");
- new iKeys = ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6 | 1<<7 | 1<< 9);
- show_menu(id, iKeys, szBuffer, -1, "Admin Menu");
- }
- public ProtectionMenu(id)
- {
- new szBuffer[512], iLen;
- new col1[3]; col1 = (get_user_flags(id) & BM_ACCESS) || g_gived_access[id]? "\w" : "\d";
- new block_type;
- new ent = -1;
- new countXP, countAWP, countDEAGLE, countAK, TranspercyBlocks;
- new property[5];
- while ( ( ent = find_ent_by_class(ent, g_block_classname) ) )
- {
- block_type = entity_get_int(ent, EV_INT_body);
- switch( block_type )
- {
- #if defined USE_XPBLOCK
- case XP: countXP++;
- #endif
- case AWP: countAWP++;
- case DEAGLE: countDEAGLE++;
- case ak: countAK++;
- }
- GetProperty(ent, 4, property);
- if( str_to_num( property ) < 50 && block_type != MOVE )
- TranspercyBlocks++;
- }
- iLen = formatex(szBuffer, sizeof szBuffer - 1, "\y[%s] Protection Menu^n^n", PLUGIN_PREFIX);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r1. %sXP Positions^n", col1);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r2. %sAwp Positions^n", col1);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r3. %sDeagle Positions^n", col1);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r4. %sTranspercy -50 blocks Positions^n^n", col1);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\yXP blocks:\r %d^n", countXP );
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\yAwp blocks:\r %d^n", countAWP );
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\yDeagle blocks:\r %d^n", countDEAGLE );
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\yAK blocks:\r %d^n", countAK );
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\yTransperancy -50 blocks:\r %d^n^n", TranspercyBlocks );
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r0. \wBack");
- new iKeys = ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<< 9);
- show_menu(id, iKeys, szBuffer, -1, "Protection Menu");
- }
- public OptionsMenu(id)
- {
- new szBuffer[512], iLen;
- new col1[3]; col1 = (get_user_flags(id) & BM_ACCESS) || g_gived_access[id]? "\w" : "\d";
- iLen = formatex(szBuffer, sizeof szBuffer - 1, "\y[%s] Options Menu^n^n", PLUGIN_PREFIX);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r1. \wSnapping: %s^n", Snapping[id] ? "\yOn" : "\rOff");
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r2. \wSnapping Gap: \y%d^n^n", floatround( SnappingGap[ id ] ) );
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r3. %sAdd to Group^n", col1);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r4. %sClear Group^n^n", col1);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r5. %sDelete All^n", col1);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r6. %sSave^n", col1);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r7. %sLoad^n^n", col1);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r8. \wToggle Snapping Gap: \y%.1f^n", ToggleSnapping[id]);
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r9. \wReset Snapping Gap^n^n");
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r0. \wBack");
- new iKeys = ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6 | 1<<7 | 1<<8 | 1<< 9);
- show_menu(id, iKeys, szBuffer, -1, "Option Menu");
- }
- public ChooseMenu(id, type)
- {
- new szBuffer[512], iLen;
- iLen = formatex(szBuffer, sizeof szBuffer - 1, "\yAre you sure you want to %s All blocks ?^n^n", type == DELETE_ALL ? "Delete" : "Load");
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r1. \wYes^n");
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r2. \wNo^n^n");
- ChooseType[id] = type;
- new iKeys = ( 1<<0 | 1<<1 );
- show_menu(id, iKeys, szBuffer, -1, "Choose Menu");
- }
- public PropertyMenu(id, ent)
- {
- if( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- {
- BlockMenu(id);
- return PLUGIN_HANDLED;
- }
- new szBuffer[512], iLen;
- if(ent == 0)
- {
- new body;
- get_user_aiming(id, ent, body);
- if(!ent) BlockMenu(id);
- }
- if(!IsBlock(ent) || !is_valid_ent(ent))
- return PLUGIN_HANDLED;
- new property1[5], property2[5], property3[5], property4[5], property5[5];
- static block_type; block_type = entity_get_int(ent, EV_INT_body);
- GetProperty(ent, 1, property1);
- GetProperty(ent, 2, property2);
- GetProperty(ent, 3, property3);
- GetProperty(ent, 4, property4);
- GetProperty(ent, 5, property5);
- new i = 1;
- if(!Property1Names[block_type][0]
- && !Property2Names[block_type][0]
- && !Property3Names[block_type][0]
- && !Property4Names[block_type][0]
- && !Property5Names[block_type][0])
- {
- BlockMenu(id);
- return PLUGIN_HANDLED;
- }
- iLen = formatex(szBuffer, sizeof szBuffer - 1, "\yProperty Menu^n^n");
- if(Property1Names[block_type][0])
- {
- if(block_type == BUNNYHOP || block_type == DELAY_BHOP)
- {
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r%d. \w%s: %s^n", i, Property1Names[block_type], property1[0] == '0' ? "\rOff" : "\yOn");
- }
- else if(block_type == SLAP)
- {
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r%d. \w%s: \y%s^n", i, Property1Names[block_type], property1[0] == '1' ? "Easy" : property1[0] == '2' ? "Medium" : "Hard");
- }
- else if(block_type == DUCK)
- {
- if( property1[ 0 ] == '/' )
- {
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r%d. \w%s: \rOff^n", i, Property1Names[block_type] );
- }
- else
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r%d. \w%s: \y%s^n", i, Property1Names[block_type], equal( property1, "0" ) ? "\rOff" : property1);
- }
- else if( block_type == MOVE )
- {
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r%d. \w%s: \y%s^n", i, Property1Names[block_type], property1[ 0 ] == '0' ? "Platform" : property1[ 0 ] == '1' ? "Bunnyhop" : property1[ 0 ] == '2' ? "Trampoline" : property1[ 0 ] == '3' ? "Death" : "Delay Bhop" );
- }
- else
- {
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r%d. \w%s: \y%s^n", i, Property1Names[block_type], property1);
- }
- i++;
- }
- if(Property2Names[block_type][0])
- {
- if(block_type == BUNNYHOP || block_type == DELAY_BHOP || block_type == DUCK)
- {
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r%d. \w%s: %s^n", i, Property2Names[block_type], property2[0] == '0' ? "\rOff" : "\yOn");
- }
- else if(block_type == TRAMPOLINE || block_type == ICE)
- {
- if( property2[ 0 ] == '/' )
- {
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r%d. \w%s: \rOff^n", i, Property2Names[block_type] );
- }
- else
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r%d. \w%s: \y%s^n", i, Property2Names[block_type], equal( property2, "0" ) ? "\rOff" : property2);
- }
- else
- {
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r%d. \w%s: \y%s^n", i, Property2Names[block_type], property2);
- }
- i++;
- }
- if(Property3Names[block_type][0])
- {
- if( block_type != MOVE )
- {
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r%d. \w%s: \y%s^n", i, Property3Names[block_type], property3);
- }
- else
- {
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r%d. \w%s: \y%s^n", i, Property3Names[block_type], str_to_num( property3 ) == 0 ? "Forward & Backward" : str_to_num( property3 ) == 1 ? "Right & Left" : "Up & Down" );
- }
- i++;
- }
- if(Property4Names[block_type][0])
- {
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r%d. \w%s: %s^n", i, Property4Names[block_type], property4[0] == '0' ? "\rOff" : "\yOn");
- i++;
- }
- if(Property5Names[block_type][0])
- {
- if(block_type == HEALER || block_type == ICE || block_type == SPEEDBOOST || block_type == DUCK || block_type == MAGICCARPET )
- {
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r%d. \w%s: \y%s^n^n", i, Property5Names[block_type], property5[0] == '0' ? "\rOff" : "\yOn");
- }
- else
- {
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r%d. \w%s: \y%s%s^n^n", i, Property5Names[block_type], property5, block_type == BUNNYHOP ? "%" : "" );
- }
- }
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r^n0. \wBack");
- PropertyEnt[id] = ent;
- new iKeys = ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<9);
- show_menu(id, iKeys, szBuffer, -1, "Property Menu");
- return PLUGIN_HANDLED;
- }
- public LightPropertyMenu(id, ent)
- {
- new szBuffer[512], iLen;
- if(ent == 0)
- {
- new body;
- get_user_aiming(id, ent, body);
- }
- if(!IsLight(ent) || !is_valid_ent(ent))
- return PLUGIN_HANDLED;
- new property1[5], property2[5], property3[5], property4[5];
- GetProperty(ent, 1, property1);
- GetProperty(ent, 2, property2);
- GetProperty(ent, 3, property3);
- GetProperty(ent, 4, property4);
- iLen = formatex(szBuffer, sizeof szBuffer - 1, "\yLight Properties Menu^n^n");
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r1. \wRadius: \y%d^n", str_to_num(property1));
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r2. \wRed: \y%d^n", str_to_num(property2));
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r3. \wGreen: \y%d^n", str_to_num(property3));
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r4. \wBlue: \y%d^n", str_to_num(property4));
- iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r^n0. \wBack");
- PropertyEnt[id] = ent;
- new iKeys = ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<9);
- show_menu(id, iKeys, szBuffer, -1, "Light Properties Menu");
- return PLUGIN_HANDLED;
- }
- /*****************************************************************************/
- /****************************** Handlers *************************************/
- /*****************************************************************************/
- public MainMenu_Handler(id, key)
- {
- switch(key)
- {
- case 0: BlockMenu(id);
- case 1: TeleportMenu(id);
- case 2: LightMenu(id);
- case 3: AdminMenu(id);
- case 4:
- {
- if( !( get_user_flags( id ) & ADMIN_RCON ) )
- {
- MainMenu( id );
- return PLUGIN_HANDLED;
- }
- #if defined MENU_PROTECTION
- new iAuthID[34];
- get_user_authid ( id, iAuthID, 34 );
- ProtectionMenu(id);
- #else
- ProtectionMenu(id);
- #endif
- }
- case 5:
- {
- if( (get_user_flags(id) & BM_ACCESS) || g_gived_access[id])
- {
- if(!get_user_noclip(id))
- set_user_noclip(id, 1);
- else
- set_user_noclip(id, 0);
- HaveNoclip[id] = !HaveNoclip[id];
- }
- MainMenu(id);
- }
- case 6:
- {
- if( (get_user_flags(id) & BM_ACCESS) || g_gived_access[id])
- {
- if(!get_user_godmode(id))
- set_user_godmode(id, 1);
- else
- set_user_godmode(id, 0);
- HaveGodmode[id] = !HaveGodmode[id];
- }
- MainMenu(id);
- }
- case 7:
- {
- if( (get_user_flags(id) & BM_ACCESS) || g_gived_access[id])
- {
- LoadActions( id );
- }
- MainMenu( id );
- }
- case 8: OptionsMenu(id);
- case 9: return PLUGIN_HANDLED;
- }
- return PLUGIN_HANDLED;
- }
- SaveAction( id, ent )
- {
- new Float:origin[ 3 ];
- entity_get_vector( ent, EV_VEC_origin, origin );
- new Float:angles[ 3 ];
- entity_get_vector( ent, EV_VEC_angles, angles );
- new szCreator[ 32 ];
- entity_get_string( ent, EV_SZ_targetname, szCreator, 31 );
- new Float:fSizeMax[ 3 ], Float:fMaxSize;
- entity_get_vector( ent, EV_VEC_maxs, fSizeMax );
- new iSize;
- fMaxSize = fSizeMax[ 0 ] + fSizeMax[ 1 ] + fSizeMax[ 2 ];
- if ( fMaxSize > 256.0 ) iSize = JUMBO;
- else if ( fMaxSize > 192.0 ) iSize = EXTRA_LARGE;
- else if ( fMaxSize > 128.0 ) iSize = LARGE;
- else if ( fMaxSize > 64.0 ) iSize = NORMAL;
- else if ( fMaxSize > 36.0 ) iSize = POLE;
- else iSize = SMALL;
- new Properties[ 5 ][ 5 ];
- GetProperty( ent, 1, Properties[ 0 ] );
- GetProperty( ent, 2, Properties[ 1 ] );
- GetProperty( ent, 3, Properties[ 2 ] );
- GetProperty( ent, 4, Properties[ 3 ] );
- GetProperty( ent, 5, Properties[ 4 ] );
- if ( !Properties[ 0 ][ 0 ] ) copy( Properties[ 0 ], 4, "/" );
- if ( !Properties[ 1 ][ 0 ] ) copy( Properties[ 1 ], 4, "/" );
- if ( !Properties[ 2 ][ 0 ] ) copy( Properties[ 2 ], 4, "/" );
- if ( !Properties[ 3 ][ 0 ] ) copy( Properties[ 3 ], 4, "/" );
- if ( !Properties[ 4 ][ 0 ] ) copy( Properties[ 4 ], 4, "/" );
- formatex( g_szLastAction[ id ], 108, "%d %f %f %f %f %f %f %d %s %s %s %s %s %s %d",\
- entity_get_int( ent, EV_INT_body ),\
- origin[ 0 ],\
- origin[ 1 ],\
- origin[ 2 ],\
- angles[ 0 ],\
- angles[ 1 ],\
- angles[ 2 ],\
- iSize,\
- Properties[ 0 ],
- Properties[ 1 ],
- Properties[ 2 ],
- Properties[ 3 ],
- Properties[ 4 ],
- szCreator,
- ent );
- }
- LoadActions( id )
- {
- if( equal( g_szLastAction[ id ], "" ) )
- {
- ColorChat( id, "Nothing to^x03 undo^x01!" );
- return;
- }
- new szCreator[ 32 ];
- new sz_BlockType[ 2 ];
- new sz_Size[ 2 ];
- new origin_x[ 17 ];
- new origin_y[ 17 ];
- new origin_z[ 17 ];
- new angle_x[ 17 ];
- new angle_y[ 17 ];
- new angle_z[ 17 ];
- new szProperty1[ 5 ], szProperty2[ 5 ], szProperty3[ 5 ], szProperty4[ 5 ], szProperty5[ 5 ];
- new szEnt[ 5 ];
- parse( g_szLastAction[ id ],
- sz_BlockType, sizeof( sz_BlockType ) - 1,
- origin_x, sizeof( origin_x ) - 1,
- origin_y, sizeof( origin_y ) - 1,
- origin_z, sizeof( origin_z ) - 1,
- angle_x, sizeof( angle_x ) - 1,
- angle_y, sizeof( angle_y ) - 1,
- angle_z, sizeof( angle_z ) - 1,
- sz_Size, sizeof( sz_Size ) - 1,
- szProperty1, sizeof( szProperty1 ) - 1,
- szProperty2, sizeof( szProperty2 ) - 1,
- szProperty3, sizeof( szProperty3 ) - 1,
- szProperty4, sizeof( szProperty4 ) - 1,
- szProperty5, sizeof( szProperty5 ) - 1,
- szCreator, sizeof( szCreator ) - 1,
- szEnt, sizeof( szEnt ) - 1 );
- new Float:origin[ 3 ];
- new Float:angles[ 3 ];
- new axis;
- origin[ 0 ] = str_to_float( origin_x );
- origin[ 1 ] = str_to_float( origin_y );
- origin[ 2 ] = str_to_float( origin_z );
- angles[ 0 ] = str_to_float( angle_x );
- angles[ 1 ] = str_to_float( angle_y );
- angles[ 2 ] = str_to_float( angle_z );
- if( angles[ 0 ] == 90.0 && angles[ 1 ] == 0.0 && angles[ 2 ] == 0.0 )
- {
- axis = X;
- }
- else if( angles[ 0 ] == 90.0 && angles[ 1 ] == 0.0 && angles[ 2 ] == 90.0 )
- {
- axis = Y;
- }
- else
- {
- axis = Z;
- }
- new ent = str_to_num( szEnt );
- if( IsBlock( ent ) )
- {
- remove_entity( ent );
- }
- new Float:trash[ 3 ];
- CreateBlock( 0, str_to_num( sz_BlockType ), origin, axis, str_to_num( sz_Size ), szProperty1, szProperty2, szProperty3, szProperty4, szProperty5, angles, szCreator, false, trash, trash );
- copy( g_szLastAction[ id ], 108, "" );
- copy( g_szUndoStat[ id ], 39, "No actions" );
- }
- public BlockMenu_Handler(id, key)
- {
- if(key != 0 && key != 8 && key != 9 )
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- {
- BlockMenu(id);
- return PLUGIN_HANDLED;
- }
- }
- switch(key)
- {
- case 0:
- {
- if(g_block_selection_page[id] < 1)
- g_block_selection_page[id] = 1;
- ShowBlockSelectionMenu(id);
- return PLUGIN_HANDLED;
- }
- case 1:
- {
- #if defined MENU_PROTECTION
- if( BlockSelected[id] == XP )
- {
- CreateBlockAiming(id, BlockSelected[id], BlockSizeSelected[id]);
- }
- else
- {
- CreateBlockAiming(id, BlockSelected[id], BlockSizeSelected[id]);
- }
- #else
- CreateBlockAiming(id, BlockSelected[id], BlockSizeSelected[id]);
- #endif
- }
- case 2:
- {
- #if defined MENU_PROTECTION
- if( BlockSelected[id] == XP )
- {
- new iAuthID[34];
- get_user_authid ( id, iAuthID, 34 );
- ConvertBlockAiming(id, BlockSelected[id], BlockSizeSelected[id]);
- }
- else
- {
- ConvertBlockAiming(id, BlockSelected[id], BlockSizeSelected[id]);
- }
- #else
- ConvertBlockAiming(id, BlockSelected[id], BlockSizeSelected[id]);
- #endif
- }
- case 3: DeleteBlockAiming(id);
- case 4: RotateBlockAiming(id);
- case 5:
- {
- if(!get_user_noclip(id))
- set_user_noclip(id, 1);
- else
- set_user_noclip(id, 0);
- HaveNoclip[id] = !HaveNoclip[id];
- }
- case 6:
- {
- if(!get_user_godmode(id))
- set_user_godmode(id, 1);
- else
- set_user_godmode(id, 0);
- HaveGodmode[id] = !HaveGodmode[id];
- }
- case 7:
- {
- BlockSizeSelected[id]++;
- if(BlockSizeSelected[id] == BlockSize)
- BlockSizeSelected[id] = 0;
- }
- case 8:
- {
- PropertyMenu(id, 0);
- return PLUGIN_HANDLED;
- }
- case 9:
- {
- MainMenu(id);
- return PLUGIN_HANDLED;
- }
- }
- BlockMenu(id);
- return PLUGIN_HANDLED;
- }
- public TeleportMenu_Handler(id, key)
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id] && key != 9)
- return PLUGIN_HANDLED;
- switch ( key )
- {
- case 0: CreateTeleportAiming(id, TELEPORT_START);
- case 1: CreateTeleportAiming(id, TELEPORT_END);
- case 2: DeleteTeleportAiming(id);
- case 3: SwapTeleportAiming(id);
- case 4: ShowTeleportPath(id);
- case 9: MainMenu(id);
- }
- if ( key != 9 )
- TeleportMenu(id);
- return PLUGIN_HANDLED;
- }
- public LightMenu_Handler(id, key)
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id] && key != 9)
- return PLUGIN_HANDLED;
- switch ( key )
- {
- case 0: CreateLightAiming(id);
- case 1: DeleteLightAiming(id);
- case 2: SetPropertiesLightAiming(id);
- case 9: MainMenu(id);
- }
- if ( key != 2 && key != 9 )
- LightMenu(id);
- return PLUGIN_HANDLED;
- }
- public AdminMenu_Handler(id, key)
- {
- switch ( key )
- {
- case 0: CmdSaveCheckpoint(id);
- case 1: CmdLoadCheckpoint(id);
- case 2: CmdReviveYourself(id);
- case 3: CmdRevivePlayer(id);
- case 4: CmdReviveEveryone(id);
- case 5: CmdSpecRevive( id );
- case 6: ToggleAllGodmode(id);
- case 7: CmdGiveAccess(id);
- case 9: MainMenu(id);
- }
- if ( key != 9 )
- AdminMenu(id);
- }
- public ProtectionMenu_Handler(id, key)
- {
- if( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id] && key != 9)
- {
- ProtectionMenu(id);
- return;
- }
- if( key == 9 )
- {
- MainMenu( id );
- return;
- }
- new ent = -1;
- new count;
- new Block;
- switch ( key )
- {
- #if defined USE_XPBLOCK
- case 0: Block = XP;
- #endif
- case 1: Block = AWP;
- case 2: Block = DEAGLE;
- }
- new block_type;
- new property[5];
- while ( ( ent = find_ent_by_class(ent, g_block_classname) ) )
- {
- block_type = entity_get_int(ent, EV_INT_body);
- GetProperty(ent, 3, property);
- if( block_type == Block && key != 3 || key == 3 && str_to_num( property ) < 50 )
- {
- set_rendering(ent,kRenderFxGlowShell,0,255,0,kRenderTransAlpha,200);
- count++;
- static Float:origin1[3], Float:origin2[3];
- entity_get_vector(id, EV_VEC_origin, origin1);
- entity_get_vector(ent, EV_VEC_origin, origin2);
- message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
- write_byte(TE_BEAMPOINTS);
- write_coord(floatround(origin1[0], floatround_floor));
- write_coord(floatround(origin1[1], floatround_floor));
- write_coord(floatround(origin1[2], floatround_floor));
- write_coord(floatround(origin2[0], floatround_floor));
- write_coord(floatround(origin2[1], floatround_floor));
- write_coord(floatround(origin2[2], floatround_floor));
- write_short(SpriteBeam);
- write_byte(0);
- write_byte(1);
- write_byte(10); // 50
- write_byte(5);
- write_byte(0);
- write_byte( 255 ); // 255
- write_byte( 255 ); // 255
- write_byte( 255 ); // 255
- write_byte(255); // 255
- write_byte(0);
- message_end();
- }
- }
- #if defined USE_XPBLOCK
- ColorChat(id, "There is^x03 %d^x01 %s blocks, for the the position go after the line.", count, Block == XP ? "XP" : Block == AWP ? "awp" : Block == DEAGLE ? "deagle" : key == 3 ? "^x04-50^x01 transperancy" : "" );
- #else
- new XP = 0;
- ColorChat(id, "There is^x03 %d^x01 %s blocks, for the the position go after the line.", count, Block == XP ? "XP" : Block == AWP ? "awp" : Block == DEAGLE ? "deagle" : key == 3 ? "^x04-50^x01 transperancy" : "" );
- #endif
- ProtectionMenu(id);
- }
- public OptionsMenu_Handler(id, key)
- {
- if(key != 0 && key != 1 && key != 7 && key != 8 && key != 9)
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- {
- OptionsMenu(id);
- return PLUGIN_HANDLED;
- }
- }
- switch(key)
- {
- case 0: Snapping[id] = !Snapping[id];
- case 1:
- {
- SnappingGap[id] += ToggleSnapping[id];
- if(SnappingGap[id] > 100.0)
- SnappingGap[id] = 0.0;
- }
- case 2: GroupBlockAiming(id);
- case 3: ClearGroup(id);
- case 4:
- {
- ChooseMenu(id, DELETE_ALL);
- return PLUGIN_HANDLED;
- }
- case 5:
- {
- #if defined MENU_PROTECTION
- SaveBlocks(id);
- MainMenu(id);
- #else
- SaveBlocks(id);
- #endif
- }
- case 6:
- {
- ChooseMenu(id, LOAD_ALL);
- return PLUGIN_HANDLED;
- }
- case 7:
- {
- ToggleSnapping[id] += 1.0;
- if(ToggleSnapping[id] > 10.0)
- ToggleSnapping[id] = 1.0;
- }
- case 8: SnappingGap[id] = 0.0;
- case 9:
- {
- MainMenu(id);
- return PLUGIN_HANDLED;
- }
- }
- OptionsMenu(id);
- return PLUGIN_HANDLED;
- }
- public ChooseMenu_Handler(id, key)
- {
- switch(key)
- {
- case 0:
- {
- switch(ChooseType[id])
- {
- case DELETE_ALL: DeleteAll(id);
- case LOAD_ALL: LoadBlocks(id);
- }
- }
- }
- OptionsMenu(id);
- }
- public PropertyMenu_Handler(id, key)
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- return PLUGIN_HANDLED;
- new ent = PropertyEnt[id];
- if ( !is_valid_ent(ent) || !IsBlock(ent))
- {
- ColorChat(id, "That block has been deleted!");
- BlockMenu(id);
- return PLUGIN_HANDLED;
- }
- new block_type = entity_get_int(ent, EV_INT_body);
- switch ( key )
- {
- case 0:
- {
- if ( Property1Names[block_type][0] )
- {
- PropertyPicked[id] = 1;
- if(block_type == BUNNYHOP
- || block_type == DELAY_BHOP
- || block_type == SLAP
- || block_type == MAGICCARPET )
- {
- ToggleProperty(id, 1);
- return PLUGIN_HANDLED;
- }
- }
- else if ( Property2Names[block_type][0] )
- {
- PropertyPicked[id] = 2;
- if(block_type == BUNNYHOP || block_type == DELAY_BHOP )
- {
- ToggleProperty(id, 2);
- return PLUGIN_HANDLED;
- }
- }
- else if ( Property3Names[block_type][0] )
- {
- PropertyPicked[id] = 3;
- }
- else if ( Property4Names[block_type][0] )
- {
- PropertyPicked[id] = 4;
- ToggleProperty(id, 4);
- return PLUGIN_HANDLED;
- }
- else
- {
- PropertyPicked[id] = 5;
- }
- ColorChat(id, "Type the new property value for the block.");
- client_cmd(id, "messagemode pG_SetProperty");
- }
- case 1:
- {
- if ( Property1Names[block_type][0] && Property2Names[block_type][0]
- || Property1Names[block_type][0] && Property3Names[block_type][0]
- || Property1Names[block_type][0] && Property4Names[block_type][0]
- || Property2Names[block_type][0] && Property3Names[block_type][0]
- || Property2Names[block_type][0] && Property4Names[block_type][0]
- || Property3Names[block_type][0] && Property4Names[block_type][0]
- || Property1Names[block_type][0] && Property5Names[block_type][0]
- || Property2Names[block_type][0] && Property5Names[block_type][0]
- || Property3Names[block_type][0] && Property5Names[block_type][0]
- || Property4Names[block_type][0] && Property5Names[block_type][0] )
- {
- if ( PropertyPicked[id] == 2 && ( block_type == BUNNYHOP )
- || ( PropertyPicked[id] == 2 && (block_type == DELAY_BHOP )))
- {
- ToggleProperty(id, 2);
- return PLUGIN_HANDLED;
- }
- if ( Property1Names[block_type][0] && Property2Names[block_type][0] )
- {
- PropertyPicked[id] = 2;
- }
- else if ( Property1Names[block_type][0] && Property3Names[block_type][0]
- || Property2Names[block_type][0] && Property3Names[block_type][0] )
- {
- PropertyPicked[id] = 3;
- }
- else if ( Property1Names[block_type][0] && Property4Names[block_type][0]
- || Property2Names[block_type][0] && Property4Names[block_type][0]
- || Property3Names[block_type][0] && Property4Names[block_type][0] )
- {
- PropertyPicked[id] = 4;
- }
- else
- {
- PropertyPicked[id] = 5;
- }
- if ( PropertyPicked[id] == 4 )
- {
- ToggleProperty(id, 4);
- }
- else
- {
- if ( block_type == BUNNYHOP || block_type == DELAY_BHOP || block_type == DUCK )
- {
- ToggleProperty(id, 2);
- return PLUGIN_HANDLED;
- }
- ColorChat(id, "Type the new property value for the block.%s", PropertyPicked[id] == 3 && block_type != BOOTS_OF_SPEED ? "^1 0^3 and^1 255^3 will turn transparency off." : "");
- client_cmd(id, "messagemode pG_SetProperty");
- }
- }
- }
- case 2:
- {
- if ( Property1Names[block_type][0] && Property2Names[block_type][0] && Property3Names[block_type][0]
- || Property1Names[block_type][0] && Property2Names[block_type][0] && Property4Names[block_type][0]
- || Property1Names[block_type][0] && Property2Names[block_type][0] && Property5Names[block_type][0]
- || Property1Names[block_type][0] && Property3Names[block_type][0] && Property4Names[block_type][0]
- || Property1Names[block_type][0] && Property3Names[block_type][0] && Property5Names[block_type][0]
- || Property1Names[block_type][0] && Property4Names[block_type][0] && Property5Names[block_type][0]
- || Property2Names[block_type][0] && Property3Names[block_type][0] && Property4Names[block_type][0]
- || Property2Names[block_type][0] && Property3Names[block_type][0] && Property5Names[block_type][0]
- || Property2Names[block_type][0] && Property4Names[block_type][0] && Property5Names[block_type][0]
- || Property3Names[block_type][0] && Property4Names[block_type][0] && Property5Names[block_type][0] )
- {
- if ( Property1Names[block_type][0] && Property2Names[block_type][0] && Property3Names[block_type][0] )
- {
- PropertyPicked[id] = 3;
- if ( block_type == SLAP || block_type == MOVE)
- {
- ToggleProperty(id, 3);
- return PLUGIN_HANDLED;
- }
- }
- else if (Property4Names[block_type][0])
- {
- PropertyPicked[id] = 4;
- ToggleProperty(id, 4);
- return PLUGIN_HANDLED;
- }
- else
- {
- PropertyPicked[id] = 5;
- if ( block_type == ICE )
- {
- ToggleProperty( id, 5 );
- return PLUGIN_HANDLED;
- }
- }
- ColorChat(id, "Type the new property value for the block.");
- client_cmd(id, "messagemode pG_SetProperty");
- }
- }
- case 3:
- {
- if ( Property1Names[block_type][0] && Property2Names[block_type][0] && Property3Names[block_type][0] && Property4Names[block_type][0] )
- {
- ToggleProperty(id, 4);
- }
- else if ( Property1Names[block_type][0] && Property2Names[block_type][0] && Property3Names[block_type][0] && Property5Names[block_type][0]
- || Property1Names[block_type][0] && Property2Names[block_type][0] && Property4Names[block_type][0] && Property5Names[block_type][0]
- || Property1Names[block_type][0] && Property3Names[block_type][0] && Property4Names[block_type][0] && Property5Names[block_type][0]
- || Property2Names[block_type][0] && Property3Names[block_type][0] && Property4Names[block_type][0] && Property5Names[block_type][0] )
- {
- PropertyPicked[id] = 5;
- ToggleProperty(id, 5);
- }
- }
- case 4:
- {
- if ( Property1Names[block_type][0] && Property2Names[block_type][0] && Property3Names[block_type][0] && Property4Names[block_type][0] && Property5Names[block_type][0] )
- {
- PropertyPicked[id] = 5;
- if(block_type == HEALER
- || block_type == SPEEDBOOST
- || block_type == HE
- || block_type == FLASHBANG
- || block_type == FROST
- || block_type == DEAGLE
- || block_type == AWP
- || block_type == DUCK
- || block_type == MAGICCARPET )
- {
- ToggleProperty(id, 5);
- return PLUGIN_HANDLED;
- }
- ColorChat(id, "Type the new property value for the block.");
- client_cmd(id, "messagemode pG_SetProperty");
- }
- }
- case 9:
- {
- BlockMenu(id);
- }
- }
- if ( key != 9 ) PropertyMenu(id, ent);
- return PLUGIN_HANDLED;
- }
- public LightPropertyMenu_Handler(id, key)
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- return PLUGIN_HANDLED;
- new ent = PropertyEnt[id];
- if ( !is_valid_ent(ent) )
- {
- ColorChat(id, "That light has been deleted!");
- LightMenu(id);
- return PLUGIN_HANDLED;
- }
- if( 0 <= key <= 3)
- PropertyPicked[id] = key+1;
- switch ( key )
- {
- case 0..3: client_cmd(id, "messagemode pG_SetLightProperty");
- case 9:
- {
- LightMenu(id);
- }
- }
- if ( key != 9 )
- {
- LightPropertyMenu(id, ent);
- }
- return PLUGIN_HANDLED;
- }
- ShowBlockSelectionMenu(id)
- {
- new menu[256], title[32], entry[32], num;
- format(title, charsmax(title), "\yBlock Selection %d^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), "^n\r%d. \w%s", num, BlockNames[i]);
- }
- else
- {
- format(entry, charsmax(entry), "^n");
- }
- add(menu, charsmax(menu), entry);
- }
- g_block_selection_pages_max = floatround((float(Total_Blocks) / 8.0), floatround_ceil);
- if ( g_block_selection_page[id] < g_block_selection_pages_max )
- {
- add(menu, charsmax(menu), "^n^n\r9. \wMore");
- }
- else
- {
- add(menu, charsmax(menu), "^n");
- }
- add(menu, charsmax(menu), "^n\r0. \wBack");
- new iKeys = ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6 | 1<<7 | 1<<8 | 1<<9 );
- show_menu(id,iKeys, menu, -1, "BlockSelectionMenu");
- }
- public HandleBlockSelectionMenu(id, key)
- {
- switch ( key )
- {
- case 8:
- {
- ++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 9:
- {
- --g_block_selection_page[id];
- if ( g_block_selection_page[id] < 1 )
- {
- BlockMenu(id);
- }
- else
- {
- ShowBlockSelectionMenu(id);
- }
- }
- default:
- {
- key += ( g_block_selection_page[id] - 1 ) * 8;
- if ( key < Total_Blocks )
- {
- #if defined USE_XPBLOCK
- if( key == XP && !( get_user_flags( id ) & ADMIN_RCON ) )
- {
- BlockMenu(id);
- return;
- }
- #endif
- BlockSelected[id] = key;
- BlockMenu(id);
- }
- else
- {
- ShowBlockSelectionMenu(id);
- }
- }
- }
- }
- public server_frame( )
- {
- 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 <= get_maxplayers() /*&& is_user_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);
- ActionTeleport(entinsphere, ent);
- }
- 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_end_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 <= get_maxplayers() && is_user_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);
- }
- }
- while ( ( ent = find_ent_by_class(ent, g_light_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 <= get_maxplayers() && is_user_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_PostThink(id)
- {
- if ( !is_user_alive(id) ) return PLUGIN_CONTINUE;
- if ( g_nfd[id] )
- {
- entity_set_int(id, EV_INT_watertype, -3);
- g_nfd[id] = false;
- }
- return PLUGIN_CONTINUE;
- }
- public client_PreThink(id)
- {
- 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_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]--;
- }
- new Float:gametime = get_gametime();
- if ( !( gametime >= g_invincibility_time_out[id] ) )
- {
- set_hudmessage(10, 150, 225, -1.0, 0.84, 0, 0.0, 0.1, 0.1, 0.1, 2);
- show_hudmessage(id, "Invincibility^n %.1f", g_invincibility_time_out[id] - gametime);
- }
- else if ( !( gametime >= g_stealth_time_out[id] ) )
- {
- set_hudmessage(10, 150, 225, -1.0, 0.84, 0, 0.0, 0.1, 0.1, 0.1, 2);
- show_hudmessage(id, "Stealth^n %.1f", g_stealth_time_out[id] - gametime);
- }
- else if ( !( gametime >= g_boots_time_out[id] ) )
- {
- set_hudmessage(10, 150, 225, -1.0, 0.84, 0, 0.0, 0.1, 0.1, 0.1, 2);
- show_hudmessage(id, "Boots of Speed^n %.1f", g_boots_time_out[id] - gametime);
- }
- else if ( !( gametime >= g_superman_time_out[id] ) )
- {
- set_hudmessage(10, 150, 225, -1.0, 0.84, 0, 0.0, 0.1, 0.1, 0.1, 2);
- show_hudmessage(id, "Superman^n %.1f", g_superman_time_out[id] - gametime);
- }
- else if ( !( gametime >= g_magic_time_out[id] ) )
- {
- set_hudmessage(10, 150, 225, -1.0, 0.84, 0, 0.0, 0.1, 0.1, 0.1, 2);
- show_hudmessage(id, "Magic Carpet^n %.1f", g_magic_time_out[id] - gametime);
- }
- new button; button = get_user_button(id);
- new oldbutton; oldbutton = get_user_oldbutton(id);
- if((button & IN_USE) && !(oldbutton & IN_USE))
- {
- 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", BlockNames[block_type]);
- if ( Property1Names[block_type][0] )
- {
- GetProperty(ent, 1, property);
- if ( block_type == BUNNYHOP || block_type == DELAY_BHOP )
- {
- if( property[0] == '1' )
- {
- len += format(message[len], charsmax(message) - len, "^n%s", Property1Names[block_type]);
- }
- }
- else if ( block_type == DUCK )
- {
- if( property[0] == '/' )
- {
- len += format(message[len], charsmax(message) - len, "^n%s: Off", Property1Names[block_type]);
- }
- else
- len += format(message[len], charsmax(message) - len, "^n%s: %s", Property1Names[block_type], property[ 0 ] == '0' ? "Off" : property);
- }
- else if( block_type == MOVE )
- {
- len += format(message[len], charsmax(message) - len, "^n%s: %s", Property1Names[block_type], property[ 0 ] == '0' ? "Platform" : property[ 0 ] == '1' ? "Bunnyhop" : property[ 0 ] == '2' ? "Trampoline" : property[ 0 ] == '3' ? "Death" : "Delay Bhop" );
- }
- else
- {
- len += format(message[len], charsmax(message) - len, "^n%s: %s", Property1Names[block_type], property);
- }
- }
- if ( Property2Names[block_type][0] )
- {
- GetProperty(ent, 2, property);
- if ( block_type == BUNNYHOP || block_type == DELAY_BHOP || block_type == DUCK )
- {
- if(property[0] == '1')
- {
- len += format(message[len], charsmax(message) - len, "^n%s", Property2Names[block_type]);
- }
- }
- else if ( block_type == TRAMPOLINE || block_type == ICE )
- {
- if( property[0] == '/' )
- {
- len += format(message[len], charsmax(message) - len, "^n%s: Off", Property2Names[block_type]);
- }
- else
- len += format(message[len], charsmax(message) - len, "^n%s: %s", Property2Names[block_type], equal( property, "0" ) ? "Off" : property);
- }
- else
- {
- len += format(message[len], charsmax(message) - len, "^n%s: %s", Property2Names[block_type], property);
- }
- }
- if( block_type == MOVE )
- {
- GetProperty(ent, 3, property);
- len += format(message[len], charsmax(message) - len, "^n%s: %s", Property3Names[block_type], property[ 0 ] == '0' ? "Forward & Backward" : property[ 0 ] == '1' ? "Right & Left" : "Up & Down" );
- }
- else
- {
- if ( Property4Names[block_type][0] )
- {
- GetProperty(ent, 4, property);
- len += format(message[len], charsmax(message) - len, "^n%s: %s", Property4Names[block_type], property[0] == '1' ? "Yes" : "No");
- }
- }
- if ( Property5Names[block_type][0] )
- {
- GetProperty(ent, 5, property);
- if(block_type == HEALER || block_type == ICE || block_type == SPEEDBOOST)
- {
- if(str_to_num(property) == 1)
- {
- len += format(message[len], charsmax(message) - len, "^n%s", Property5Names[block_type]);
- }
- }
- else if(block_type == DUCK || block_type == MAGICCARPET )
- {
- len += format(message[len], charsmax(message) - len, "^n%s: %s", Property5Names[block_type], property[ 0 ] == '0' ? "Off" : "On");
- }
- else
- {
- if( block_type == BUNNYHOP )
- {
- if( str_to_num( property ) > 0 )
- {
- len += format(message[len], charsmax(message) - len, "^n%s: %s%s", Property5Names[block_type], property, "%%" );
- }
- }
- else
- {
- len += format(message[len], charsmax(message) - len, "^n%s: %s", Property5Names[block_type], property );
- }
- }
- }
- new szCreator[64];
- pev(ent, pev_targetname, szCreator, 63);
- replace_all(szCreator, 31, "_", " ");
- len += format(message[len], charsmax(message) - len, "^nCreator: %s", szCreator);
- set_hudmessage(10, 150, 225, -1.0, 0.84, 0, 0.0, 3.00, 0.75, 0.75, 2);
- show_hudmessage(id, message);
- }
- else if ( IsTeleport(ent) || IsLight(ent))
- {
- new szCreator[64];
- pev(ent, pev_targetname, szCreator, 63);
- replace_all(szCreator, 31, "_", " ");
- set_hudmessage(10, 150, 225, -1.0, 0.84, 0, 0.0, 3.00, 0.75, 0.75, 2);
- show_hudmessage(id, "Type: %s^nCreator: %s", IsTeleport(ent) ? "Teleport" : "Light", szCreator);
- }
- }
- if ( g_low_gravity[id] )
- {
- new flags = pev(id, pev_flags);
- if ( flags & FL_ONGROUND )
- {
- set_pev(id, pev_gravity, 1.0);
- g_low_gravity[id] = false;
- }
- }
- return PLUGIN_HANDLED;
- }
- public FwdThink(ent)
- {
- if( entity_get_int( ent, EV_INT_body ) == MOVE )
- {
- return;
- }
- static Float:OriginF[3], property[5];
- GetProperty(ent, 4, property);
- if(IsBlock(ent) && str_to_num(property) == 1)
- {
- new num = pev(ent, pev_iuser4);
- entity_get_vector(ent, EV_VEC_origin, OriginF);
- GetProperty(ent, 1, property);
- if(num < str_to_num(property))
- {
- GetProperty(ent, 2, property);
- OriginF[str_to_num(property)] += 1.0;
- }
- GetProperty(ent, 1, property);
- if(num > str_to_num(property))
- {
- GetProperty(ent, 2, property);
- OriginF[str_to_num(property)] -= 1.0;
- }
- GetProperty(ent, 1, property);
- if(num >= (str_to_num(property) * 2) - 1)
- {
- set_pev(ent, pev_iuser4, 0);
- num = 0;
- }
- entity_set_vector(ent, EV_VEC_origin, OriginF);
- set_pev(ent, pev_iuser4, num + 1);
- }
- }
- public FwdCmdStart(id, handle)
- {
- if(!get_user_noclip(id) && HaveNoclip[id])
- set_user_noclip(id, 1);
- if(!get_user_godmode(id) && HaveGodmode[id])
- set_user_godmode(id, 1);
- static buttons; buttons = get_user_button(id);
- static oldbuttons; oldbuttons = get_user_oldbutton(id);
- if ( !BlockGrabbed[id] ) return FMRES_IGNORED;
- if ( ( buttons & IN_JUMP )
- && !( oldbuttons & IN_JUMP ) ) if ( gfGrablength[id] > 72.0 ) gfGrablength[id] -= 16.0;
- if ( ( buttons & IN_DUCK )
- && !( oldbuttons & IN_DUCK ) ) gfGrablength[id] += 16.0;
- if ( ( buttons & IN_ATTACK )
- && !( oldbuttons & IN_ATTACK ) ) cmd_Attack(id);
- if ( ( buttons & IN_ATTACK2 )
- && !( oldbuttons & IN_ATTACK2 ) ) cmd_Attack2(id);
- if ( ( buttons & IN_RELOAD )
- && !( oldbuttons & IN_RELOAD ) )
- {
- CmdRotate(id);
- set_uc(handle, UC_Buttons, buttons & ~IN_RELOAD);
- }
- if ( !is_valid_ent(BlockGrabbed[id]) )
- {
- cmd_Release(id);
- return FMRES_IGNORED;
- }
- if ( !IsBlockInGroup(id, BlockGrabbed[id])
- || g_group_count[id] < 1 )
- {
- move_GrabbedEntity(id);
- return FMRES_IGNORED;
- }
- static block;
- static Float:move_to[3];
- static Float:offset[3];
- static Float:origin[3];
- move_GrabbedEntity(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];
- move_Entity(id, block, origin);
- }
- return FMRES_IGNORED;
- }
- public BlockThink( entity )
- {
- if( !is_valid_ent( entity )
- || entity_get_int( entity, EV_INT_movetype ) != MOVETYPE_FLY // + check if the block is move block
- || entity_get_int( entity, EV_INT_iuser3 ) != MOVE_ENTITY_IDENTIFIER )
- {
- return HAM_IGNORED;
- }
- new reverse = entity_get_int(entity, EV_INT_weaponanim);
- new Float:start[3], Float:stop[3];
- entity_get_vector(entity, EV_VEC_vuser1 + ((reverse + 1) % 2), start);
- entity_get_vector(entity, EV_VEC_vuser1 + reverse, stop);
- new Float:speed = entity_get_float(entity, EV_FL_fuser1);
- entity_set_origin(entity, start);
- xs_vec_sub(stop, start, stop);
- xs_vec_mul_scalar(stop, speed / vector_length(stop), stop);
- entity_set_vector(entity, EV_VEC_velocity, stop);
- entity_set_int(entity, EV_INT_weaponanim, (++reverse % 2));
- entity_set_float(entity, EV_FL_nextthink, get_gametime() + entity_get_float(entity, EV_FL_fuser2));
- return HAM_HANDLED;
- }
- public pfn_touch(ent, id)
- {
- if ( !( 1 <= id <= get_maxplayers() )
- || !is_user_alive(id) ) return PLUGIN_CONTINUE;
- if( !IsBlock(ent) )
- {
- g_blockjump[ id ] = false;
- 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(id, ent);//, ExecuteForward( Forward_Bhop, ForwardReturn, id );
- case DELAY_BHOP: ActionDelayedBhop(id, ent);//, ExecuteForward( Forward_Bhop, ForwardReturn, id );
- case DAMAGE: ActionDamage(id, ent);
- case HEALER: ActionHeal(id, ent);
- case NFD: g_nfd[id] = true;
- case ICE: ActionIce(id, ent);
- case TRAMPOLINE: ActionTrampoline(id, ent);//, ExecuteForward( Forward_Bhop, ForwardReturn, id );
- case SPEEDBOOST: ActionSpeedBoost(id, ent);
- case DEATH:
- {
- if ( !get_user_godmode(id) )
- {
- fakedamage(id, "The Block of Death", 10000.0, DMG_GENERIC);
- }
- }
- case LOW_GRAVITY: ActionLowGravity(id, ent);
- case HONEY: ActionHoney(id, ent);
- case SLAP:
- {
- GetProperty(ent, 4, property);
- if(str_to_num(property) == 0)
- {
- user_slap(id, 0);
- }
- else
- {
- GetProperty(ent, 1, property);
- g_slap_times[id] = str_to_num(property) * 2;
- }
- }
- case CTBARRIER: ActionBarrier(id, ent, 2);
- case TBARRIER: ActionBarrier(id, ent, 1);
- case INVINCIBILITY: ActionInvincibility(id, ent);
- case STEALTH: ActionStealth(id, ent);
- case BOOTS_OF_SPEED: ActionBootsOfSpeed(id, ent);
- case HE, FROST, FLASHBANG: ActionGrenade(id, ent, block_type);
- case MONEY: ActionMoney(id, ent);
- #if defined USE_XPBLOCK
- case XP: ActionXp(id, ent);
- #endif
- case DUCK: ActionDuck(id, ent);
- case DEAGLE, AWP: ActionGun(id, ent, block_type);
- case SUPERMAN: ActionSuperman(id, ent);
- case MAGICCARPET: ActionMagic(id, ent);
- case MOVE: ActionMove( id, ent );
- }
- }
- }
- if ( ( flags & FL_ONGROUND )
- && groundentity == ent )
- {
- switch ( block_type )
- {
- case BUNNYHOP, DELAY_BHOP:
- {
- GetProperty(ent, 1, property);
- if ( property[0] == '1' )
- {
- g_nfd[id] = true;
- }
- }
- case DUCK:
- {
- GetProperty(ent, 2, property);
- if ( property[0] == '1' )
- {
- g_nfd[id] = true;
- }
- GetProperty(ent, 5, property);
- if( property[0] == '1' )
- {
- g_blockjump[ id ] = false;
- }
- else if( property[0] == '0' )
- g_blockjump[ id ] = true;
- }
- case NFD: g_nfd[id] = true;
- case ICE:
- {
- GetProperty(ent, 5, property);
- if ( property[0] == '1' )
- {
- g_nfd[id] = true;
- }
- ActionIce(id, ent);
- }
- case SPEEDBOOST:
- {
- GetProperty(ent, 5, property);
- if ( property[0] == '1' )
- {
- g_nfd[id] = true;
- }
- }
- case LOW_GRAVITY: ActionLowGravity(id, ent);
- }
- }
- return PLUGIN_CONTINUE;
- }
- public EventCurWeapon(id)
- {
- static block, property[5];
- if ( g_boots_of_speed[id] )
- {
- block = g_boots_of_speed[id];
- GetProperty(block, 5, 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));
- }
- }
- ActionBhop(id, ent )
- {
- if ( task_exists(TASK_SOLIDNOT + ent) || task_exists(TASK_SOLID + ent) )
- return PLUGIN_HANDLED;
- static property[5];
- set_task(0.1, "TaskSolidNot", TASK_SOLIDNOT + ent);
- GetProperty(ent, 2, property);
- if(str_to_num(property) == 1)
- {
- if (!g_ice[id])
- {
- entity_set_float(id, EV_FL_maxspeed, 400.0);
- entity_set_float(id, EV_FL_friction, 0.15);
- g_ice[id] = true;
- new task_id = TASK_ICE + id;
- if ( task_exists(task_id) ) remove_task(task_id);
- set_task(0.1, "TaskBhopNotOnIce", task_id);
- }
- }
- GetProperty(ent, 5, property);
- if( str_to_num( property ) > 0 )
- {
- if ( g_honey[id] != ent)
- {
- new Float:speed = str_to_float(property);
- //entity_set_float(id, EV_FL_maxspeed, 100 + speed);
- entity_set_float(id, EV_FL_maxspeed, 200 - 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;
- }
- ActionDelayedBhop(id, ent)
- {
- static property[5];
- GetProperty(ent, 5, property);
- if ( !task_exists(TASK_SOLIDNOT + ent))
- set_task(str_to_float(property), "TaskSolidNot", TASK_SOLIDNOT + ent);
- GetProperty(ent, 2, property);
- if(str_to_num(property) == 1)
- {
- if (!g_ice[id])
- {
- entity_set_float(id, EV_FL_maxspeed, 400.0);
- entity_set_float(id, EV_FL_friction, 0.15);
- g_ice[id] = true;
- new task_id = TASK_ICE + id;
- if ( task_exists(task_id) ) remove_task(task_id);
- set_task(0.1, "TaskBhopNotOnIce", task_id);
- }
- }
- 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", 1.0, DMG_CRUSH);
- fm_set_user_health( id, get_user_health( id ) - str_to_num( property ) );
- GetProperty(ent, 2, property);
- g_next_damage_time[id] = gametime + str_to_float(property);
- 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 && get_user_armor(id) >= 100) return PLUGIN_HANDLED;
- static property[5];
- GetProperty(ent, 1, property);
- if(health < 100)
- {
- if(health + str_to_num(property) > 100)
- {
- set_user_health(id, 100);
- }
- else
- {
- set_user_health(id, health + str_to_num(property));
- }
- }
- if(get_user_armor(id) < 100)
- {
- GetProperty(ent, 5, property);
- if( str_to_num(property) )
- {
- GetProperty(ent, 1, property);
- set_user_armor(id, get_user_armor(id) + str_to_num(property));
- }
- }
- GetProperty(ent, 2, property);
- g_next_heal_time[id] = gametime + str_to_float(property);
- return PLUGIN_HANDLED;
- }
- ActionIce(id, ent)
- {
- static property[5];
- GetProperty(ent, 1, property);
- if ( !g_ice[id] )
- {
- entity_set_float(id, EV_FL_friction, str_to_float(property));
- static property[5];
- GetProperty(ent, 2, property);
- 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);
- GetProperty(ent, 2, property);
- if( !equal( property, "0" ) && property[0] != '/' )
- {
- if ( !task_exists(TASK_SOLIDNOT + ent))
- {
- set_task(str_to_float(property), "TaskSolidNot", TASK_SOLIDNOT + ent);
- }
- }
- }
- /*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_nfd[id] = true;
- }*/
- /*ActionTrampoline(id, ent)
- {
- new szProperty1[33];
- GetProperty(ent, 1, szProperty1);
- pev(id, pev_velocity, g_set_velocity[id]);
- g_set_velocity[id][2] = str_to_float(szProperty1);
- set_pev( id, pev_gaitsequence, 6 );
- g_nfd[id] = true;
- }*/
- ActionTrampoline(id, ent)
- {
- new szProperty1[33];
- GetProperty(ent, 2, szProperty1);
- if( !equal( szProperty1, "0" ) && szProperty1[0] != '/' )
- {
- if ( !task_exists(TASK_SOLIDNOT + ent))
- {
- set_task(str_to_float(szProperty1), "TaskSolidNot", TASK_SOLIDNOT + ent);
- }
- }
- GetProperty(ent, 1, szProperty1);
- entity_get_vector( id, EV_VEC_velocity, g_set_velocity[ id ] );
- g_set_velocity[id][2] = str_to_float( szProperty1 );
- entity_set_int( id, EV_INT_gaitsequence, 6 );
- g_nfd[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);
- }
- /*action_SpeedBoost(id, ent)
- {
- new szProperty1[33];
- Get_BlockProperty(ent, 1, szProperty1);
- new szProperty2[33];
- Get_BlockProperty(ent, 2, szProperty2);
- new forwardSpeed = floatround(str_to_float(szProperty1));
- velocity_by_aim(id, forwardSpeed, gfSetVelocity[id]);
- new Float:fUpwardspeed = str_to_float(szProperty2);
- gfSetVelocity[id][2] = fUpwardspeed;
- set_pev(id, pev_gaitsequence, 6);
- }*/
- ActionLowGravity(id, ent)
- {
- new szProperty1[33];
- GetProperty(ent, 1, szProperty1);
- new Float:fGravity = str_to_float(szProperty1);
- set_pev(id, pev_gravity, fGravity / 800);
- if(!task_exists(id + 1500))
- set_task(0.2, "LowGravityTrue", id + 1500);
- }
- public LowGravityTrue(id)
- {
- id -= 1500;
- g_low_gravity[id] = true;
- }
- 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);
- }
- ActionBarrier(id, ent, team)
- {
- if ( task_exists(TASK_SOLIDNOT + ent)
- || task_exists(TASK_SOLID + ent) ) return PLUGIN_HANDLED;
- if ( cs_get_user_team(id) == CS_TEAM_T && team == 2) TaskSolidNot(TASK_SOLIDNOT + ent);
- if ( cs_get_user_team(id) == CS_TEAM_CT && team == 1) TaskSolidNot(TASK_SOLIDNOT + ent);
- return PLUGIN_HANDLED;
- }
- ActionInvincibility(id, ent)
- {
- new Float:gametime = get_gametime();
- if ( !( gametime >= g_invincibility_next_use[id] ) )
- {
- set_hudmessage(10, 150, 225, -1.0, 0.84, 0, 0.0, 0.1, 0.1, 0.1, 2);
- show_hudmessage(id, "Invincibility^nNext Use %.1f", g_invincibility_next_use[id] - gametime);
- return PLUGIN_HANDLED;
- }
- static property[5];
- entity_set_float(id, EV_FL_takedamage, DAMAGE_NO);
- set_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) + 0.2;
- set_task(time_out, "TaskRemoveInvincibility", TASK_INVINCIBILITY + id);
- GetProperty(ent, 2, property);
- g_invincibility_next_use[id] = gametime + str_to_float(property);
- g_invincibility_time_out[id] = gametime + time_out;
- return PLUGIN_HANDLED;
- }
- ActionStealth(id, ent)
- {
- new Float:gametime = get_gametime();
- if ( !( gametime >= g_stealth_next_use[id] ) )
- {
- set_hudmessage(10, 150, 225, -1.0, 0.84, 0, 0.0, 0.1, 0.1, 0.1, 2);
- show_hudmessage(id, "Stealth^nNext Use %.1f", g_stealth_next_use[id] - gametime);
- return PLUGIN_HANDLED;
- }
- static property[5];
- set_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 0);
- emit_sound(id, CHAN_STATIC, g_sound_stealth, 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, "TaskRemoveStealth", TASK_STEALTH + id);
- GetProperty(ent, 2, property);
- g_stealth_next_use[id] = gametime + str_to_float(property);
- g_stealth_time_out[id] = gametime + time_out;
- return PLUGIN_HANDLED;
- }
- ActionBootsOfSpeed(id, ent)
- {
- new Float:gametime = get_gametime();
- if ( !( gametime >= g_boots_next_use[id] ) )
- {
- set_hudmessage(10, 150, 225, -1.0, 0.84, 0, 0.0, 0.1, 0.1, 0.1, 2);
- show_hudmessage(id, "Boots of Speed^nNext Use %.1f", g_boots_next_use[id] - gametime);
- return PLUGIN_HANDLED;
- }
- remove_task(TASK_BOOTSOFSPEED + id);
- static property[5];
- GetProperty(ent, 5, property);
- entity_set_float(id, EV_FL_maxspeed, str_to_float(property));
- emit_sound(id, CHAN_STATIC, g_sound_boots_of_speed, 1.0, ATTN_NORM, 0, PITCH_NORM);
- g_boots_of_speed[id] = ent;
- static Float:time_out;
- GetProperty(ent, 1, property);
- time_out = str_to_float(property);
- set_task(time_out, "TaskRemoveBootsOfSpeed", TASK_BOOTSOFSPEED + id);
- GetProperty(ent, 2, property);
- g_boots_next_use[id] = gametime + str_to_float(property);
- g_boots_time_out[id] = gametime + time_out;
- return PLUGIN_HANDLED;
- }
- ActionGrenade(id, ent, block_type)
- {
- new property[5];
- GetProperty(ent, 1, property);
- switch(block_type)
- {
- case HE:
- {
- if ( !( get_gametime() >= g_he_next_use[id]) )
- {
- set_hudmessage(10, 150, 225, -1.0, 0.84, 0, 0.0, 0.1, 0.1, 0.1, 2);
- show_hudmessage(id, "He Grenade^nNext Use: %.1f", g_he_next_use[id] - get_gametime());
- }
- else
- {
- if (user_has_weapon( id, CSW_HEGRENADE ))
- {
- set_hudmessage(10, 150, 225, -1.0, 0.84, 0, 0.0, 0.1, 0.1, 0.1, 2);
- show_hudmessage(id, "Use Your HE Grenade before you take another one ..");
- }
- else
- {
- if (cs_get_user_team(id) != CS_TEAM_T)
- {
- set_hudmessage(10, 150, 225, -1.0, 0.84, 0, 0.0, 0.1, 0.1, 0.1, 2);
- show_hudmessage(id, "This block is for Terrorists Only !");
- }
- else
- {
- give_item(id, "weapon_hegrenade");
- g_he_next_use[id] = get_gametime() + str_to_float(property);
- GetProperty(ent, 5, property);
- if(str_to_num(property) == 1)
- {
- new origin[3];
- get_user_origin(id, origin);
- Effect(origin, 255, 0, 0);
- }
- }
- }
- }
- }
- case FROST:
- {
- if ( !( get_gametime() >= g_frost_next_use[id]) )
- {
- set_hudmessage(10, 150, 225, -1.0, 0.84, 0, 0.0, 0.1, 0.1, 0.1, 2);
- show_hudmessage(id, "Frost Nade^nNext Use: %.1f", g_frost_next_use[id] - get_gametime());
- }
- else
- {
- if (user_has_weapon( id, CSW_SMOKEGRENADE))
- {
- set_hudmessage(10, 150, 225, -1.0, 0.84, 0, 0.0, 0.1, 0.1, 0.1, 2);
- show_hudmessage(id, "Use Your Frost Nade before you take another one ..");
- }
- else
- {
- if (cs_get_user_team(id) != CS_TEAM_T)
- {
- set_hudmessage(10, 150, 225, -1.0, 0.84, 0, 0.0, 0.1, 0.1, 0.1, 2);
- show_hudmessage(id, "This block is for Terrorists Only !");
- }
- else
- {
- give_item(id, "weapon_smokegrenade");
- g_frost_next_use[id] = get_gametime() + str_to_float(property);
- GetProperty(ent, 5, property);
- if(str_to_num(property) == 1)
- {
- new origin[3];
- get_user_origin(id, origin);
- Effect(origin, 0, 138, 255);
- }
- }
- }
- }
- }
- case FLASHBANG:
- {
- if ( !( get_gametime() >= g_flash_next_use[id]) )
- {
- set_hudmessage(10, 150, 225, -1.0, 0.84, 0, 0.0, 0.1, 0.1, 0.1, 2);
- show_hudmessage(id, "Flashbang^nNext Use: %.1f", g_flash_next_use[id] - get_gametime());
- }
- else
- {
- if (cs_get_user_bpammo(id, CSW_FLASHBANG) == 2)
- {
- set_hudmessage(10, 150, 225, -1.0, 0.84, 0, 0.0, 0.1, 0.1, 0.1, 2);
- show_hudmessage(id, "Use Your Flashbang before you take another one ..");
- }
- else
- {
- if (cs_get_user_team(id) != CS_TEAM_T)
- {
- set_hudmessage(10, 150, 225, -1.0, 0.84, 0, 0.0, 0.1, 0.1, 0.1, 2);
- show_hudmessage(id, "This block is for Terrorists Only !");
- }
- else
- {
- give_item(id, "weapon_flashbang");
- g_flash_next_use[id] = get_gametime() + str_to_float(property);
- GetProperty(ent, 5, property);
- if(str_to_num(property) == 1)
- {
- new origin[3];
- get_user_origin(id, origin);
- Effect(origin, 255, 255, 255);
- }
- }
- }
- }
- }
- }
- }
- ActionMoney(id, ent)
- {
- new property1[5], property2[5];
- GetProperty(ent, 1, property1);
- GetProperty(ent, 2, property2);
- if ( !( get_gametime() >= g_money_next_use[id]) )
- {
- set_hudmessage(10, 150, 225, -1.0, 0.84, 0, 0.0, 0.1, 0.1, 0.1, 2);
- show_hudmessage(id, "Money^nNext Use: %.1f", g_money_next_use[id] - get_gametime());
- }
- else
- {
- if (cs_get_user_team(id) != CS_TEAM_T)
- {
- set_hudmessage(10, 150, 225, -1.0, 0.84, 0, 0.0, 0.1, 0.1, 0.1, 2);
- show_hudmessage(id, "This block is for Terrorists Only !");
- }
- else
- {
- cs_set_user_money(id, cs_get_user_money(id) + str_to_num(property1), 1);
- g_money_next_use[id] = get_gametime() + str_to_float(property2);
- }
- }
- }
- #if defined USE_XPBLOCK
- ActionXp(id, ent)
- {
- new property1[5], property2[5];
- GetProperty(ent, 1, property1);
- GetProperty(ent, 2, property2);
- if ( !( get_gametime() >= g_xp_next_use[id]) )
- {
- set_hudmessage(10, 150, 225, -1.0, 0.84, 0, 0.0, 0.1, 0.1, 0.1, 2);
- show_hudmessage(id, "XP Block^nNext Use: %.1f", g_xp_next_use[id] - get_gametime());
- }
- else
- {
- if (cs_get_user_team(id) != CS_TEAM_T)
- {
- set_hudmessage(10, 150, 225, -1.0, 0.84, 0, 0.0, 0.1, 0.1, 0.1, 2);
- show_hudmessage(id, "This block is for Terrorists Only !");
- }
- else
- {
- hnsxp_set_user_xp(id, hnsxp_get_user_xp(id) + str_to_num(property1));
- g_xp_next_use[id] = get_gametime() + str_to_float(property2);
- ColorChat(id, "You gained^3 %d XP!", str_to_num(property1));
- }
- }
- }
- #endif
- public ActionDuck( id, ent )
- {
- entity_set_int(id, EV_INT_bInDuck, 15);
- new szProperty1[33];
- GetProperty(ent, 1, szProperty1);
- if( !equal( szProperty1, "0" ) && szProperty1[0] != '/' )
- if ( !task_exists(TASK_SOLIDNOT + ent))
- set_task(str_to_float(szProperty1), "TaskSolidNot", TASK_SOLIDNOT + ent);
- }
- ActionGun(id, ent, block_type)
- {
- new property1[5], property2[5];
- GetProperty(ent, 1, property1);
- GetProperty(ent, 2, property2);
- switch(block_type)
- {
- case DEAGLE:
- {
- if ( !( get_gametime() >= g_deagle_next_use[id]) )
- {
- set_hudmessage(10, 150, 225, -1.0, 0.84, 0, 0.0, 0.1, 0.1, 0.1, 2);
- show_hudmessage(id, "Deagle^nNext Use: %.1f", g_deagle_next_use[id] - get_gametime());
- }
- else
- {
- if(user_has_weapon(id, CSW_DEAGLE))
- {
- set_hudmessage(10, 150, 225, -1.0, 0.84, 0, 0.0, 0.1, 0.1, 0.1, 2);
- show_hudmessage(id, "You already have this weapon!");
- }
- else
- {
- if (cs_get_user_team(id) != CS_TEAM_T)
- {
- set_hudmessage(10, 150, 225, -1.0, 0.84, 0, 0.0, 0.1, 0.1, 0.1, 2);
- show_hudmessage(id, "This block is for Terrorists Only !");
- }
- else
- {
- cs_set_user_bpammo(id, CSW_DEAGLE, 0);
- cs_set_weapon_ammo(give_item(id, "weapon_deagle"), str_to_num(property1));
- g_deagle_next_use[id] = get_gametime() + str_to_float(property2);
- GetProperty(ent, 5, property1);
- if(str_to_num(property1) == 1)
- {
- new origin[3];
- get_user_origin(id, origin);
- Effect(origin, 0, 255, 255);
- }
- }
- }
- }
- }
- case AWP:
- {
- if ( !( get_gametime() >= g_awp_next_use[id]) )
- {
- set_hudmessage(10, 150, 225, -1.0, 0.84, 0, 0.0, 0.1, 0.1, 0.1, 2);
- show_hudmessage(id, "Awp^nNext Use: %.1f", g_awp_next_use[id] - get_gametime());
- }
- else
- {
- if(user_has_weapon(id, CSW_AWP))
- {
- set_hudmessage(10, 150, 225, -1.0, 0.84, 0, 0.0, 0.1, 0.1, 0.1, 2);
- show_hudmessage(id, "You already have this weapon!");
- }
- else
- {
- if (cs_get_user_team(id) != CS_TEAM_T)
- {
- set_hudmessage(10, 150, 225, -1.0, 0.84, 0, 0.0, 0.1, 0.1, 0.1, 2);
- show_hudmessage(id, "This block is for Terrorists Only !");
- }
- else
- {
- cs_set_user_bpammo(id, CSW_AWP, 0);
- cs_set_weapon_ammo(give_item(id, "weapon_awp"), str_to_num(property1));
- g_awp_next_use[id] = get_gametime() + str_to_float(property2);
- GetProperty(ent, 5, property1);
- if(str_to_num(property1) == 1)
- {
- new origin[3];
- get_user_origin(id, origin);
- Effect(origin, 0, 255, 0);
- }
- }
- }
- }
- }
- case ak:
- {
- if ( !( get_gametime() >= g_ak_next_use[id]) )
- {
- set_hudmessage(10, 150, 225, -1.0, 0.84, 0, 0.0, 0.1, 0.1, 0.1, 2);
- show_hudmessage(id, "AK^nNext Use: %.1f", g_ak_next_use[id] - get_gametime());
- }
- else
- {
- if(user_has_weapon(id, CSW_AK47))
- {
- set_hudmessage(10, 150, 225, -1.0, 0.84, 0, 0.0, 0.1, 0.1, 0.1, 2);
- show_hudmessage(id, "You already have this weapon!");
- }
- else
- {
- if (cs_get_user_team(id) != CS_TEAM_T)
- {
- set_hudmessage(10, 150, 225, -1.0, 0.84, 0, 0.0, 0.1, 0.1, 0.1, 2);
- show_hudmessage(id, "This block is for Terrorists Only !");
- }
- else
- {
- cs_set_user_bpammo(id, CSW_AK47, 0);
- cs_set_weapon_ammo(give_item(id, "weapon_AK47"), str_to_num(property1));
- g_ak_next_use[id] = get_gametime() + str_to_float(property2);
- GetProperty(ent, 5, property1);
- if(str_to_num(property1) == 1)
- {
- new origin[3];
- get_user_origin(id, origin);
- Effect(origin, 0, 255, 0);
- }
- }
- }
- }
- }
- }
- }
- ActionSuperman(id, ent)
- {
- static property[5];
- GetProperty(ent, 5, property);
- if ( !( get_gametime() >= g_superman_next_use[id] ) )
- {
- set_hudmessage(10, 150, 225, -1.0, 0.84, 0, 0.0, 0.1, 0.1, 0.1, 2);
- show_hudmessage(id, "Superman^nNext Use %.1f", g_superman_next_use[id] - get_gametime());
- }
- else
- {
- entity_set_float(id, EV_FL_gravity, str_to_float(property) / 800);
- g_superman[id] = ent;
- static Float:time_out;
- GetProperty(ent, 1, property);
- time_out = str_to_float(property);
- set_task(str_to_float(property), "TaskRemoveSuperman", TASK_SUPERMAN + id);
- GetProperty(ent, 2, property);
- g_superman_time_out[id] = get_gametime() + time_out;
- g_superman_next_use[id] = get_gametime() + str_to_float(property);
- }
- }
- ActionMagic(id, ent)
- {
- new Float:vVelocity[3];
- static Float:TimeOut;
- static property[5];
- set_hudmessage(10, 150, 225, -1.0, 0.84, 0, 0.0, 0.1, 0.1, 0.1, 2);
- GetProperty(ent, 1, property);
- switch(str_to_num(property))
- {
- case 1:
- {
- if(cs_get_user_team(id) == CS_TEAM_T)
- {
- GetProperty(ent, 2, property);
- TimeOut = str_to_float(property);
- new task_id = TASK_MOVEBACK + ent;
- new Float:gametime = get_gametime();
- if ( !task_exists(task_id) )
- {
- g_magic_time_out[id] = gametime + TimeOut;
- set_task(TimeOut, "TaskMoveBack", task_id);
- }
- pev(id, pev_velocity, vVelocity);
- vVelocity[2] = 0.0;
- set_pev(ent, pev_velocity, vVelocity);
- }
- else
- {
- show_hudmessage(id, "This block is for Terrorists Only !");
- }
- }
- case 2:
- {
- if(cs_get_user_team(id) == CS_TEAM_CT)
- {
- GetProperty(ent, 2, property);
- TimeOut = str_to_float(property);
- new task_id = TASK_MOVEBACK + ent;
- new Float:gametime = get_gametime();
- if ( !task_exists(task_id) )
- {
- g_magic_time_out[id] = gametime + TimeOut;
- set_task(TimeOut, "TaskMoveBack", task_id);
- }
- pev(id, pev_velocity, vVelocity);
- vVelocity[2] = 0.0;
- set_pev(ent, pev_velocity, vVelocity);
- }
- else
- {
- show_hudmessage(id, "This block is for Counter-Terrorists Only !");
- }
- }
- default:
- {
- GetProperty(ent, 2, property);
- TimeOut = str_to_float(property);
- new task_id = TASK_MOVEBACK + ent;
- new Float:gametime = get_gametime();
- if ( !task_exists(task_id) )
- {
- g_magic_time_out[id] = gametime + TimeOut;
- set_task(TimeOut, "TaskMoveBack", task_id);
- }
- pev(id, pev_velocity, vVelocity);
- vVelocity[2] = 0.0;
- set_pev(ent, pev_velocity, vVelocity);
- }
- }
- GetProperty(ent, 5, property);
- if( str_to_num( property ) > 0 )
- {
- GetProperty(ent, 2, property);
- if ( !task_exists(TASK_SOLIDNOT + ent))
- set_task(str_to_float(property), "TaskSolidNot", TASK_SOLIDNOT + ent);
- }
- }
- ActionMove( id, ent )
- {
- new szProperty1[ 5 ];
- new szProperty2[ 5 ];
- new szProperty3[ 5 ];
- new szProperty4[ 5 ];
- new szProperty5[ 5 ];
- GetProperty( ent, 1, szProperty1 );
- GetProperty( ent, 2, szProperty2 );
- GetProperty( ent, 3, szProperty3 );
- GetProperty( ent, 4, szProperty4 );
- GetProperty( ent, 5, szProperty5 );
- new bool:bMovePlayer;
- switch( szProperty1[ 0 ] )
- {
- case '0': bMovePlayer = true;
- case '1'://, '4':
- {
- //set_task( szProperty1[ 0 ] == '1' ? 0.1 : 2.0, "TaskSolidNot", TASK_SOLIDNOT + ent );
- set_task( 0.1, "TaskSolidNot", TASK_SOLIDNOT + ent );
- }
- case '2':
- {
- entity_get_vector( id, EV_VEC_velocity, g_set_velocity[ id ] );
- g_set_velocity[ id ][ 2 ] = 300.0;
- entity_set_int( id, EV_INT_gaitsequence, 6 );
- g_nfd[id] = true;
- }
- case '3':
- {
- if ( !get_user_godmode(id) )
- {
- fakedamage(id, "The Block of Death", 10000.0, DMG_GENERIC);
- }
- }
- case '4':
- {
- set_task( 3.0, "TaskSolidNot", TASK_SOLIDNOT + ent );
- bMovePlayer = true;
- }
- }
- if( bMovePlayer && szProperty4[ 0 ] == '1' )
- {
- /*new Float:e_fVelocity[ 3 ];
- new Float:p_fVelocity[ 3 ];
- entity_get_vector( ent, EV_VEC_velocity, e_fVelocity );
- entity_get_vector( id, EV_VEC_velocity, p_fVelocity );
- e_fVelocity[ 0 ] += p_fVelocity[ 0 ];
- e_fVelocity[ 1 ] += p_fVelocity[ 1 ];
- e_fVelocity[ 2 ] += p_fVelocity[ 2 ];
- g_set_velocity[ id ] = e_fVelocity;*/
- new Float:origin[ 3 ];
- entity_get_vector( id, EV_VEC_origin, origin );
- new reverse = entity_get_int( ent, EV_INT_weaponanim );
- new direction = str_to_num( szProperty3 );
- new Float:speed = str_to_float( szProperty5 );
- speed = ( speed / 1000 ) * 10;
- if( reverse == 1 )
- {
- if( str_to_num( szProperty2 ) < 0 )
- {
- origin[ direction ] += speed;
- }
- else
- {
- origin[ direction ] -= speed;
- }
- }
- else
- {
- if( str_to_num( szProperty2 ) < 0 )
- {
- origin[ direction ] -= speed;
- }
- else
- {
- origin[ direction ] += speed;
- }
- }
- new iHull = pev( id, pev_flags ) & FL_DUCKING ? HULL_HEAD : HULL_HUMAN;
- if( is_hull_vacant( origin, iHull, id ) ) // check if player will not get stuck in a wall or something solid
- {
- entity_set_vector( id, EV_VEC_origin, origin );
- }
- }
- }
- public ChangeMoveBlockModel( ent, const type[ ] )
- {
- new block_model[ 256 ];
- new block_type;
- block_type = ( type[ 0 ] == '0' ? MOVE : type[ 0 ] == '1' ? BUNNYHOP : type[ 0 ] == '2' ? TRAMPOLINE : type[ 0 ] == '3' ? DEATH : DELAY_BHOP );
- /* get size */
- new Float:fSizeMin[3];
- new Float:fSizeMax[3];
- new Float:fMax;
- new iSize = SMALL;
- entity_get_vector(ent, EV_VEC_maxs, fSizeMax);
- entity_get_vector(ent, EV_VEC_mins, fSizeMin);
- fMax = fSizeMax[0] + fSizeMax[1] + fSizeMax[2];
- if ( fMax > 36.0 ) iSize = POLE;
- if ( fMax > 64.0 ) iSize = NORMAL;
- if ( fMax > 128.0 ) iSize = LARGE;
- if ( fMax > 192.0 ) iSize = EXTRA_LARGE;
- if ( fMax > 256.0 ) iSize = JUMBO;
- /* get size */
- switch( iSize )
- {
- case SMALL: SetBlockModelNameSmall(block_model, BlockModels[block_type], 256);
- case NORMAL: block_model = BlockModels[block_type];
- case LARGE: SetBlockModelNameLarge(block_model, BlockModels[block_type], 256);
- case POLE: SetBlockModelNamePole(block_model, BlockModels[block_type], 256);
- case EXTRA_LARGE: SetBlockModelNameExtraLarge(block_model, BlockModels[block_type], 256);
- case JUMBO: SetBlockModelNameJumbo(block_model, BlockModels[block_type], 256);
- }
- entity_set_model( ent, block_model );
- entity_set_size( ent, fSizeMin, fSizeMax );
- }
- ActionTeleport(id, ent)
- {
- new tele = entity_get_int(ent, EV_INT_iuser1);
- if ( !tele ) return PLUGIN_HANDLED;
- static Float:tele_origin[3];
- entity_get_vector(tele, EV_VEC_origin, tele_origin);
- if( is_user_alive( id ) )
- {
- new player = -1;
- do
- {
- player = find_ent_in_sphere(player, tele_origin, 16.0);
- if ( !is_user_alive(player)
- || player == id
- || cs_get_user_team(id) == cs_get_user_team(player) ) continue;
- user_kill(player, 1);
- }
- while ( player );
- }
- new property[2][5];
- GetProperty(ent, 1, property[0]);
- GetProperty(ent, 2, property[1]);
- entity_set_vector(id, EV_VEC_origin, tele_origin);
- static Float:velocity[3];
- entity_get_vector(id, EV_VEC_velocity, velocity);
- velocity[2] = floatabs(velocity[2]);
- entity_set_vector(id, EV_VEC_velocity, velocity);
- return PLUGIN_HANDLED;
- }
- 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
- {
- new block_type = entity_get_int(ent, EV_INT_body);
- static property[5];
- GetProperty(ent, 3, property);
- set_rendering(ent, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, block_type == MOVE ? 255 : str_to_num(property));
- if( block_type == BUNNYHOP )
- {
- GetProperty(ent, 5, property);
- if( str_to_num( property ) > 0 )
- {
- set_rendering(ent, kRenderFxGlowShell, 139, 69, 19, kRenderNormal, 16);
- }
- }
- }
- return PLUGIN_HANDLED;
- }
- public TaskNotOnIce(id)
- {
- id -= TASK_ICE;
- g_ice[id] = false;
- if ( !is_user_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);
- }
- */
- ResetMaxspeed(id);
- entity_set_float(id, EV_FL_maxspeed, 250.0);
- entity_set_float(id, EV_FL_friction, 1.0);
- return PLUGIN_HANDLED;
- }
- public TaskBhopNotOnIce(id)
- {
- id -= TASK_ICE;
- g_ice[id] = false;
- if ( !is_user_alive(id) ) return PLUGIN_HANDLED;
- ResetMaxspeed(id);
- entity_set_float(id, EV_FL_maxspeed, 250.0);
- entity_set_float(id, EV_FL_friction, 1.0);
- return PLUGIN_HANDLED;
- }
- public TaskNotInHoney(id)
- {
- id -= TASK_HONEY;
- g_honey[id] = 0;
- if ( !is_user_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);
- }
- */
- ResetMaxspeed(id);
- return PLUGIN_HANDLED;
- }
- public TaskRemoveInvincibility(id)
- {
- id -= TASK_INVINCIBILITY;
- if( !is_user_alive( id ) )
- return PLUGIN_HANDLED;
- set_user_godmode(id, 0);
- set_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 16);
- return PLUGIN_HANDLED;
- }
- public TaskRemoveStealth(id)
- {
- id -= TASK_STEALTH;
- if ( is_user_connected(id) && is_user_alive(id) )
- {
- set_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 255);
- }
- }
- public TaskRemoveBootsOfSpeed(id)
- {
- id -= TASK_BOOTSOFSPEED;
- g_boots_of_speed[id] = 0;
- if ( !is_user_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 TaskRemoveSuperman(id)
- {
- id -= TASK_SUPERMAN;
- g_superman[id] = 0;
- if ( !is_user_alive(id) ) return PLUGIN_HANDLED;
- else
- {
- entity_set_float(id, EV_FL_gravity, 800.0 / 800);
- }
- return PLUGIN_HANDLED;
- }
- public TaskMoveBack(iEntity)
- {
- iEntity -= TASK_MOVEBACK;
- if ( !is_valid_ent(iEntity)
- || entity_get_int(iEntity, EV_INT_iuser2) ) return PLUGIN_HANDLED;
- new Float:origin[3];
- pev(iEntity, pev_v_angle, origin);
- set_pev(iEntity, pev_velocity, Float:{0.0, 0.0, 0.0});
- engfunc(EngFunc_SetOrigin, iEntity, origin);
- return PLUGIN_HANDLED;
- }
- public CmdSaveCheckpoint(id)
- {
- if ( !(get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- {
- console_print(id, "You have no access to that command");
- return PLUGIN_HANDLED;
- }
- else if ( !is_user_alive(id) )
- {
- ColorChat(id, "You have to be alive to save a checkpoint!");
- return PLUGIN_HANDLED;
- }
- else if ( get_user_noclip(id) )
- {
- ColorChat(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 ) )
- {
- ColorChat(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, LastCheckpoint[id]);
- ColorChat(id, "Checkpoint saved!");
- AdminMenu(id);
- return PLUGIN_HANDLED;
- }
- public CmdLoadCheckpoint(id)
- {
- if ( !(get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- {
- console_print(id, "You have no access to that command");
- return PLUGIN_HANDLED;
- }
- else if ( !is_user_alive(id) )
- {
- ColorChat(id, "You have to be alive to save a checkpoint!");
- return PLUGIN_HANDLED;
- }
- else if ( !LastCheckpoint[id][0] )
- {
- ColorChat(id, "You don't have a checkpoint!");
- return PLUGIN_HANDLED;
- }
- static Float:origin[3];
- for ( new i = 1; i <= get_maxplayers(); i++ )
- {
- if ( i == id
- || !is_user_alive(i) ) continue;
- entity_get_vector(id, EV_VEC_origin, origin);
- if ( get_distance_f(LastCheckpoint[id], origin) <= 35.0 )
- {
- if ( cs_get_user_team(i) == cs_get_user_team(id) ) continue;
- ColorChat(id, "Somebody is too close to your checkpoint!");
- return PLUGIN_HANDLED;
- }
- }
- entity_set_vector(id, EV_VEC_origin, LastCheckpoint[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 ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- {
- console_print(id, "You have no access to that command");
- return PLUGIN_HANDLED;
- }
- else if ( is_user_alive(id) )
- {
- ColorChat(id, "You are already alive!");
- return PLUGIN_HANDLED;
- }
- ExecuteHam(Ham_CS_RoundRespawn, id);
- ColorChat(id, "You have revived yourself!");
- static name[32];
- get_user_name(id, name, charsmax(name));
- for ( new i = 1; i <= get_maxplayers(); i++ )
- {
- if ( !is_user_connected(i)
- && i == id ) continue;
- ColorChat(i, "^1%s^3 revived himself!", name);
- }
- return PLUGIN_HANDLED;
- }
- CmdRevivePlayer(id)
- {
- if ( !(get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- {
- console_print(id, "You have no access to that command");
- return PLUGIN_HANDLED;
- }
- client_cmd(id, "messagemode pG_Revive");
- ColorChat(id, "Type the name of the client that you want to revive.");
- return PLUGIN_HANDLED;
- }
- public RevivePlayer(id)
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !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 ( get_user_flags(target) & BM_ACCESS || g_gived_access[id])
- {
- ColorChat(id, "^1%s^3 is admin, he can revive himself!", target_name);
- return PLUGIN_HANDLED;
- }
- else if ( is_user_alive(target) )
- {
- ColorChat(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));
- ColorChat(id, "You revived^1 %s^3!", target_name);
- for ( new i = 1; i <= get_maxplayers(); i++ )
- {
- if ( !is_user_connected(i)
- && i == id
- && i == target ) continue;
- ColorChat(i, "^1%s^3 revived^1 %s^3!", admin_name, target_name);
- }
- ColorChat(target, "You have been revived by^1 %s^3!", admin_name);
- return PLUGIN_HANDLED;
- }
- CmdReviveEveryone(id)
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- {
- console_print(id, "You have no access to that command");
- return PLUGIN_HANDLED;
- }
- for ( new i = 1; i <= get_maxplayers(); i++ )
- {
- if ( is_user_alive( i ) || !is_user_connected( i ) )
- continue;
- ExecuteHam(Ham_CS_RoundRespawn, i);
- }
- static admin_name[32];
- get_user_name(id, admin_name, charsmax(admin_name));
- ColorChat(0, "^1%s^3 revived everyone!", admin_name);
- return PLUGIN_HANDLED;
- }
- CmdSpecRevive( id )
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- {
- console_print(id, "You have no access to that command");
- return PLUGIN_HANDLED;
- }
- cs_set_user_team( id, CS_TEAM_SPECTATOR );
- ExecuteHam( Ham_CS_RoundRespawn, id );
- ColorChat( id, "You moved to^x04 spectator^x01 team and^x04 revived^x01!" );
- return PLUGIN_HANDLED;
- }
- ToggleAllGodmode(id)
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- {
- console_print(id, "You have no access to that command");
- return PLUGIN_HANDLED;
- }
- for ( new i = 1; i <= get_maxplayers(); i++ )
- {
- if ( !is_user_connected(i) ) continue;
- if ( is_user_alive(i)
- && !(get_user_flags(i) & BM_ACCESS) && !g_gived_access[id])
- {
- entity_set_float(i, EV_FL_takedamage, g_all_godmode ? DAMAGE_AIM : DAMAGE_NO);
- }
- AdminMenu(id);
- }
- g_all_godmode = !g_all_godmode;
- static admin_name[32];
- get_user_name(id, admin_name, charsmax(admin_name));
- if ( g_all_godmode ) ColorChat(0, "^1%s^3 set godmode on everyone!", admin_name);
- else ColorChat(0, "^1%s^3 removed godmode from everyone!", admin_name);
- return PLUGIN_HANDLED;
- }
- CmdGiveAccess(id)
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- {
- console_print(id, "You have no access to that command");
- return PLUGIN_HANDLED;
- }
- client_cmd(id, "messagemode pG_GiveAccess");
- ColorChat(id, "Type the name of the client that you want to give access to blockmaker.");
- return PLUGIN_HANDLED;
- }
- public GiveAccess(id)
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !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;
- static target_name[32];
- get_user_name(target, target_name, charsmax(target_name));
- if ( ( get_user_flags(target) & BM_ACCESS) || g_gived_access[target])
- {
- ColorChat(id, "^1%s^3 already have access to blockmaker!", target_name);
- return PLUGIN_HANDLED;
- }
- g_gived_access[target] = true;
- ColorChat(id, "You gived^1 %s^3 access to blockmaker!", target_name);
- static admin_name[32];
- get_user_name(id, admin_name, charsmax(admin_name));
- ColorChat(target, "^1%s^3 has gived you access to blockmaker! Type^1 /bm^3 to bring up the Main Menu.", admin_name);
- for ( new i = 1; i <= get_maxplayers(); i++ )
- {
- if ( i == id
- && i == target
- && !is_user_connected(i) ) continue;
- ColorChat(i, "^1%s^3 gived^1 %s^3 access to blockmaker!", admin_name, target_name);
- }
- return PLUGIN_HANDLED;
- }
- public CreateBlockAiming(const id, const block_type, const size)
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- return PLUGIN_HANDLED;
- static origin[3];
- static Float:float_origin[3];
- get_user_origin(id, origin, 3);
- IVecFVec(origin, float_origin);
- float_origin[2] += 4.0;
- new szCreator[64];
- get_user_name(id, szCreator, 63);
- replace_all(szCreator, 63, " ", "_");
- new Float:Angles[3];
- new Float:Max[3];
- new Float:Min[3];
- CreateBlock(id,\
- block_type,\
- float_origin,\
- Z,\
- size,\
- Property1DefaultValue[block_type],\
- Property2DefaultValue[block_type],\
- Property3DefaultValue[block_type],\
- Property4DefaultValue[block_type],\
- Property5DefaultValue[block_type],\
- Angles,\
- szCreator,\
- true,\
- Max,\
- Min
- );
- return PLUGIN_HANDLED;
- }
- CreateBlock(const id, const block_type, Float:origin[3], const axis, const size, const Property1[], const Property2[], const Property3[], const Property4[], const Property5[], const Float:angles1[3], szCreator[] = "Unknown Creator", bool:Player = true, const Float:Max[3], const Float:Min[3], bool:Use = false )
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id] && id != 0)
- return PLUGIN_HANDLED;
- 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, block_type == MOVE ? MOVETYPE_FLY : 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 SMALL:
- {
- SetBlockModelNameSmall(block_model, BlockModels[block_type], 256);
- scale = 0.25;
- }
- case NORMAL:
- {
- block_model = BlockModels[block_type];
- scale = 1.0;
- }
- case LARGE:
- {
- SetBlockModelNameLarge(block_model, BlockModels[block_type], 256);
- scale = 2.0;
- }
- case POLE:
- {
- SetBlockModelNamePole(block_model, BlockModels[block_type], 256);
- scale = 1.0;
- }
- case EXTRA_LARGE:
- {
- SetBlockModelNameExtraLarge(block_model, BlockModels[block_type], 256);
- scale = 3.0;
- }
- case JUMBO:
- {
- SetBlockModelNameJumbo(block_model, BlockModels[block_type], 256);
- scale = 6.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;
- }
- }
- SetProperty(ent, 1, Property1);
- SetProperty(ent, 2, Property2);
- SetProperty(ent, 3, Property3);
- SetProperty(ent, 4, Property4);
- SetProperty(ent, 5, Property5);
- if ( Player )
- {
- drop_to_floor( ent );
- if ( 1 <= id <= get_maxplayers() )
- {
- DoSnapping(id, ent, origin, true);
- }
- }
- if( block_type == MOVE )
- {
- new fake_block_type;
- fake_block_type = ( Property1[ 0 ] == '0' ? MOVE : Property1[ 0 ] == '1' ? BUNNYHOP : Property1[ 0 ] == '2' ? TRAMPOLINE : Property1[ 0 ] == '3' ? DEATH : DELAY_BHOP );
- switch ( size )
- {
- case SMALL: SetBlockModelNameSmall(block_model, BlockModels[fake_block_type], 256);
- case NORMAL: block_model = BlockModels[fake_block_type];
- case LARGE: SetBlockModelNameLarge(block_model, BlockModels[fake_block_type], 256);
- case POLE: SetBlockModelNamePole(block_model, BlockModels[fake_block_type], 256);
- case EXTRA_LARGE: SetBlockModelNameExtraLarge(block_model, BlockModels[fake_block_type], 256);
- case JUMBO: SetBlockModelNameJumbo(block_model, BlockModels[fake_block_type], 256);
- }
- }
- entity_set_model(ent, block_model);
- entity_set_vector(ent, EV_VEC_angles, angles);
- entity_set_int(ent, EV_INT_body, block_type);
- entity_set_origin(ent, origin);
- entity_set_string(ent, EV_SZ_targetname, szCreator);
- entity_set_vector(ent, EV_VEC_vuser1, origin);
- entity_set_int(ent, EV_INT_iuser2, 0);
- if( size == POLE && Use )
- {
- entity_set_vector(ent, EV_VEC_angles, angles1);
- entity_set_size(ent, Min, Max);
- }
- else
- {
- entity_set_size(ent, size_min, size_max);
- }
- switch( block_type )
- {
- case GLASS: set_rendering(ent, kRenderFxNone, 255, 255, 255, kRenderTransAdd, 100);
- case MAGICCARPET:
- {
- set_pev(ent, pev_movetype, MOVETYPE_FLY);
- set_pev(ent, pev_v_angle, origin);
- }
- case BUNNYHOP:
- {
- if( str_to_num( Property5 ) > 0 )
- {
- set_rendering(ent, kRenderFxGlowShell, 139, 69, 19, kRenderNormal, 16);
- }
- }
- case MOVE:
- {
- new direction = str_to_num( Property3 );
- new Float:origin2[ 3 ];
- origin2 = origin;
- origin2[ direction ] += str_to_float( Property2 );
- MoveEntity( ent, str_to_float( Property5 ), origin, origin2, Property4[ 0 ] == '1' ? true : false );
- set_rendering(ent, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 255 );
- }
- }
- return ent;
- }
- DeleteBlockAiming(id)
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- 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;
- }
- DeleteBlock(id, ent);
- return PLUGIN_HANDLED;
- }
- bool:DeleteBlock(id, ent)
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- return false;
- if ( !IsBlock(ent) ) return false;
- if(IsBlockInGroup(id, ent))
- {
- static block;
- for ( new i = 0; i <= g_group_count[id]; ++i )
- {
- block = g_grouped_blocks[id][i];
- if ( !IsBlockInGroup(id, block) ) continue;
- remove_entity(block);
- }
- }
- else
- {
- SaveAction( id, ent );
- copy( g_szUndoStat[ id ], 39, "Recover Block" );
- remove_entity(ent);
- }
- return true;
- }
- public RotateBlockAiming(id)
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- return PLUGIN_HANDLED;
- static ent, body;
- get_user_aiming(id, ent, body);
- if ( !IsBlock(ent) ) return PLUGIN_HANDLED;
- RotateBlock(ent);
- return PLUGIN_HANDLED;
- }
- RotateBlock(ent)
- {
- if ( !is_valid_ent(ent) ) return false;
- static Float:angles[3];
- static Float:size_min[3];
- static Float:size_max[3];
- static Float:temp;
- entity_get_vector(ent, EV_VEC_angles, angles);
- entity_get_vector(ent, EV_VEC_mins, size_min);
- entity_get_vector(ent, EV_VEC_maxs, size_max);
- if ( angles[0] == 0.0 && angles[2] == 0.0 )
- {
- angles[0] = 90.0;
- }
- else if ( angles[0] == 90.0 && angles[2] == 0.0 )
- {
- angles[0] = 90.0;
- angles[2] = 90.0;
- }
- else
- {
- angles[0] = 0.0;
- angles[1] = 0.0;
- angles[2] = 0.0;
- }
- temp = size_min[0];
- size_min[0] = size_min[2];
- size_min[2] = size_min[1];
- size_min[1] = temp;
- temp = size_max[0];
- size_max[0] = size_max[2];
- size_max[2] = size_max[1];
- size_max[1] = temp;
- entity_set_vector(ent, EV_VEC_angles, angles);
- entity_set_size(ent, size_min, size_max);
- return true;
- }
- public CmdRotate(id)
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- return PLUGIN_HANDLED;
- if ( !IsBlock(BlockGrabbed[id]) ) return PLUGIN_HANDLED;
- if ( !IsBlockInGroup(id, BlockGrabbed[id])
- || g_group_count[id] < 2 )
- {
- RotateBlock(BlockGrabbed[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;
- }
- ConvertBlockAiming(id, const convert_to, const convert_size)
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- return PLUGIN_HANDLED;
- static ent, body, szCreator[64], szSize;
- get_user_aiming(id, ent, body);
- get_user_name(id, szCreator, 63);
- if ( !IsBlock(ent) ) return PLUGIN_HANDLED;
- new Float:angles[3], Float:maxs[3], Float:mins[3];
- pev( ent, pev_angles, angles );
- pev( ent, pev_maxs, maxs );
- pev( ent, pev_mins, mins );
- new Float:fMax = maxs[0] + maxs[1] + maxs[2];
- if ( fMax > 36.0 ) szSize = POLE;
- if ( fMax > 64.0 ) szSize = NORMAL;
- if ( fMax > 128.0 ) szSize = LARGE;
- if ( fMax > 192.0 ) szSize = EXTRA_LARGE;
- if ( fMax > 256.0 ) szSize = JUMBO;
- new block = ConvertBlock(id, ent, convert_to, convert_size, angles, szCreator, maxs, mins, szSize);
- if ( IsBlockStuck(block) )
- {
- new bool:deleted = DeleteBlock(id, block);
- if ( deleted ) client_print(id, print_chat, "Block deleted because it was stuck!");
- }
- return PLUGIN_HANDLED;
- }
- ConvertBlock(id, ent, const convert_to, const convert_size, const Float:angles[3], szCreator[64], const Float:maxs[3], const Float:mins[3], size)
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- return 0;
- SaveAction( id, ent );
- copy( g_szUndoStat[ id ], 39, "Recover Converted Block" );
- new axis;
- new Float:origin[3];
- new Float:size_max[3];
- get_user_name(id, szCreator, 63);
- replace_all(szCreator, 63, " ", "_");
- 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;
- }
- }
- DeleteBlock(id, ent);
- if ( convert_size == POLE && size == POLE || convert_size != POLE && size != POLE )
- {
- return CreateBlock(id,\
- convert_to,\
- origin,\
- axis,\
- convert_size,\
- Property1DefaultValue[convert_to],\
- Property2DefaultValue[convert_to],\
- Property3DefaultValue[convert_to],\
- Property4DefaultValue[convert_to],\
- Property5DefaultValue[convert_to],\
- angles,\
- szCreator,\
- true,\
- maxs,\
- mins,\
- true
- );
- }
- else
- {
- return CreateBlock(id,\
- convert_to,\
- origin,\
- axis,\
- convert_size,\
- Property1DefaultValue[convert_to],\
- Property2DefaultValue[convert_to],\
- Property3DefaultValue[convert_to],\
- Property4DefaultValue[convert_to],\
- Property5DefaultValue[convert_to],\
- angles,\
- szCreator,\
- true,\
- maxs,\
- mins,\
- false
- );
- }
- return 0;
- }
- CreateTeleportAiming(id, teleport_type)
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- return PLUGIN_HANDLED;
- static origin[3];
- static Float:float_origin[3];
- get_user_origin(id, origin, 3);
- IVecFVec(origin, float_origin);
- float_origin[2] += 36.0;
- new szCreator[64];
- get_user_name(id, szCreator, 63);
- replace_all(szCreator, 31, " ", "_");
- new const none[] = "0";
- CreateTeleport(id, teleport_type, none, none, float_origin, szCreator);
- return PLUGIN_HANDLED;
- }
- CreateTeleport(id, teleport_type, const property1[], const property2[], Float:origin[3], szCreator[] = "Unknown Creator")
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- return PLUGIN_HANDLED;
- new ent = create_entity("info_target");
- if ( !is_valid_ent(ent) ) return PLUGIN_HANDLED;
- switch ( teleport_type )
- {
- case TELEPORT_START:
- {
- if ( g_teleport_start[id] ) remove_entity(g_teleport_start[id]);
- entity_set_string(ent, EV_SZ_classname, g_start_classname);
- entity_set_string(ent, EV_SZ_targetname, szCreator);
- entity_set_int(ent, EV_INT_solid, SOLID_BBOX);
- entity_set_int(ent, EV_INT_movetype, MOVETYPE_NONE);
- entity_set_model(ent, szSpriteTeleportStart);
- entity_set_size(ent, Float:{ -16.0, -16.0, -16.0 }, Float:{ 16.0, 16.0, 16.0 });
- entity_set_origin(ent, origin);
- entity_set_int(ent, EV_INT_rendermode, 5);
- entity_set_float(ent, EV_FL_renderamt, 255.0);
- static params[2];
- params[0] = ent;
- params[1] = 6;
- set_task(0.1, "TaskSpriteNextFrame", TASK_SPRITE + ent, params, 2, "b");
- g_teleport_start[id] = ent;
- }
- case TELEPORT_END:
- {
- if ( !g_teleport_start[id] )
- {
- remove_entity(ent);
- return PLUGIN_HANDLED;
- }
- entity_set_string(ent, EV_SZ_classname, g_end_classname);
- entity_set_string(ent, EV_SZ_targetname, szCreator);
- entity_set_int(ent, EV_INT_solid, SOLID_BBOX);
- entity_set_int(ent, EV_INT_movetype, MOVETYPE_NONE);
- entity_set_model(ent, szSpriteTeleportEnd);
- entity_set_size(ent, Float:{ -16.0, -16.0, -16.0 }, Float:{ 16.0, 16.0, 16.0 });
- entity_set_origin(ent, origin);
- entity_set_int(ent, EV_INT_rendermode, 5);
- entity_set_float(ent, EV_FL_renderamt, 255.0);
- entity_set_int(ent, EV_INT_iuser1, g_teleport_start[id]);
- entity_set_int(g_teleport_start[id], EV_INT_iuser1, ent);
- entity_set_int(ent, EV_INT_iuser4, g_teleport_start[id]);
- static params[2];
- params[0] = ent;
- params[1] = 4;
- set_task(0.1, "TaskSpriteNextFrame", TASK_SPRITE + ent, params, 2, "b");
- g_teleport_start[id] = 0;
- }
- }
- SetProperty(ent, 1, property1);
- SetProperty(ent, 2, property2);
- return PLUGIN_HANDLED;
- }
- DeleteTeleportAiming(id)
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- return PLUGIN_HANDLED;
- static ent, body;
- get_user_aiming(id, ent, body, 9999);
- new bool:deleted = DeleteTeleport(id, ent);
- if ( deleted ) ColorChat(id, "Teleport deleted!");
- return PLUGIN_HANDLED;
- }
- bool:DeleteTeleport(id, ent)
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- return false;
- for ( new i = 0; i < 2; ++i )
- {
- if ( !IsTeleport(ent) ) return false;
- new tele = entity_get_int(ent, EV_INT_iuser1);
- if ( g_teleport_start[id] == ent
- || g_teleport_start[id] == tele )
- {
- g_teleport_start[id] = 0;
- }
- if ( task_exists(TASK_SPRITE + ent) )
- {
- remove_task(TASK_SPRITE + ent);
- }
- if ( task_exists(TASK_SPRITE + tele) )
- {
- remove_task(TASK_SPRITE + tele);
- }
- if ( tele ) remove_entity(tele);
- remove_entity(ent);
- return true;
- }
- return false;
- }
- SwapTeleportAiming(id)
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- return PLUGIN_HANDLED;
- static ent, body;
- get_user_aiming(id, ent, body, 9999);
- if ( !IsTeleport(ent) ) return PLUGIN_HANDLED;
- SwapTeleport(id, ent);
- return PLUGIN_HANDLED;
- }
- SwapTeleport(id, ent)
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- return PLUGIN_HANDLED;
- static Float:origin_ent[3];
- static Float:origin_tele[3];
- new tele = entity_get_int(ent, EV_INT_iuser1);
- if ( !is_valid_ent(tele) )
- {
- ColorChat(id, "Can't swap teleport positions!");
- return PLUGIN_HANDLED;
- }
- entity_get_vector(ent, EV_VEC_origin, origin_ent);
- entity_get_vector(tele, EV_VEC_origin, origin_tele);
- static classname[32], szCreator[64];
- entity_get_string(ent, EV_SZ_classname, classname, charsmax(classname));
- entity_get_string(ent, EV_SZ_targetname, szCreator, charsmax(szCreator));
- new property1[5], property2[5], teleproperty1[5], teleproperty2[5];
- GetProperty(ent, 1, property1);
- GetProperty(ent, 2, property2);
- GetProperty(ent, 1, teleproperty2);
- GetProperty(ent, 2, teleproperty2);
- DeleteTeleport(id, ent);
- new const none[] = "0";
- if ( equal(classname, g_start_classname) )
- {
- CreateTeleport(id, TELEPORT_START, property1, property2, origin_tele, szCreator);
- CreateTeleport(id, TELEPORT_END, none, none, origin_ent, szCreator);
- }
- else if ( equal(classname, g_end_classname) )
- {
- CreateTeleport(id, TELEPORT_START, teleproperty1, teleproperty2, origin_ent, szCreator);
- CreateTeleport(id, TELEPORT_END, none, none, origin_tele, szCreator);
- }
- ColorChat(id, "Teleports swapped!");
- return PLUGIN_HANDLED;
- }
- ShowTeleportPath(id)
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- return PLUGIN_HANDLED;
- static ent, body;
- get_user_aiming(id, ent, body);
- if ( !IsTeleport(ent) ) return PLUGIN_HANDLED;
- new tele = entity_get_int(ent, EV_INT_iuser1);
- if ( !tele ) return PLUGIN_HANDLED;
- static Float:origin1[3], Float:origin2[3], Float:dist;
- entity_get_vector(ent, EV_VEC_origin, origin1);
- entity_get_vector(tele, EV_VEC_origin, origin2);
- message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
- write_byte(TE_BEAMPOINTS);
- write_coord(floatround(origin1[0], floatround_floor));
- write_coord(floatround(origin1[1], floatround_floor));
- write_coord(floatround(origin1[2], floatround_floor));
- write_coord(floatround(origin2[0], floatround_floor));
- write_coord(floatround(origin2[1], floatround_floor));
- write_coord(floatround(origin2[2], floatround_floor));
- write_short(SpriteBeam);
- write_byte(0);
- write_byte(1);
- write_byte(50);
- write_byte(5);
- write_byte(0);
- write_byte(255);
- write_byte(255);
- write_byte(255);
- write_byte(255);
- write_byte(0);
- message_end();
- dist = get_distance_f(origin1, origin2);
- ColorChat(id, "A line has been drawn to show the teleport path. Distance:^1 %f units", dist);
- return PLUGIN_HANDLED;
- }
- bool:IsTeleport(ent, type = 0)
- {
- if ( !is_valid_ent(ent) ) return false;
- static classname[32];
- entity_get_string(ent, EV_SZ_classname, classname, charsmax(classname));
- switch(type)
- {
- case 0:
- {
- if ( equal(classname, g_start_classname)
- || equal(classname, g_end_classname) )
- {
- return true;
- }
- }
- case 1:
- {
- if ( equal(classname, g_start_classname) )
- {
- return true;
- }
- }
- case 2:
- {
- if ( equal(classname, g_end_classname) )
- {
- return true;
- }
- }
- }
- return false;
- }
- CreateLightAiming(const id)
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- return PLUGIN_HANDLED;
- static origin[3];
- static Float:float_origin[3];
- get_user_origin(id, origin, 3);
- IVecFVec(origin, float_origin);
- float_origin[2] += 4.0;
- new szCreator[64];
- get_user_name(id, szCreator, 63);
- replace_all(szCreator, 31, " ", "_");
- CreateLight(float_origin, "25", "255", "255", "255", szCreator);
- return PLUGIN_HANDLED;
- }
- CreateLight(Float:origin[3], const radius[], const color_red[], const color_green[], const color_blue[], szCreator[] = "Unknown Creator")
- {
- new ent = create_entity("info_target");
- if ( !is_valid_ent(ent) ) return 0;
- entity_set_origin(ent, origin);
- entity_set_model(ent, szSpriteLight);
- entity_set_float(ent, EV_FL_scale, 0.25);
- entity_set_string(ent, EV_SZ_classname, g_light_classname);
- entity_set_int(ent, EV_INT_solid, SOLID_BBOX);
- entity_set_int(ent, EV_INT_movetype, MOVETYPE_NONE);
- entity_set_size(ent, Float:{ -3.0, -3.0, -6.0 }, Float:{ 3.0, 3.0, 6.0 });
- static Float:color[3];
- color[0] = str_to_float(color_red);
- color[1] = str_to_float(color_green);
- color[2] = str_to_float(color_blue);
- entity_set_vector(ent, EV_VEC_rendercolor, color);
- SetProperty(ent, 1, radius);
- SetProperty(ent, 2, color_red);
- SetProperty(ent, 3, color_green);
- SetProperty(ent, 4, color_blue);
- entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.01);
- set_pev(ent, pev_targetname, szCreator, 31);
- return ent;
- }
- DeleteLightAiming(id)
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- return PLUGIN_HANDLED;
- static ent, body;
- get_user_aiming(id, ent, body);
- new grabber = entity_get_int(ent, EV_INT_iuser2);
- if ( grabber && grabber != id ) return PLUGIN_HANDLED;
- if(IsLight(ent))
- {
- DeleteLight(ent);
- }
- return PLUGIN_HANDLED;
- }
- bool:DeleteLight(ent)
- {
- if ( !IsLight(ent) ) return false;
- remove_entity(ent);
- return true;
- }
- SetPropertiesLightAiming(id)
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- return PLUGIN_HANDLED;
- static ent, body;
- get_user_aiming(id, ent, body);
- if ( !IsLight(ent) )
- {
- LightMenu(id);
- return PLUGIN_HANDLED;
- }
- LightPropertyMenu(id, ent);
- return PLUGIN_HANDLED;
- }
- public SetPropertyLight(id)
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- return PLUGIN_HANDLED;
- static arg[33];
- read_argv(1, arg, charsmax(arg));
- if ( !strlen(arg) )
- {
- ColorChat(id, "You can't set a property blank! Please type a new value.");
- client_cmd(id, "messagemode pG_SetLightProperty");
- return PLUGIN_HANDLED;
- }
- else if ( !is_str_num(arg) )
- {
- ColorChat(id, "You can't use letters in a property! Please type a new value.");
- client_cmd(id, "messagemode pG_SetLightProperty");
- return PLUGIN_HANDLED;
- }
- new ent = PropertyEnt[id];
- if ( !is_valid_ent(ent) )
- {
- ColorChat(id, "That light has been deleted!");
- LightMenu(id);
- return PLUGIN_HANDLED;
- }
- static property;
- static property_value;
- property = PropertyPicked[id];
- property_value = str_to_num(arg);
- if ( property == 1 )
- {
- if ( !( 1 <= property_value <= 50 ) )
- {
- ColorChat(id, "The property has to be between^1 1^3 and^1 50^3!");
- return PLUGIN_HANDLED;
- }
- }
- else if ( !( 0 <= property_value <= 255 ) )
- {
- ColorChat(id, "The property has to be between^1 0^3 and^1 255^3!");
- return PLUGIN_HANDLED;
- }
- SetProperty(ent, property, arg);
- if ( property != 1 )
- {
- static color_red[5], color_green[5], color_blue[5];
- GetProperty(ent, 2, color_red);
- GetProperty(ent, 3, color_green);
- GetProperty(ent, 4, color_blue);
- static Float:color[3];
- color[0] = str_to_float(color_red);
- color[1] = str_to_float(color_green);
- color[2] = str_to_float(color_blue);
- entity_set_vector(ent, EV_VEC_rendercolor, color);
- }
- LightPropertyMenu(id, ent);
- return PLUGIN_HANDLED;
- }
- public LightThink(ent)
- {
- static 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);
- static Float:float_origin[3];
- entity_get_vector(ent, EV_VEC_origin, float_origin);
- static origin[3];
- FVecIVec(float_origin, origin);
- message_begin(MSG_PVS, SVC_TEMPENTITY, origin, 0);
- write_byte(TE_DLIGHT);
- write_coord(origin[0]);
- write_coord(origin[1]);
- write_coord(origin[2]);
- write_byte(str_to_num(radius));
- write_byte(str_to_num(color_red));
- write_byte(str_to_num(color_green));
- write_byte(str_to_num(color_blue));
- write_byte(1); // life
- write_byte(1); // decay
- message_end();
- entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.01);
- }
- bool:IsLight(ent)
- {
- if ( !is_valid_ent(ent) ) return false;
- static classname[32];
- entity_get_string(ent, EV_SZ_classname, classname, charsmax(classname));
- if ( equal(classname, g_light_classname) )
- {
- return true;
- }
- return false;
- }
- bool:IsBlockStuck(ent)
- {
- if ( !is_valid_ent(ent) ) return false;
- new content;
- new Float:origin[3];
- new Float:point[3];
- new Float:size_min[3];
- new Float:size_max[3];
- entity_get_vector(ent, EV_VEC_mins, size_min);
- entity_get_vector(ent, EV_VEC_maxs, size_max);
- entity_get_vector(ent, EV_VEC_origin, origin);
- size_min[0] += 1.0;
- size_min[1] += 1.0;
- size_min[2] += 1.0;
- size_max[0] -= 1.0;
- size_max[1] -= 1.0;
- size_max[2] -= 1.0;
- for ( new i = 0; i < 14; ++i )
- {
- point = origin;
- switch ( i )
- {
- case 0: for(new i = 0; i < 2; i++) point[i] += size_max[i];
- case 1:
- {
- point[0] += size_min[0];
- point[1] += size_max[1];
- point[2] += size_max[2];
- }
- case 2:
- {
- point[0] += size_max[0];
- point[1] += size_min[1];
- point[2] += size_max[2];
- }
- case 3:
- {
- point[0] += size_min[0];
- point[1] += size_min[1];
- point[2] += size_max[2];
- }
- case 4:
- {
- point[0] += size_max[0];
- point[1] += size_max[1];
- point[2] += size_min[2];
- }
- case 5:
- {
- point[0] += size_min[0];
- point[1] += size_max[1];
- point[2] += size_min[2];
- }
- case 6:
- {
- point[0] += size_max[0];
- point[1] += size_min[1];
- point[2] += size_min[2];
- }
- case 7: for(new i = 0; i < 2; i++) point[i] += size_min[i];
- case 8: point[0] += size_max[0];
- case 9: point[0] += size_min[0];
- case 10: point[1] += size_max[1];
- case 11: point[1] += size_min[1];
- case 12: point[2] += size_max[2];
- case 13: point[2] += size_min[2];
- }
- content = point_contents(point);
- if ( content == CONTENTS_EMPTY
- || !content ) return false;
- }
- return true;
- }
- 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 cmd_Grab(id)
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- return PLUGIN_HANDLED;
- new ent, body;
- gfGrablength[id] = get_user_aiming(id, ent, body);
- new player = entity_get_int(ent, EV_INT_iuser1);
- new grabber = entity_get_int(ent, EV_INT_iuser2);
- if(!IsBlock(ent) && !IsTeleport(ent) && !IsLight(ent)) return PLUGIN_HANDLED;
- if ( grabber && grabber != id ) return PLUGIN_HANDLED;
- if(IsTeleport(ent) || IsLight(ent))
- {
- set_Grabbed(id, ent);
- return PLUGIN_HANDLED;
- }
- if ( player && player != id )
- {
- new player_name[32];
- get_user_name(player, player_name, charsmax(player_name));
- ColorChat(id, "^1%s^3 currently has this block in their group!", player_name);
- return PLUGIN_HANDLED;
- }
- set_Grabbed(id, ent);
- SaveAction( id, ent );
- copy( g_szUndoStat[ id ], 39, "Recover Moved Block" );
- 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;
- }
- set_Grabbed(id, ent)
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- return PLUGIN_HANDLED;
- new Float:fpOrigin[3];
- new Float:fbOrigin[3];
- new Float:fAiming[3];
- new iAiming[3];
- new bOrigin[3];
- new Name[32];
- entity_set_string(id, EV_SZ_viewmodel, "");
- get_user_origin(id, bOrigin, 1);
- get_user_origin(id, iAiming, 3);
- entity_get_vector(id, EV_VEC_origin, fpOrigin);
- entity_get_vector(ent, EV_VEC_origin, fbOrigin);
- IVecFVec(iAiming, fAiming);
- FVecIVec(fbOrigin, bOrigin);
- get_user_name(id, Name, 31);
- replace_all(Name, 31, " ", "_");
- entity_set_string(ent, EV_SZ_targetname, Name);
- BlockGrabbed[id] = ent;
- gfGrabOffset[id][0] = fbOrigin[0] - iAiming[0];
- gfGrabOffset[id][1] = fbOrigin[1] - iAiming[1];
- gfGrabOffset[id][2] = fbOrigin[2] - iAiming[2];
- entity_set_int(ent, EV_INT_iuser2, id);
- if( entity_get_int( ent, EV_INT_body ) == MOVE )
- {
- SetMoveStatus( ent, false );
- }
- return PLUGIN_HANDLED;
- }
- public cmd_Release(id)
- {
- if ( !BlockGrabbed[id] || (!( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id]))
- {
- return PLUGIN_HANDLED;
- }
- if ( IsBlock(BlockGrabbed[id]) )
- {
- if ( IsBlockInGroup(id, BlockGrabbed[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(id, block);
- }
- ColorChat(id, "Group deleted because all the blocks were stuck!");
- }
- else
- {
- new block_type = entity_get_int(block, EV_INT_body);
- if(block_type == MAGICCARPET)
- {
- new Float:origin[3];
- entity_get_vector(block, EV_VEC_origin, origin);
- set_pev(block, pev_v_angle, origin);
- }
- }
- }
- else
- {
- if ( is_valid_ent(BlockGrabbed[id]) )
- {
- if ( IsBlockStuck(BlockGrabbed[id]) )
- {
- new bool:deleted = DeleteBlock(id, BlockGrabbed[id]);
- if ( deleted ) ColorChat(id, "Block^x03 deleted^x01 because it was stuck!");
- }
- else
- {
- entity_set_int(BlockGrabbed[id], EV_INT_iuser2, 0);
- new block_type = entity_get_int(BlockGrabbed[id], EV_INT_body);
- if(block_type == MAGICCARPET)
- {
- new Float:origin[3];
- entity_get_vector(BlockGrabbed[id], EV_VEC_origin, origin);
- set_pev(BlockGrabbed[id], pev_v_angle, origin);
- }
- if( block_type == MOVE )
- {
- new szProperty[ 5 ];
- GetProperty( BlockGrabbed[ id ], 4, szProperty );
- SetMoveStatus( BlockGrabbed[ id ], szProperty[ 0 ] == '1' ? true : false );
- }
- }
- }
- }
- }
- else if ( IsTeleport(BlockGrabbed[id]) )
- {
- entity_set_int(BlockGrabbed[id], EV_INT_iuser2, 0);
- }
- else if ( IsLight(BlockGrabbed[id]) )
- {
- entity_set_int(BlockGrabbed[id], EV_INT_iuser2, 0);
- }
- BlockGrabbed[id] = 0;
- return PLUGIN_HANDLED;
- }
- GroupBlockAiming(id)
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- return PLUGIN_HANDLED;
- static ent, body;
- get_user_aiming(id, ent, body);
- if ( !IsBlock(ent) ) return PLUGIN_HANDLED;
- new player = entity_get_int(ent, EV_INT_iuser1);
- if ( !player )
- {
- ++g_group_count[id];
- g_grouped_blocks[id][g_group_count[id]] = ent;
- GroupBlock(id, ent);
- }
- else if ( player == id )
- {
- UnGroupBlock(ent);
- }
- else
- {
- static player, name[32];
- player = entity_get_int(ent, EV_INT_iuser1);
- get_user_name(player, name, charsmax(name));
- ColorChat(id, "Block is already in a group by:^1 %s", name);
- }
- return PLUGIN_HANDLED;
- }
- GroupBlock(id, ent)
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- return PLUGIN_HANDLED;
- if ( is_valid_ent(ent) )
- {
- if ( 1 <= id <= get_maxplayers() )
- {
- entity_set_int(ent, EV_INT_iuser1, id);
- }
- }
- set_rendering(ent, kRenderFxGlowShell, 255, 0, 0, kRenderNormal, 16);
- return PLUGIN_HANDLED;
- }
- /*
- UnGroupBlock(ent)
- {
- if ( !IsBlock(ent) ) return PLUGIN_HANDLED;
- entity_set_int(ent, EV_INT_iuser1, 0);
- new block_type = entity_get_int(ent, EV_INT_body);
- set_rendering(ent, kRenderFxNone, 0, 0, 0, kRenderNormal, 0);
- if(block_type == GLASS)
- set_rendering(ent, kRenderFxNone, 255, 255, 255, kRenderTransAdd, 100);
- return PLUGIN_HANDLED;
- }
- */
- UnGroupBlock(ent)
- {
- if ( !IsBlock(ent) ) return PLUGIN_HANDLED;
- entity_set_int(ent, EV_INT_iuser1, 0);
- new block_type = entity_get_int(ent, EV_INT_body);
- new szProperty3[ 5 ];
- GetProperty( ent, 3, szProperty3 );
- new iProperty3 = str_to_num( szProperty3 );
- if( block_type == MOVE )
- {
- iProperty3 = 255;
- }
- if(block_type != GLASS)
- {
- set_rendering(ent, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, iProperty3 == 0 ? 255 : iProperty3 );
- }
- else
- {
- set_rendering(ent, kRenderFxNone, 255, 255, 255, kRenderTransAdd, 100);
- }
- return PLUGIN_HANDLED;
- }
- ClearGroup(id)
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- return PLUGIN_HANDLED;
- static block;
- static block_count;
- static blocks_deleted;
- block_count = 0;
- blocks_deleted = 0;
- for ( new i = 0; i <= g_group_count[id]; ++i )
- {
- block = g_grouped_blocks[id][i];
- if ( IsBlockInGroup(id, block) )
- {
- if ( IsBlockStuck(block) )
- {
- DeleteBlock(id, block);
- ++blocks_deleted;
- }
- else
- {
- UnGroupBlock(block);
- ++block_count;
- }
- }
- }
- g_group_count[id] = 0;
- if ( is_user_connected(id) )
- {
- if ( blocks_deleted > 0 )
- {
- ColorChat(id, "Removed^1 %d^3 blocks from group. Deleted^1 %d^3 stuck blocks!", block_count, blocks_deleted);
- }
- else
- {
- ColorChat(id, "Removed^1 %d^3 blocks from group!", block_count);
- }
- }
- return PLUGIN_HANDLED;
- }
- move_GrabbedEntity(id, Float:vMoveTo[3] = { 0.0, 0.0, 0.0 }, dosnapping = true)
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- return PLUGIN_HANDLED;
- new iOrigin[3], iLook[3];
- new Float:fOrigin[3], Float:fLook[3], Float:fDirection[3], Float:fLength;
- get_user_origin(id, iOrigin, 1);
- get_user_origin(id, iLook, 3);
- IVecFVec(iOrigin, fOrigin);
- IVecFVec(iLook, fLook);
- fDirection[0] = fLook[0] - fOrigin[0];
- fDirection[1] = fLook[1] - fOrigin[1];
- fDirection[2] = fLook[2] - fOrigin[2];
- fLength = get_distance_f(fLook, fOrigin);
- if ( fLength == 0.0 ) fLength = 1.0;
- vMoveTo[0] = ( fOrigin[0] + fDirection[0] * gfGrablength[id] / fLength ) + gfGrabOffset[id][0];
- vMoveTo[1] = ( fOrigin[1] + fDirection[1] * gfGrablength[id] / fLength ) + gfGrabOffset[id][1];
- vMoveTo[2] = ( fOrigin[2] + fDirection[2] * gfGrablength[id] / fLength ) + gfGrabOffset[id][2];
- vMoveTo[2] = float(floatround(vMoveTo[2], floatround_floor));
- move_Entity(id, BlockGrabbed[id], vMoveTo, dosnapping);
- return PLUGIN_HANDLED;
- }
- move_Entity(id, ent, Float:vMoveTo[3], dosnapping = false)
- {
- if(dosnapping) DoSnapping(id, ent, vMoveTo);
- entity_set_origin(ent, vMoveTo);
- }
- public cmd_Attack(id)
- {
- if ( !IsBlock(BlockGrabbed[id]) ) return PLUGIN_HANDLED;
- if ( IsBlockInGroup(id, BlockGrabbed[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) )
- {
- copy_Block( block );
- }
- }
- }
- else
- {
- if ( IsBlockStuck(BlockGrabbed[id]) )
- {
- ColorChat(id, "You cannot copy a block that is in a stuck position!");
- return PLUGIN_HANDLED;
- }
- new new_block = copy_Block( BlockGrabbed[id] );
- if ( !new_block ) return PLUGIN_HANDLED;
- entity_set_int(BlockGrabbed[id], EV_INT_iuser2, 0);
- entity_set_int(new_block, EV_INT_iuser2, id);
- BlockGrabbed[id] = new_block;
- }
- return PLUGIN_HANDLED;
- }
- public cmd_Attack2(id)
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- return PLUGIN_HANDLED;
- if ( IsBlock(BlockGrabbed[id]) )
- {
- DeleteBlock(id, BlockGrabbed[id]);
- }
- else if ( IsTeleport(BlockGrabbed[id]) )
- {
- DeleteTeleport(id, BlockGrabbed[id]);
- }
- else if ( IsLight(BlockGrabbed[id]) )
- {
- DeleteLight(BlockGrabbed[id]);
- }
- return PLUGIN_HANDLED;
- }
- copy_Block(ent)
- {
- if ( is_valid_ent(ent) )
- {
- new Float:vOrigin[3];
- new Float:vAngles[3];
- new Float:vSizeMin[3];
- new Float:vSizeMax[3];
- new Float:fMax;
- new szSize;
- new szAxis;
- new Name[64];
- new blockType = entity_get_int(ent, EV_INT_body);
- entity_get_vector(ent, EV_VEC_origin, vOrigin);
- entity_get_vector(ent, EV_VEC_angles, vAngles);
- entity_get_vector(ent, EV_VEC_maxs, vSizeMax);
- entity_get_vector(ent, EV_VEC_mins, vSizeMin);
- entity_get_string(ent, EV_SZ_targetname, Name, 63);
- szSize = SMALL;
- fMax = vSizeMax[0] + vSizeMax[1] + vSizeMax[2];
- if ( fMax > 36.0 ) szSize = POLE;
- if ( fMax > 64.0 ) szSize = NORMAL;
- if ( fMax > 128.0 ) szSize = LARGE;
- if ( fMax > 192.0 ) szSize = EXTRA_LARGE;
- if ( fMax > 256.0 ) szSize = JUMBO;
- for ( new i = 0; i < 3; ++i )
- {
- if ( vSizeMax[i] == 4.0 )
- {
- szAxis = i;
- break;
- }
- }
- new Property1[5], Property2[5], Property3[5], Property4[5], Property5[5];
- GetProperty(ent, 1, Property1);
- GetProperty(ent, 2, Property2);
- GetProperty(ent, 3, Property3);
- GetProperty(ent, 4, Property4);
- GetProperty(ent, 5, Property5);
- return CreateBlock(0, blockType, vOrigin, szAxis, szSize, Property1, Property2, Property3, Property4, Property5, vAngles, Name, true, vSizeMax, vSizeMin, true);
- }
- return 0;
- }
- DoSnapping(id, ent, Float:move_to[3], bool:Do = false)
- {
- if ( !Snapping[ id ] ) return PLUGIN_HANDLED;
- new traceline;
- new closest_trace;
- new block_face;
- new Float:snap_size;
- new Float:v_return[3];
- new Float:dist;
- new Float:old_dist;
- new Float:trace_start[3];
- new Float:trace_end[3];
- new Float:size_min[3];
- new Float:size_max[3];
- new Float:offset;
- offset = Do ? 4.0 : 0.0;
- entity_get_vector(ent, EV_VEC_mins, size_min);
- entity_get_vector(ent, EV_VEC_maxs, size_max);
- snap_size = SnappingGap[id] + 10.0;
- old_dist = 9999.9;
- closest_trace = 0;
- for ( new i = 0; i < 6; ++i )
- {
- trace_start = move_to;
- switch ( i )
- {
- case 0: trace_start[0] += size_min[0];
- case 1: trace_start[0] += size_max[0];
- case 2: trace_start[1] += size_min[1];
- case 3: trace_start[1] += size_max[1];
- case 4: trace_start[2] += size_min[2];
- case 5: trace_start[2] += size_max[2];
- }
- trace_end = trace_start;
- switch ( i )
- {
- case 0: trace_end[0] -= snap_size;
- case 1: trace_end[0] += snap_size;
- case 2: trace_end[1] -= snap_size;
- case 3: trace_end[1] += snap_size;
- case 4: trace_end[2] -= snap_size;
- case 5: trace_end[2] += snap_size;
- }
- traceline = trace_line(ent, trace_start, trace_end, v_return);
- if ( IsBlock(traceline)
- && ( !IsBlockInGroup(id, traceline) || !IsBlockInGroup(id, ent) ) )
- {
- dist = get_distance_f(trace_start, v_return);
- if ( dist < old_dist )
- {
- closest_trace = traceline;
- old_dist = dist;
- block_face = i;
- }
- }
- }
- if ( !is_valid_ent(closest_trace) ) return PLUGIN_HANDLED;
- static Float:trace_origin[3];
- static Float:trace_size_min[3];
- static Float:trace_size_max[3];
- entity_get_vector(closest_trace, EV_VEC_origin, trace_origin);
- entity_get_vector(closest_trace, EV_VEC_mins, trace_size_min);
- entity_get_vector(closest_trace, EV_VEC_maxs, trace_size_max);
- move_to = trace_origin;
- if ( block_face == 0 ) move_to[0] += ( trace_size_max[0] + size_max[0] ) + SnappingGap[id] + offset;
- if ( block_face == 1 ) move_to[0] += ( trace_size_min[0] + size_min[0] ) - SnappingGap[id] + offset;
- if ( block_face == 2 ) move_to[1] += ( trace_size_max[1] + size_max[1] ) + SnappingGap[id] + offset;
- if ( block_face == 3 ) move_to[1] += ( trace_size_min[1] + size_min[1] ) - SnappingGap[id] + offset;
- if ( block_face == 4 ) move_to[2] += ( trace_size_max[2] + size_max[2] ) + SnappingGap[id] + offset;
- if ( block_face == 5 ) move_to[2] += ( trace_size_min[2] + size_min[2] ) - SnappingGap[id] + offset;
- return PLUGIN_HANDLED;
- }
- DeleteAll( id, bool:Message = false )
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- return PLUGIN_HANDLED;
- static ent, block_count, tele_count, light_count, bool:deleted;
- ent = -1;
- block_count = 0;
- while ( ( ent = find_ent_by_class(ent, g_block_classname) ) )
- {
- deleted = DeleteBlock(id, ent);
- if ( deleted )
- {
- ++block_count;
- }
- }
- ent = -1;
- tele_count = 0;
- while ( ( ent = find_ent_by_class(ent, g_start_classname) ) )
- {
- deleted = DeleteTeleport(id, ent);
- if ( deleted )
- {
- ++tele_count;
- }
- }
- ent = -1;
- light_count = 0;
- while ( ( ent = find_ent_by_class(ent, g_light_classname) ) )
- {
- deleted = DeleteLight(ent);
- if ( deleted )
- {
- ++light_count;
- }
- }
- static name[32];
- get_user_name(id, name, charsmax(name));
- for ( new i = 1; i <= get_maxplayers(); ++i )
- {
- BlockGrabbed[i] = 0;
- if ( !Message )
- ColorChat(i, "^3%s^1 deleted^3 %d blocks, %d Teleports and %d Lights!", name, block_count, tele_count, light_count);
- }
- return PLUGIN_HANDLED;
- }
- GetProperty(ent, property, property_value[])
- {
- switch ( property )
- {
- case 1: pev(ent, pev_message, property_value, 5);
- case 2: pev(ent, pev_netname, property_value, 5);
- case 3: pev(ent, pev_viewmodel2, property_value, 5);
- case 4: pev(ent, pev_weaponmodel2, property_value, 5);
- case 5: pev(ent, pev_globalname, property_value, 5);
- }
- return (strlen(property_value) ? 1 : 0);
- }
- SetProperty(ent, property, const property_value[])
- {
- new block_type = entity_get_int(ent, EV_INT_body);
- if( block_type == MOVE )
- {
- new Float:origin[ 3 ];
- entity_get_vector( ent, EV_VEC_vuser1, origin );
- new Property1[ 5 ];
- new Property2[ 5 ];
- new Property3[ 5 ];
- new Property4[ 5 ];
- new Property5[ 5 ];
- GetProperty( ent, 1, Property1 );
- GetProperty( ent, 2, Property2 );
- GetProperty( ent, 3, Property3 );
- GetProperty( ent, 4, Property4 );
- GetProperty( ent, 5, Property5 );
- switch( property )
- {
- case 1: copy( Property1, 4, property_value );
- case 2: copy( Property2, 4, property_value );
- case 3:
- {
- copy( Property3, 4, property_value );
- entity_set_vector( ent, EV_VEC_origin, origin );
- }
- case 4: copy( Property4, 4, property_value );
- case 5: copy( Property5, 4, property_value );
- }
- new direction = str_to_num( Property3 );
- new Float:origin2[ 3 ];
- origin2 = origin;
- origin2[ direction ] += str_to_float( Property2 );
- entity_set_int( ent, EV_INT_movetype, MOVETYPE_FLY );
- MoveEntity( ent, str_to_float( Property5 ), origin, origin2, Property4[ 0 ] == '0' ? false : true );
- if( property == 1 )
- {
- ChangeMoveBlockModel( ent, Property1 );
- }
- }
- if( block_type == BUNNYHOP && property == 5 )
- {
- new value = str_to_num( property_value );
- if( value > 0 )
- {
- set_rendering(ent, kRenderFxGlowShell, 139, 69, 19, kRenderNormal, 16);
- }
- else
- {
- set_rendering(ent, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 16);
- }
- }
- switch ( property )
- {
- case 1: set_pev(ent, pev_message, property_value, 5);
- case 2: set_pev(ent, pev_netname, property_value, 5);
- case 3:
- {
- set_pev(ent, pev_viewmodel2, property_value, 5);
- if(IsBlock(ent) && block_type != MOVE )
- {
- set_rendering(ent, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, str_to_num(property_value) == 0 ? 255 : str_to_num(property_value));
- }
- }
- case 4: set_pev(ent, pev_weaponmodel2, property_value, 5);
- case 5: set_pev(ent, pev_globalname, property_value, 5);
- }
- return 1;
- }
- ToggleProperty(id, property)
- {
- new ent = PropertyEnt[id];
- if ( !is_valid_ent(ent) )
- {
- ColorChat(id, "That block has been deleted!");
- BlockMenu(id);
- return PLUGIN_HANDLED;
- }
- static property_value[5];
- GetProperty(ent, property, property_value);
- new block_type = entity_get_int(ent, EV_INT_body);
- if( ( block_type == SLAP || block_type == MAGICCARPET ) && property == 1 )
- {
- if ( property_value[0] == '1' ) copy(property_value, charsmax(property_value), "2");
- else if ( property_value[0] == '2' ) copy(property_value, charsmax(property_value), "3");
- else copy(property_value, charsmax(property_value), "1");
- }
- else if( block_type == MOVE && property == 3 )
- {
- if ( property_value[0] == '0' ) copy(property_value, charsmax(property_value), "1");
- else if ( property_value[0] == '1' ) copy(property_value, charsmax(property_value), "2");
- else copy(property_value, charsmax(property_value), "0");
- }
- else
- {
- if ( property_value[0] == '0' ) copy(property_value, charsmax(property_value), "1");
- else copy(property_value, charsmax(property_value), "0");
- }
- SetProperty(ent, property, property_value);
- PropertyMenu(id, ent);
- return PLUGIN_HANDLED;
- }
- public SetPropertyBlock(id)
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- return PLUGIN_HANDLED;
- static arg[5];
- read_argv(1, arg, charsmax(arg));
- if ( !strlen(arg) )
- {
- ColorChat(id, "You can't set a property blank! Please type a new value.");
- client_cmd(id, "messagemode pG_SetProperty");
- return PLUGIN_HANDLED;
- }
- else if ( !IsStrFloat(arg) )
- {
- ColorChat(id, "You can't use letters in a property! Please type a new value.");
- client_cmd(id, "messagemode pG_SetProperty");
- return PLUGIN_HANDLED;
- }
- new ent = PropertyEnt[id];
- if ( !is_valid_ent(ent) )
- {
- ColorChat(id, "That block has been deleted!");
- BlockMenu(id);
- return PLUGIN_HANDLED;
- }
- static block_type;
- static property;
- static Float:property_value;
- block_type = entity_get_int(ent, EV_INT_body);
- property = PropertyPicked[id];
- property_value = str_to_float(arg);
- /*
- if(block_type != XXX)
- {
- if(property == 3)
- {
- if(!(0 <= property_value <= 255))
- {
- ColorChat(id, "The property has to be between^3 1^1 and^3 255");
- return PLUGIN_HANDLED;
- }
- }
- }
- */
- if(property == 3 && block_type != MOVE)
- {
- if(!(0 <= property_value <= 255))
- {
- ColorChat(id, "The property has to be between^3 1^1 and^3 255");
- return PLUGIN_HANDLED;
- }
- }
- switch ( block_type )
- {
- case BUNNYHOP:
- {
- if( property == 5 )
- {
- if( !( 0 <= property_value <= 100 ) )
- {
- ColorChat(id, "The property has to be between^3 0^1 and^3 100");
- return PLUGIN_HANDLED;
- }
- }
- }
- case DELAY_BHOP:
- {
- if(property == 5)
- {
- if(!(0.5 <= property_value <= 10.5))
- {
- ColorChat(id, "The property has to be between^3 0.5^1 and^3 10.5");
- return PLUGIN_HANDLED;
- }
- }
- }
- case TRAMPOLINE, ICE:
- {
- /*if(property == 2 )
- {
- if(!(200 <= property_value <= 1000))
- {
- ColorChat(id, "The property has to be between^3 200^1 and^3 1000");
- return PLUGIN_HANDLED;
- }
- }*/
- if(property == 2 )
- {
- if(!(0 <= property_value <= 10.5))
- {
- ColorChat(id, "The property has to be between^3 0^1 and^3 10.5");
- return PLUGIN_HANDLED;
- }
- }
- }
- case SPEEDBOOST:
- {
- if(property == 1 || property == 2)
- {
- if(!(200 <= property_value <= 2000))
- {
- ColorChat(id, "The property has to be between^3 200^1 and^3 2000");
- return PLUGIN_HANDLED;
- }
- }
- }
- case DUCK:
- {
- if(property == 1 )
- {
- if(!(0 <= property_value <= 10.5))
- {
- ColorChat(id, "The property has to be between^3 0^1 and^3 10.5");
- return PLUGIN_HANDLED;
- }
- }
- }
- #if defined USE_XP
- case XP:
- {
- if( property == 1 )
- {
- if(!(0 <= property_value <= 100))
- {
- ColorChat(id, "The property has to be between^3 0^1 and^3 100");
- return PLUGIN_HANDLED;
- }
- }
- if( property == 2 )
- {
- if( property_value < 120)
- {
- ColorChat(id, "The property has to be higher than^3 120^1.");
- return PLUGIN_HANDLED;
- }
- }
- }
- #endif
- }
- SetProperty(ent, property, arg);
- PropertyMenu(id, ent);
- return PLUGIN_HANDLED;
- }
- SaveBlocks(id)
- {
- if ( !( get_user_flags(id) & BM_ACCESS) && !g_gived_access[id])
- return PLUGIN_HANDLED;
- new ent;
- new file;
- new data[512];
- new block_count;
- new tele_count;
- new light_count;
- new block_type;
- new size;
- new property1[5], property2[5], property3[5], property4[5], property5[5];
- new tele;
- new Float:origin[3];
- new Float:angles[3];
- new Float:tele_start[3];
- new Float:tele_end[3];
- new Float:max_size;
- new Float:size_max[3];
- new szCreator[64];
- replace_all(szCreator, 63, " ", "_");
- file = fopen(g_file, "wt");
- block_count = 0;
- tele_count = 0;
- ent = -1;
- #if defined BUILDS_FILES_PROTECTION
- static string[ 17 ];
- #endif
- while ( ( ent = find_ent_by_class(ent, g_block_classname) ) )
- {
- block_type = entity_get_int(ent, EV_INT_body);
- entity_get_vector(ent, EV_VEC_angles, angles);
- entity_get_vector(ent, EV_VEC_maxs, size_max);
- entity_get_string(ent, EV_SZ_targetname, szCreator, 31);
- if( block_type == MOVE )
- {
- entity_get_vector(ent, EV_VEC_vuser1, origin);
- }
- else
- {
- entity_get_vector(ent, EV_VEC_origin, origin);
- }
- #if defined BUILDS_FILES_PROTECTION
- for( new i; i < 3; i++ )
- {
- client_print( 0, print_chat, "REAL ONE: %f", origin[ i ] );
- float_to_str( origin[ i ], string, sizeof( string ) - 1 );
- origin[ i ] = str_to_float( ReverseString( string ) );
- client_print( 0, print_chat, "IS NOW: %f", origin[ i ] );
- }
- #endif
- GetProperty(ent, 1, property1);
- GetProperty(ent, 2, property2);
- GetProperty(ent, 3, property3);
- GetProperty(ent, 4, property4);
- GetProperty(ent, 5, property5);
- if ( !property1[0] ) copy(property1, charsmax(property1), "/");
- if ( !property2[0] ) copy(property2, charsmax(property2), "/");
- if ( !property3[0] ) copy(property3, charsmax(property3), "/");
- if ( !property4[0] ) copy(property4, charsmax(property4), "/");
- max_size = size_max[0] + size_max[1] + size_max[2];
- if ( max_size > 256.0 ) size = JUMBO;
- else if ( max_size > 192.0 ) size = EXTRA_LARGE;
- else 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 = SMALL;
- formatex(data, charsmax(data), "%c %f %f %f %f %f %f %d %s %s %s %s %s %s %s^n",\
- g_block_save_ids[block_type],\
- origin[0],\
- origin[1],\
- origin[2],\
- angles[0],\
- angles[1],\
- angles[2],\
- size,\
- property1,\
- property2,\
- property3,\
- property4,\
- property5,\
- szCreator,\
- szCreator
- );
- fputs(file, data);
- ++block_count;
- }
- ent = -1;
- while ( ( ent = find_ent_by_class(ent, g_end_classname) ) )
- {
- tele = entity_get_int(ent, EV_INT_iuser1);
- if ( tele )
- {
- entity_get_vector(tele, EV_VEC_origin, tele_start);
- entity_get_vector(ent, EV_VEC_origin, tele_end);
- entity_get_string(ent, EV_SZ_targetname, szCreator, 31);
- new teleportstart = entity_get_int(ent, EV_INT_iuser4);
- GetProperty(teleportstart, 1, property1);
- GetProperty(teleportstart, 2, property2);
- formatex(data, charsmax(data), "* %f %f %f %f %f %f / / / / / / %s^n",\
- tele_start[0],\
- tele_start[1],\
- tele_start[2],\
- tele_end[0],\
- tele_end[1],\
- tele_end[2],\
- szCreator
- );
- fputs(file, data);
- ++tele_count;
- }
- }
- ent = -1;
- while ( ( ent = find_ent_by_class(ent, g_light_classname) ) )
- {
- entity_get_vector(ent, EV_VEC_origin, origin);
- entity_get_string(ent, EV_SZ_targetname, szCreator, 31);
- GetProperty(ent, 1, property1);
- GetProperty(ent, 2, property2);
- GetProperty(ent, 3, property3);
- GetProperty(ent, 4, property4);
- formatex(data, charsmax(data), "! %f %f %f / / / / %s %s %s %s / %s^n",\
- origin[0],\
- origin[1],\
- origin[2],\
- property1,\
- property2,\
- property3,\
- property4,\
- szCreator
- );
- fputs(file, data);
- ++light_count;
- }
- static name[32];
- get_user_name(id, name, charsmax(name));
- for ( new i = 1; i <= get_maxplayers(); ++i )
- {
- ColorChat(i, "^3%s^1 saved^3 %d blocks, %d Teleports and %d Lights!^1 Total entites in map:^3 %d", name, block_count, tele_count, light_count, entity_count());
- }
- fclose(file);
- return PLUGIN_HANDLED;
- }
- LoadBlocks(id)
- {
- if ( id != 0 && !(get_user_flags(id) & BM_ACCESS))
- {
- console_print(id, "You have no access to that command");
- return PLUGIN_HANDLED;
- }
- else if ( !file_exists(g_file)
- && 1 <= id <= get_maxplayers() )
- {
- ColorChat(id, "Couldn't find file:^1 %s", g_file);
- return PLUGIN_HANDLED;
- }
- if ( 1 <= id <= get_maxplayers() )
- {
- DeleteAll(id, true);
- }
- new file;
- new data[512];
- new block_count;
- new tele_count;
- new light_count;
- new type[2];
- new block_size[17];
- new origin_x[17];
- new origin_y[17];
- new origin_z[17];
- new angel_x[17];
- new angel_y[17];
- new angel_z[17];
- new block_type;
- new axis;
- new size;
- new property1[5], property2[5], property3[5], property4[5], property5[5];
- new Float:origin[3];
- new Float:angles[3];
- new szCreator[64];
- file = fopen(g_file, "rt");
- block_count = 0;
- while ( !feof(file) )
- {
- type = "";
- fgets(file, data, charsmax(data));
- parse(data,\
- type, charsmax(type),\
- origin_x, charsmax(origin_x),\
- origin_y, charsmax(origin_y),\
- origin_z, charsmax(origin_z),\
- angel_x, charsmax(angel_x),\
- angel_y, charsmax(angel_y),\
- angel_z, charsmax(angel_z),\
- block_size, charsmax(block_size),\
- property1, charsmax(property1),\
- property2, charsmax(property2),\
- property3, charsmax(property3),\
- property4, charsmax(property4),\
- property5, charsmax(property5),\
- szCreator, charsmax(szCreator)
- );
- #if defined BUILDS_FILES_PROTECTION
- origin[0] = str_to_float( ReverseString( origin_x ) );
- origin[1] = str_to_float( ReverseString( origin_y ) );
- origin[2] = str_to_float( ReverseString( origin_z ) );
- #else
- origin[0] = str_to_float(origin_x);
- origin[1] = str_to_float(origin_y);
- origin[2] = str_to_float(origin_z);
- #endif
- angles[0] = str_to_float(angel_x);
- angles[1] = str_to_float(angel_y);
- angles[2] = str_to_float(angel_z);
- size = str_to_num(block_size);
- if ( strlen(type) > 0 )
- {
- if ( type[0] != '*' )
- {
- if ( angles[0] == 90.0 && angles[1] == 0.0 && angles[2] == 0.0 ) axis = X;
- else if ( angles[0] == 90.0 && angles[1] == 0.0 && angles[2] == 90.0 ) axis = Y;
- else axis = Z;
- }
- switch ( type[0] )
- {
- case 'A': block_type = PLATFORM;
- case 'B': block_type = GLASS;
- case 'C': block_type = BUNNYHOP;
- case 'D': block_type = DELAY_BHOP;
- case 'E': block_type = DAMAGE;
- case 'F': block_type = HEALER;
- case 'G': block_type = NFD;
- case 'H': block_type = ICE;
- case 'I': block_type = TRAMPOLINE;
- case 'J': block_type = SPEEDBOOST;
- case 'K': block_type = DEATH;
- case 'L': block_type = LOW_GRAVITY;
- case 'M': block_type = HONEY;
- case 'N': block_type = SLAP;
- case 'O': block_type = CTBARRIER;
- case 'P': block_type = TBARRIER;
- case 'Q': block_type = INVINCIBILITY;
- case 'R': block_type = STEALTH;
- case 'S': block_type = BOOTS_OF_SPEED;
- case 'T': block_type = HE;
- case 'U': block_type = FROST;
- case 'V': block_type = FLASHBANG;
- case 'W': block_type = MONEY;
- #if defined USE_XPBLOCK
- case 'X': block_type = XP;
- #endif
- case 'Y': block_type = DUCK;
- case 'Z': block_type = DEAGLE;
- case '1': block_type = AWP;
- case '2': block_type = SUPERMAN;
- case '3': block_type = MAGICCARPET;
- case '4': block_type = MOVE;
- case '*':
- {
- new const none[] = "0";
- CreateTeleport(0, TELEPORT_START, property1, property2, origin, szCreator);
- CreateTeleport(0, TELEPORT_END, none, none, angles, szCreator);
- ++tele_count;
- }
- case '!':
- {
- CreateLight(origin, property1, property2, property3, property4, szCreator);
- ++light_count;
- }
- }
- if ( type[0] != '*' && type[0] != '!' )
- {
- new Float:Angles[3];
- new Float:maxs[3];
- new Float:mins[3];
- if(type[0] == '4')
- {
- new const move[] = "1";
- CreateBlock(0, block_type, origin, axis, size, property1, property2, property3, move, property5, Angles, szCreator, false, maxs, mins);
- }
- else
- {
- CreateBlock(0, block_type, origin, axis, size, property1, property2, property3, property4, property5, Angles, szCreator, false, maxs, mins);
- }
- ++block_count;
- }
- }
- }
- fclose(file);
- if ( 1 <= id <= get_maxplayers() )
- {
- static name[32];
- get_user_name(id, name, charsmax(name));
- for ( new i = 1; i <= get_maxplayers(); ++i )
- {
- if ( !is_user_connected(id) || !(get_user_flags(id) & BM_ACCESS)) continue;
- ColorChat(i, "^3%s^1 loaded^3 %d blocks, %d Teleports and %d Lights!^1 Total entites in map:^3 %d", name, block_count, tele_count, light_count, entity_count());
- }
- }
- return PLUGIN_HANDLED;
- }
- #if defined BUILDS_FILES_PROTECTION
- stock ReverseString( message[ ] )
- {
- /*new length = strlen( message ) - 1;
- for( new i = 0; i <= length; i++ )
- {
- message[ i ] = message[ length - i];
- }
- return message;*/
- new output[ 17 ];
- for( new i = strlen( message ) - 1, j = 0 ; i >= 0 ; i--, j++ )
- {
- output[ j ] = message[ i ];
- }
- return output;
- /*static left[ 17 ];
- static right[ 17 ];
- static total[ 34 ];
- strtok( message, left, charsmax( left ), right, charsmax( right ), '.' );
- formatex( total, sizeof( total ) - 1, "%s.%s", right, left );
- return total;*/
- }
- #endif
- bool:IsBlock(ent) {
- if ( !is_valid_ent(ent) ) return false;
- static classname[32];
- entity_get_string(ent, EV_SZ_classname, classname, charsmax(classname));
- if ( equal(classname, g_block_classname) )
- {
- return true;
- }
- return false;
- }
- bool:IsBlockInGroup(id, ent) {
- if ( !is_valid_ent(ent) ) return false;
- new player = entity_get_int(ent, EV_INT_iuser1);
- if ( player == id ) return true;
- return false;
- }
- bool:IsStrFloat(string[])
- {
- new len = strlen(string);
- for ( new i = 0; i < len; i++ )
- {
- switch ( string[i] )
- {
- case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.', '-': continue;
- default: return false;
- }
- }
- return true;
- }
- ResetPlayer(id)
- {
- g_nfd[id] = false;
- g_ice[id] = false;
- g_blockjump[id] = false;
- g_next_damage_time[id] = 0.0;
- g_next_heal_time[id] = 0.0;
- g_he_next_use[id] = 0.0;
- g_frost_next_use[id] = 0.0;
- g_flash_next_use[id] = 0.0;
- g_boots_next_use[id] = 0.0;
- g_stealth_next_use[id] = 0.0;
- g_invincibility_next_use[id] = 0.0;
- g_money_next_use[id] = 0.0;
- g_xp_next_use[id] = 0.0;
- g_deagle_next_use[id] = 0.0;
- g_awp_next_use[id] = 0.0;
- g_ak_next_use[id] = 0.0;
- g_superman_next_use[id] = 0.0;
- g_stealth_time_out[id] = 0.0;
- g_invincibility_time_out[id] = 0.0;
- g_boots_time_out[id] = 0.0;
- g_superman_time_out[id] = 0.0;
- g_boots_of_speed[id] = 0;
- set_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 255);
- set_user_gravity(id, 1.0);
- set_user_godmode(id, 0);
- ResetMaxspeed(id);
- remove_task(id + TASK_ICE);
- remove_task(id + TASK_HONEY);
- remove_task(id + TASK_INVINCIBILITY);
- remove_task(id + TASK_STEALTH);
- remove_task(id + TASK_BOOTSOFSPEED);
- remove_task(id + TASK_SUPERMAN);
- }
- ResetMaxspeed(id)
- {
- static Float:max_speed;
- switch ( get_user_weapon(id) )
- {
- case CSW_SG550, CSW_AWP, CSW_G3SG1: max_speed = 210.0;
- case CSW_M249: max_speed = 220.0;
- case CSW_AK47: max_speed = 221.0;
- case CSW_M3, CSW_M4A1: max_speed = 230.0;
- case CSW_SG552: max_speed = 235.0;
- case CSW_XM1014, CSW_AUG, CSW_GALIL, CSW_FAMAS: max_speed = 240.0;
- case CSW_P90: max_speed = 245.0;
- case CSW_SCOUT: max_speed = 260.0;
- default: max_speed = 250.0;
- }
- entity_set_float(id, EV_FL_maxspeed, max_speed);
- }
- SetBlockModelNameLarge(model_target[256], model_source[256], size) {
- model_target = model_source;
- replace(model_target, size, ".mdl", "_large.mdl");
- }
- SetBlockModelNameSmall(model_target[256], model_source[256], size) {
- model_target = model_source;
- replace(model_target, size, ".mdl", "_small.mdl");
- }
- SetBlockModelNamePole(model_target[256], model_source[256], size) {
- model_target = model_source;
- replace(model_target, size, ".mdl", "_pole.mdl");
- }
- SetBlockModelNameExtraLarge(model_target[256], model_source[256], size) {
- model_target = model_source;
- replace(model_target, size, ".mdl", "_elarge.mdl");
- }
- SetBlockModelNameJumbo(model_target[256], model_source[256], size) {
- model_target = model_source;
- replace(model_target, size, ".mdl", "_jumbo.mdl");
- }
- stock MoveEntity( entity, Float:speed, Float:point1[ 3 ], Float:point2[ 3 ], bool:bStatus )
- {
- if(!is_valid_ent( entity )|| entity_get_int( entity, EV_INT_movetype ) != MOVETYPE_FLY )
- {
- return 0;
- }
- new Float:origin[3];
- entity_get_vector(entity, EV_VEC_origin, origin);
- new Float:distance1, Float:distance2;
- distance1 = get_distance_f(origin, point1);
- distance2 = get_distance_f(origin, point2);
- new reverse = (distance1 < distance2) ? 1 : 0;
- entity_set_int(entity, EV_INT_iuser3, MOVE_ENTITY_IDENTIFIER);
- entity_set_int(entity, EV_INT_weaponanim, reverse);
- entity_set_vector(entity, EV_VEC_vuser1, point1);
- entity_set_vector(entity, EV_VEC_vuser2, point2);
- entity_set_float(entity, EV_FL_fuser1, speed);
- entity_set_float(entity, EV_FL_fuser2, (get_distance_f(point1, point2) / speed));
- new Float:velocity[3];
- if(reverse)
- {
- xs_vec_sub(point1, point2, velocity);
- }
- else
- {
- xs_vec_sub(point2, point1, velocity);
- }
- xs_vec_mul_scalar(velocity, speed / vector_length(velocity), velocity);
- entity_set_vector(entity, EV_VEC_velocity, velocity);
- new Float:wait = ( reverse ? distance1 : distance2 ) / speed;
- entity_set_float(entity, EV_FL_nextthink, get_gametime() + wait);
- if( !bStatus )
- {
- entity_set_int( entity, EV_INT_movetype, MOVETYPE_NONE );
- }
- return 1;
- }
- public SetMoveStatus( ent, bool:bStatus )
- {
- new Float:origin[ 3 ];
- entity_get_vector( ent, EV_VEC_origin, origin );
- new Property1[ 5 ];
- new Property2[ 5 ];
- new Property3[ 5 ];
- new Property5[ 5 ];
- GetProperty( ent, 1, Property1 );
- GetProperty( ent, 2, Property2 );
- GetProperty( ent, 3, Property3 );
- GetProperty( ent, 5, Property5 );
- new direction = str_to_num( Property3 );
- new Float:origin2[ 3 ];
- origin2 = origin;
- origin2[ direction ] += str_to_float( Property2 );
- entity_set_int( ent, EV_INT_movetype, MOVETYPE_FLY );
- MoveEntity( ent, str_to_float( Property5 ), origin, origin2, bStatus );
- }
- stock get_datadir(name[],len) {
- return get_localinfo("amxx_datadir",name,len);
- }
- stock cmd_target(id,const arg[],flags = CMDTARGET_OBEY_IMMUNITY)
- {
- new player = find_player("bl",arg);
- if (player)
- {
- if ( player != find_player("blj",arg) )
- {
- #if defined AMXMOD_BCOMPAT
- console_print(id, SIMPLE_T("There are more clients matching to your argument"));
- #else
- console_print(id,"%L",id,"MORE_CL_MATCHT");
- #endif
- return 0;
- }
- }
- else if ( ( player = find_player("c",arg) )==0 && arg[0]=='#' && arg[1] )
- {
- player = find_player("k",str_to_num(arg[1]));
- }
- if (!player)
- {
- #if defined AMXMOD_BCOMPAT
- console_print(id, SIMPLE_T("Client with that name or userid not found"));
- #else
- console_print(id,"%L",id,"CL_NOT_FOUND");
- #endif
- return 0;
- }
- if (flags & CMDTARGET_ONLY_ALIVE)
- {
- if (!is_user_alive(player))
- {
- new imname[32];
- get_user_name(player,imname,31);
- #if defined AMXMOD_BCOMPAT
- console_print(id, SIMPLE_T("That action can't be performed on dead client ^"%s^""), imname);
- #else
- console_print(id,"%L",id,"CANT_PERF_DEAD",imname);
- #endif
- return 0;
- }
- }
- if (flags & CMDTARGET_NO_BOTS)
- {
- if (is_user_bot(player))
- {
- new imname[32];
- get_user_name(player,imname,31);
- #if defined AMXMOD_BCOMPAT
- console_print(id, SIMPLE_T("That action can't be performed on bot ^"%s^""), imname);
- #else
- console_print(id,"%L",id,"CANT_PERF_BOT",imname);
- #endif
- return 0;
- }
- }
- return player;
- }
- stock set_user_aim(id, Float:new_angles[3])
- {
- if (pev_valid(id) && is_user_alive(id))
- {
- set_pev(id, pev_angles, new_angles);
- set_pev(id, pev_v_angle, new_angles);
- set_pev(id, pev_fixangle, 1);
- return 1;
- }
- return 0;
- }
- stock bool:is_hull_vacant(const Float:origin[3], hull,id)
- {
- static tr;
- engfunc(EngFunc_TraceHull, origin, origin, 0, hull, id, tr);
- if (!get_tr2(tr, TR_StartSolid) || !get_tr2(tr, TR_AllSolid))
- return true;
- return false;
- }
- stock Effect(Origin[3], r, g, b)
- {
- message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
- write_byte(TE_BEAMCYLINDER);
- write_coord(Origin[0]); //position.x
- write_coord(Origin[1]); //position.y
- write_coord(Origin[2]-20); //position.z
- write_coord(Origin[0]); //axis.x
- write_coord(Origin[1]); //axis.y
- write_coord(Origin[2]+350); //axis.z
- write_short(SpriteBeam); //sprite index
- write_byte(0); //starting frame
- write_byte(0); //frame rate in 0.1's
- write_byte(5); //life in 0.1's
- write_byte(70); //line width in 0.1's
- write_byte(10); //noise amplitude in 0.01's
- write_byte(r); // r
- write_byte(g); // g
- write_byte(b); // b
- write_byte(255); // brightness
- write_byte(15/20); // scroll speed in 0.1's
- message_end();
- }
- stock ColorChat(const id, const string[], {Float, Sql, Resul,_}:...) {
- new msg[191], players[32], count = 1;
- static len;
- len = formatex(msg, charsmax(msg), "^4[%s]^1 ", PLUGIN_PREFIX);
- vformat(msg[len], charsmax(msg) - len, string, 3);
- if(id) players[0] = id;
- else get_players(players,count,"ch");
- for (new i = 0; i < count; i++)
- {
- if(is_user_connected(players[i]))
- {
- message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"),_, players[i]);
- write_byte(players[i]);
- write_string(msg);
- message_end();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement